mysql_prep function


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function mysql_prep($value) {
  2. $magic_quotes_active = get_magic_quotes_gpc();
  3. $new_enough_gpc = function_exists("mysql_real_escape_string"); // i.e, PHP >= v4.3.0
  4.  
  5. if ($new_enough_gpc) {
  6. if($magic_quotes_active) {$value = stripslashes($value);}
  7. $value = mysql_real_escape_string($value);
  8. }
  9. else {
  10. if (!$magic_quotes_active) {$value = addslashes($value);}
  11. }
  12. return $value;
  13. }
  14.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.