Jump to content

Recommended Posts

Helping against XSS let me know how improved clean function works:

 

<?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($var));
      $var= strip_tags('allowed tags',$var);
      $var=htmlspecialchars($var,ENT_QUOTES);
      return filter_var($var,FILTER_SANITIZE_STRING);
   }
?>

Calling function in code:

<?php
$referralForm=
stripslashes_deep(clean_post_var($_POST['referralForm']));
$mp_nameForm=
stripslashes_deep(clean_post_var($_POST['mp_nameForm']));
$hp_nameForm=
stripslashes_deep(clean_post_var($_POST['hp_nameForm']));
$dealForm=
stripslashes_deep(clean_post_var($_POST['dealForm']));
$contact_userForm=
stripslashes_deep(clean_post_var($_POST['contact_userForm']));
$my_ptcForm=
stripslashes_deep(clean_post_var($_POST['my_ptcForm']));
$his_ptcForm=
stripslashes_deep(clean_post_var($_POST['his_ptcForm']));
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/153279-user-website/#findComment-819916
Share on other sites

hey,thanks but im using prepared statements...dont know if theres anything in that code that will help but i know real escape is not necessary anymore, so, maybe the rest wount be useful either ?

im having a look at dom xss attacks and ive found some info, so hopefull i can nail the problem with ease

 

Link to comment
https://forums.phpfreaks.com/topic/153279-user-website/#findComment-819994
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.