CodeIgniter Security Settings

Source: Internet
Author: User
Tags codeigniter

The CodeIgniter framework provides 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.

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.