kmaid Posted November 5, 2008 Share Posted November 5, 2008 Hi guys, I am trying to improve my sanatizing function to allow me to send single elements and arrays to be sanatised however i am running into issues. The stripslashes function does not appear to be working as when i put a string like "Test\" it comes out with "Test\\". $input_arr = array(); foreach ($Data as $key => $input_arr) { $Data[$key] = stripslashes($Data[$key]); $Data[$key] = htmlentities($Data[$key]); $Data[$key] = mysql_real_escape_string($Data[$key]); } return $Data; Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 5, 2008 Share Posted November 5, 2008 Can we see more of your code? Why do you have this line: <?php $input_arr = array(); ?> Ken Quote Link to comment Share on other sites More sharing options...
kmaid Posted November 5, 2008 Author Share Posted November 5, 2008 That is most of the function however i cut off the top :x function libStripInputSlashes($Data) { $input_arr = array(); foreach ($Data as $key => $input_arr) { $Data[$key] = stripslashes($Data[$key]); $Data[$key] = htmlentities($Data[$key]); $Data[$key] = mysql_real_escape_string($Data[$key]); } return $Data; } I am afraid i dont remember why i put that in i wrote this code a while ago only to deal with $_POST and $_GET but have since needed more from it. I worked from http://uk3.php.net/foreach and have been playing with it for a bit my original idea was to temporarily store the variables in $input_arr and then save them back into the original array. However I have been staring at this code for a bit and it seems to make less and less sense Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.