Welcome Guest, Not a member yet? Register   Sign In
How to prevent SQL injection
#3

[eluser]CroNiX[/eluser]
If you use CI's active record or query bindings for database operations, all variables are already been run through mysql_real_escape_string(). I'd convert your "native" sql queries to Active Record, or at least run any variables through $this->db->escape() before executing them in a query. To me, the database layer should be taking care of using database functions, like mysql_real_escape_string(), and not somewhere else like in input::post().

You might also run into some problems if you do it on post variables, since they get run through form validation (or should be), and if some things are escaped it could cause them to fail validation as the data has changed and things added.


Messages In This Thread
How to prevent SQL injection - by El Forum - 05-30-2012, 08:24 AM
How to prevent SQL injection - by El Forum - 05-30-2012, 09:17 AM
How to prevent SQL injection - by El Forum - 05-30-2012, 09:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB