Jump to content

SQL Code Stripping... preventing SQL injections?


mschrank99

Recommended Posts

I'm not sure how you would do that exactly. HTML is easily definable because they are enclosed within <>. SQL is not, unless you strip all SELECT, FROM and WHERE words from $_POST.

What sort of SQL injection are you worried about? are you directly running an entry from a post field into an sql statement?

If not, just look at addslashes().

Cheers,
Dave
A way I like to clean my $_POST array...

[code=php:0]
<?php
function clean_array($array) {
    $new_array = array();
    foreach($array AS $key => $val) {
      $new_array[$key] = mysql_real_escape_string($val);
    }
    return $new_array;
}
?>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.