Jump to content

Recommended Posts

if your just going to use the functions with array_map() and include the functions from another file  get rid of

<?php
if(get_magic_quotes_gpc()){}
if(!get_magic_quotes_gpc()){}
?>

 

and just array map the functions into the variables ;)

k, heres what i got now:

require("./sources/string_array_maps.php");
$user = $_POST["Username"];
$pass = $_POST["Password"];
//.... continues on

<?php
function stripslashes_deep($value)
    {
        $value = is_array($value) ?
                    array_map('stripslashes_deep', $value) :
                    stripslashes($value);
        return $value;
    }
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
    $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
function clean_post_var($var){
      $var=mysql_real_escape_string(trim(strip_tags($var)));
      $var=htmlspecialchars($var,ENT_QUOTES);
      return filter_var($var,FILTER_SANITIZE_STRING);
}
$_POST = array_map('clean_post_var', $_POST);
    $_GET = array_map('clean_post_var', $_GET);
    $_COOKIE = array_map('clean_post_var', $_COOKIE);
    $_REQUEST = array_map('clean_post_var', $_REQUEST);
?>

This look right?

Include.php

<?php
   function stripslashes_deep($value)
    {
        $value = is_array($value) ?
                    array_map('stripslashes_deep', $value) :
                    stripslashes($value);
        return $value;
    }
  
   function clean_post_var($var){
      $var=mysql_real_escape_string(trim(strip_tags($var)));
      $var=htmlspecialchars($var,ENT_QUOTES);
      return filter_var($var,FILTER_SANITIZE_STRING);
   }
  
?>

page.php:

[code]<?php
$user = $_POST["Username"];
$user.= array_walk($user,'stripslashes_deep');
$user.= array_walk($user,'clean_post_var');
///etc and so on///
?>

[/code]

it doesnt matter if you put it all ine one variable or make it 3 variables it still works like i did it ;)

no, if i put root as the username, it inputs it into the db as rootroot because im adding it again. so it needs to be $user = strip...

 

but yeah, its working

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.