CodeIgniter security-Related Settings Rollup _php tutorial

Source: Internet
Author: User
Tags codeigniter csrf attack
The CodeIgniter framework itself provides security settings such as protection against XSS and CSRF attacks, and protection against SQL injection attacks.

In the case of a configuration file:

In the application/config/config.php

$config [' encryption_key '] = ';//This must be set to encrypt your own cookie, etc. $config[' cookie_secure ' = true;//set to true/*|----------------- ---------------------------------------------------------| Global XSS filtering globally XSS filter set to true|--------------------------------------------------------------------------| | Determines whether the XSS filter is always active when GET, POST or| COOKIE data is encountered|*/$config [' global_xss_filtering '] = true;//guard against CSRF attack $config[' csrf_protection '] = true;$ config[' csrf_token_name ' = ' mall_tooken '; $config [' csrf_cookie_name '] = ' mall_cookie '; $config [' csrf_expire '] = 7200 ;//Set the appropriate time

Open system/core/input.php

Set the $xss_clean in the Get and post methods to true of course your site is safe if it doesn't matter, it's not set or explicitly set when you call Get or post to take arguments.

The development needs to note:

1. Use

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

Instead of using $_get[' name '];

2. Use

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

Instead of using $_post[' name '];

3. Use the ActiveRecord query statement and try to avoid statements such as Select

http://www.bkjia.com/PHPjc/824652.html www.bkjia.com true http://www.bkjia.com/PHPjc/824652.html techarticle The CodeIgniter framework itself provides security settings such as protection against XSS and CSRF attacks, and protection against SQL injection attacks. In terms of configuration files: in application/config/config.ph ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.