Posted By

AgentPhoenix on 01/24/08


Tagged

input function security


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

adix
DeadLy


Smart Quoting


 / Published in: PHP
 

  1. function quote_smart( $value )
  2. {
  3. // Stripslashes
  4. {
  5. $value = stripslashes( $value );
  6. }
  7.  
  8. // Quote if not integer
  9. if( ! is_numeric( $value ) )
  10. {
  11. // mysql_real_escape_string requires PHP 4.3.0 and higher!
  12. $value = "'" . mysql_real_escape_string( $value ) . "'";
  13. }
  14.  
  15. return $value;
  16. }

Report this snippet  

You need to login to post a comment.