Posted By

cakephpexpert on 03/16/15


cakephp security web Development

Versions (?)

Secure Your Cakephp Website By Following These Simple Steps!

 / Published in: PHP


Follow these steps to secure your Cakephp Website:

*Before you actually start using Security Component functionality, make sure you use $components = array (‘Security’, ‘Auth’) in the array so you can extend its functionality in the other components as well.

*Set security level "Medium" or "High" (in core.php config file)

*Add single line of code to your controller’s before Filter () method: $this->Security->requireAuth(‘action_name’)

To assure more security, add few more lines of code in controller section:

$key = Security::generateAuthKey (); $this->set (‘safe’, $key); $this->Session->write (‘safe’, $key);

Or alternatively adding this code sequence in your view

echo $this->Form->create(‘Post’); echo $this->Form->hidden(‘safe’, $safe); echo $this->Form->input(‘title’); echo $this->Form->input(‘content’); echo $this->Form->end(‘Submit’);


Report this snippet  

You need to login to post a comment.