欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

CodeIgniter安全相關設置匯總

 更新時間:2014年07月03日 14:58:37   投稿:shichen2014  
這篇文章主要介紹了CodeIgniter安全相關設置,需要的朋友可以參考下

CodeIgniter框架自身提供了一些安全設置如針對XSS和CSRF攻擊的防范,針對SQL注入攻擊的防范等。

就配置文件而言:

在application/config/config.php中

$config['encryption_key'] = '';//這個一定要設置 以加密自己的cookie等
$config['cookie_secure'] = TRUE;//設置為TRUE
/*
|--------------------------------------------------------------------------
| Global XSS Filtering全局XSS過濾設置為TRUE
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
*/
$config['global_xss_filtering'] = TRUE;
//防范csrf攻擊
$config['csrf_protection'] = TRUE;
$config['csrf_token_name'] = 'mall_tooken';
$config['csrf_cookie_name'] = 'mall_cookie';
$config['csrf_expire'] = 7200;//設置適當?shù)臅r間

打開system/core/Input.php

將get和post方法中的$xss_clean設置為true 當然你的站點如果是安全無所謂的 那就不設置或是在調用get或是post取參數(shù)時明確設置就可以了

開發(fā)中需要注意:

1.使用

$this->input->get( 'name', true );

而不使用$_GET[ 'name' ];

2.使用

$this->input->post( 'name', true );

而不使用$_POST[ 'name' ];

3.使用ActiveRecord查詢語句而盡量不用select之類的語句

相關文章

最新評論