[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/var/www/se3/includes/ -> traitement_data.inc.php (source)

   1  <?php
   2  
   3  // Nettoyage des variables
   4  
   5  require_once ("../se3/includes/library/HTMLPurifier.auto.php");
   6  
   7  $config = HTMLPurifier_Config::createDefault();
   8  $config->set('Core.Encoding', 'utf-8'); // replace with your encoding
   9  $config->set('HTML.Doctype', 'XHTML 1.0 Strict'); // replace with your doctype
  10  $purifier = new HTMLPurifier($config);
  11  
  12  $magic_quotes = get_magic_quotes_gpc();
  13  
  14  foreach($_GET as $key => $value) {
  15     $test_key=$purifier->purify($key);
  16     //echo "key=$key<br />test_key=$test_key<br />";
  17  
  18      if($key!=$test_key) {
  19          unset($_GET[$key]);
  20      }
  21      else {
  22          if(!is_array($value)) {
  23              if ($magic_quotes) $value = stripslashes($value);
  24              $_GET[$key]=$purifier->purify($value);
  25              if ($magic_quotes) $_GET[$key] = addslashes($_GET[$key]);
  26          }
  27          else {
  28              foreach($_GET[$key] as $key2 => $value2) {
  29                  if ($magic_quotes) $value2 = stripslashes($value2);
  30                  $_GET[$key][$key2]=$purifier->purify($value2);
  31                  if ($magic_quotes) $_GET[$key][$key2] = addslashes($_GET[$key][$key2]);
  32              }
  33          }
  34      }
  35  }
  36  
  37  foreach($_POST as $key => $value) {
  38      $test_key=$purifier->purify($key);
  39      //echo "key=$key<br />test_key=$test_key<br />";
  40  
  41      if($key!=$test_key) {
  42         unset($_POST[$key]);
  43      }
  44      else {
  45          if(!is_array($value)) {
  46              if ($magic_quotes) $value = stripslashes($value);
  47                $_POST[$key]=$purifier->purify($value);
  48              if ($magic_quotes) $_POST[$key] = addslashes($_POST[$key]);
  49          }
  50          else {
  51              foreach($_POST[$key] as $key2 => $value2) {
  52                  $test_key=$purifier->purify($key2);
  53                  //echo "key2=$key2<br />test_key=$test_key<br />";
  54  
  55                  if($key2!=$test_key) {
  56                     unset($_POST[$key][$key2]);
  57                  }
  58                  else {
  59                      if(!is_array($value)) {
  60                             if ($magic_quotes) $value2 = stripslashes($value2);
  61                          $_POST[$key][$key2]=$purifier->purify($value2);
  62                          if ($magic_quotes) $_POST[$key][$key2] = addslashes($_POST[$key][$key2]);
  63                      }
  64                  }
  65              }
  66          }
  67      }
  68  }
  69  
  70  ?>


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1