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

  • SEARCH
  • Home
  • 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 1091759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:34:50+00:00 2026-05-16T23:34:50+00:00

Some doubts regarding Codeigniter and its Input handling capabilities. Some may be a little

  • 0

Some doubts regarding Codeigniter and its Input handling capabilities. Some may be a little weird but they are doubts none-the-less.

  1. If I use the Active Record Class functions in CodeIgniter, is my input prevented against SQL injection?
  2. I read somewhere that it does, but I don’t understand it how? or why?
  3. Also does xssclean deal with SQL injection in any way?
  • 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-05-16T23:34:50+00:00Added an answer on May 16, 2026 at 11:34 pm

    is my input prevented against SQL injection?

    Not exactly ‘automatically’, but it does provide parameterised queries. CodeIgniter or no, you should use parameterised queries in preference to query string hacking whenever possible.

    $bof= "a'b";
    $zot= 'a\b';
    
    // Insecure! Don't do this!
    //
    $this->db->query("SELECT foo FROM bar WHERE bof='$bof' AND zot='$zot'"); 
    
    // Secure but annoying to write
    //
    $this->db->query("SELECT foo FROM bar WHERE bof='".$this->db->escape($bof)."' AND zot='".$this->db->escape($zot)."'"); 
    
    // This is what you want
    //
    $this->db->query('SELECT foo FROM bar WHERE bof=? AND zot=?', array($bof, $zot)); 
    

    Note this is nothing to do with ‘input’: when you make an SQL query from strings you must use parameterisation or escaping to make them fit, regardless of whether they’re user input or not. This is a matter of simple correctness; security is a side-effect of that correctness.

    Similarly when you output text into HTML, you need to HTML-encode <, & and " characters in it then. It is absolutely no use trying to fiddle with the input to escape or remove characters that might be troublesome in the future if you happen to use them without escaping in SQL or HTML. You’ll mangle your output by having unexpected SQL-escaping in HTML (which is why you see self-multiplying backslashes in badly-written apps) and unwanted HTML-escaping in SQL. And should you take text from somewhere other than that direct user input (say, material already in the database) you aren’t protected at all.

    Also does xssclean deal with SQL injection in any way?

    No. It’s aimed at HTML injection. But it’s worse than worthless. Never use it.

    “XSS filtering” is completely bogus (again, CodeIgniter’s or anyone else’s). XSS needs to be prevented by correctly HTML-escaping output, not mangling input. XSS filtering will not adequately protect you if your application is not already secure; at best it will obfuscate your existing flaws and give you a false sense of security. It will also mangle a lot of valid input that CI thinks looks like tags.

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

Sidebar

Related Questions

I have some doubts regarding Strings Are they live on Heap or String pool?
I have a few doubts regarding exception handling in iPhone. Here are they: Suppose
I have some doubts regarding the following controller action (in ASP.NET MVC, but it's
I have programmed an emulator, but I have some doubts about how to organizate
I have some doubts regarding In-Application-Billing in android: Can i test it with different
I have some doubts regarding sitemap.xml generation and Django's sitemap framework particularly. Let's say
Would like to post some doubts regarding Thread synchronization. I understood the concepts of
i am reading some things about VML, but i have some doubts. What versions
I have some doubts regarding service hosting in WCF. I want to host a
i'm writing my first plugin for wordpress and i have some doubts regarding the

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.