Advertisement
NoSalt

MyPHPFilter.php

Oct 31st, 2011
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.63 KB | None | 0 0
  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. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement