Guest User

Untitled

a guest
Jun 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2. $t = $this->sanitize($_POST);
  3. private function sanitize($array=array()) {
  4.         /*
  5.         if(count($array) == 0) {
  6.             $array =& $_POST;
  7.         }
  8.         */
  9.         foreach($array as $k => $v) {
  10.    
  11.             //$_POST[$k] = preg_replace('/\\\u([0-9a-f]{4})/ie', "chr(hexdec('\\1'))",  $v);
  12.             if(!is_array($k) && !is_array($v)) {
  13.                 //echo '<br />$v: '.$v.'<br />';
  14.                 $array[$k] = utf8_decode($v);
  15.                 //echo '$array[$k]: '.$array[$k].'<br />';
  16.             } else {
  17.                 if(is_array($k)) {
  18.                     $this->sanitize($k);
  19.                 }
  20.  
  21.                 if(is_array($v)) {
  22.                     $this->sanitize($v);
  23.                 }
  24.             }
  25.         }
  26.         echo '<pre>';
  27.         print_r($array);
  28.         echo '</pre>';
  29.         return $array;
  30.        
  31.     }
  32.  
  33. ?>
Add Comment
Please, Sign In to add comment