Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7931557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:45:18+00:00 2026-06-03T20:45:18+00:00

In the CodeIgniter PHP framework, there is a function that automatically runs on each

  • 0

In the CodeIgniter PHP framework, there is a function that automatically runs on each request that, among other things, filters the GET/POST/COOKIE array keys, and kills the application if it encounters characters it deems unsafe.

To prevent malicious users from trying to exploit keys we make sure that keys are only named with alpha-numeric text and a few other items.

Something like:

// foreach GET/POST/COOKIE keys as $str...
if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
{
    exit('Disallowed Key Characters.');
}

For example, this will trigger if you accidentally post something like <input name="TE$T"> or have a query string like ?name|first=1.

I can see this being a good way to enforce common sense key names, or catch mistakes while developing an application, but I don’t understand: How can a malicious user possibly “exploit keys” in $_POST data for instance? Especially since (I would assume) input values are just as exploitable, what is this actually preventing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:45:20+00:00Added an answer on June 3, 2026 at 8:45 pm

    Your question, in itself, brings up a good point: it’s unclear what exactly you’re being protected against. But there are some popular items it could be addressing:

    • magic quotes
    • things that could eventually lead to SQL injection
    • strings that could be executed by way of shell commands
    • things that could conflict with your URL
    • things that could conflict with HTML
    • things that resemble a directory traversal attack
    • cross site scripting (XSS) attacks

    But other than those, I really can’t think of why you’d always why you’d want to generally protect via preg_match("/^[a-z0-9:_\/-]+$/i", $str).

    I’ve got the feeling that they’re overprotecting simply because CodeIgniter is so widely used that they need to protect against things they themselves haven’t thought of yet for the sake of their users who may be even less-aware of such attacks than CodeIgniter’s developers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using CodeIgniter framework for PHP . There are some pages that are
I am using the CodeIgniter 2.1 PHP framework. I have a library file that
Is there a Wikipedia API library for PHP, especially for the CodeIgniter framework? The
I am using Codeigniter framework for PHP. I was wondering if there is a
I've been testing nuSoap with codeIgniter (PHP Framework) but seems nuSoap isn't prepared to
I'm using CodeIgniter (a PHP framework) to build an app, and I have an
I am new to PHP Codeigniter framework. I am designing a page in which
I am thinking of using a PHP framework called CodeIgniter . One of the
I am using codeigniter framework. where should i sanitize PHP input - controller or
I'm now trying to create a xml-rpc server with the CodeIgniter Framework. <?php $this->load->library('xmlrpc');

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.