Jump to content

Las Venturas Roleplay Website


R4nk3d

Recommended Posts

so tell me if my plan will work:

 

ill put this code into 1 file in my sources directory, then include it on top of my edit, register, and login pages. Then for the variables ill just change them to what you just typed out for me.

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

×
×
  • 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.