/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function sanitize_sql_string($string, $min='', $max='') { $pattern[0] = '/(\\\\)/'; $pattern[1] = "/\"/"; $pattern[2] = "/'/"; $replacement[0] = '\\\\\\'; $replacement[1] = '\"'; $replacement[2] = "\\'"; if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) return FALSE; } //usage //sanitize_sql_string($an_unsafe_string);
Comments
