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

CodeIgniter安全相關(guān)設(shè)置匯總

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

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

就配置文件而言:

在application/config/config.php中

$config['encryption_key'] = '';//這個(gè)一定要設(shè)置 以加密自己的cookie等
$config['cookie_secure'] = TRUE;//設(shè)置為TRUE
/*
|--------------------------------------------------------------------------
| Global XSS Filtering全局XSS過濾設(shè)置為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è)置適當(dāng)?shù)臅r(shí)間

打開system/core/Input.php

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

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

1.使用

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

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

2.使用

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

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

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

相關(guān)文章

最新評(píng)論