Tero

Untitled

Jun 12th, 2017
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. if (isset($_POST['q']))
  2.     $search = sanitize($_POST['q']);
  3. else if (isset($_GET['q']))
  4.     $search = sanitize($_GET['q']);
  5.  
  6. function sanitize($str) {
  7.     $str = strip_tags($str);
  8.     $str = str_replace("&", "&", $str);
  9.     $str = htmlspecialchars($str, ENT_QUOTES, "ISO-8859-1");
  10.     return $str;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment