CodeIgniter security-related settings summary_php tutorial

Source: Internet
Author: User
CodeIgniter security settings. The CodeIgniter framework provides security settings such as XSS and CSRF attacks and SQL injection attacks. In terms of configuration files: The applicationconfigconfig. ph CodeIgniter framework provides some security settings, such as XSS and CSRF attacks and SQL injection attacks.

For the configuration file:

In application/config. php

$ Config ['encryption _ key'] = ''; // this parameter must be set to encrypt your own cookies. $ config ['cookie _ secure '] = TRUE; // set to TRUE/* | optional | Global XSS Filtering Global XSS filter to TRUE | optional | Determines whether the XSS filter is always active when GET, POST or | COOKIE data is encountered | */$ config ['global _ xss_filtering '] = TRUE; // prevents csrf attacks $ 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 $ xss_clean in the get and post methods to true. of course, if your site is secure and indifferent, you don't need to set it or explicitly set it when you call get or post to retrieve parameters.

Note the following during development:

1. use

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

Instead of $ _ GET ['name'];

2. use

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

Instead of $ _ POST ['name'];

3. use ActiveRecord query statements instead of select statements.

Bytes. For the configuration file: in application/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: 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.