×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: fatelord
Added: May 26, 2014 12:06 PM
Views: 18
Tags: filter input
Filter input, Prevents accessing superglobal variables directly
  1. $machine_ip = filter_input(INPUT_SERVER, 'REMOTE_ADDR');
  2.  
  3. ///Sample
  4. $search_html = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_SPECIAL_CHARS);
  5. $search_url = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_ENCODED);
  6. echo "You have searched for $search_html.\n";
  7. echo "<a href='?search=$search_url'>Search again.</a>";