Want more features on Pastebin? Sign Up, it's FREE!
Guest

MyPHPFilter.php

By: NoSalt on Oct 31st, 2011  |  syntax: PHP  |  size: 1.63 KB  |  views: 47  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.     if(!get_magic_quotes_gpc()) {
  3.     if(is_array($_GET)) {
  4.         foreach($_GET as $key1 => $val1) {
  5.         if( is_array($val1) ) {
  6.             foreach($val1 as $key2 => $val2) {
  7.             $val1[$key2] = mysql_real_escape_string(htmlentities(addslashes($val2)));
  8.             }
  9.         }
  10.         else {
  11.             $_GET[$key1] = mysql_real_escape_string(htmlentities(addslashes($val1)));
  12.         }
  13.         }
  14.     }
  15.  
  16.     if( is_array($_POST) ) {
  17.         foreach($_POST as $key1 => $val1) {
  18.         if( is_array($val1) ) {
  19.             foreach($val1 as $key2 => $val2) {
  20.             $val1[$key2] = mysql_real_escape_string(htmlentities(addslashes($val2)));
  21.             }
  22.         }
  23.         else {
  24.             $_POST[$key1] = mysql_real_escape_string(htmlentities(addslashes($val1)));
  25.         }
  26.         }
  27.     }
  28.     }
  29.     else {
  30.     if( is_array($_GET) ) {
  31.         foreach($_GET as $key1 => $val1) {
  32.         if( is_array($val1) ) {
  33.             foreach($val1 as $key2 => $val2) {
  34.             $val1[$key2] = mysql_real_escape_string(htmlentities(addslashes($val2)));
  35.             }
  36.         }
  37.         else {
  38.             $_GET[$key1] = mysql_real_escape_string(htmlentities(addslashes($val1)));
  39.         }
  40.         }
  41.     }
  42.  
  43.     if( is_array($_POST) ) {
  44.         foreach($_POST as $key1 => $val1) {
  45.         if( is_array($val1) ) {
  46.             foreach($val1 as $key2 => $val2) {
  47.             $val1[$key2] = mysql_real_escape_string(htmlentities(addslashes($val2)));
  48.             }
  49.         }
  50.         else {
  51.             $_POST[$key1] = mysql_real_escape_string(htmlentities(addslashes($val1)));
  52.         }
  53.         }
  54.     }
  55.     }
  56. ?>
clone this paste RAW Paste Data