Advertisement
NiTeWuRX

Function to Sanitize values from forms

Jun 6th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.25 KB | None | 0 0
  1. <?php
  2. // Function to sanitize values received from the form. Prevents SQL injection
  3.     function clean($str) {
  4.         $str = @trim($str);
  5.         if(get_magic_quotes_gpc()) {
  6.             $str = stripslashes($str);
  7.         }
  8.         return mysql_real_escape_string($str);
  9.     }
  10. //
  11. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement