Posted By

mukeshdak on 07/25/11


Tagged

clean mukeshdak


Versions (?)

Clean Input


 / Published in: PHP
 

URL: http://dak9.com

code below can be used to clean any input, submitted by any form etc.

  1. // Function for cleaning any input, submitted by any form etc.
  2. function clean($i)
  3. {
  4. $i = rtrim($i);
  5. $look = array('&', '#', '<', '>', '"', '\'', '(', ')');
  6. $safe = array('&amp;', '&#35', '&lt;', '&gt;', '&quot;', '&#39', '&#40;', '&#41;');
  7. $i = str_replace($look, $safe, $i);
  8. return $i;
  9. }

Report this snippet  

You need to login to post a comment.