Forum Moderators: coopster

Message Too Old, No Replies

Stripslashes()

Are there any common pitfalls?

         

Nick_W

2:33 pm on Sep 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all

Can't for the life of me work out why I can't seem to use stripslashes()

Whenever the form I'm using is pre-filled with the cookies I've set (username etc) they are slashed :(

I've tried stripslashes($_COOKIE['value']);
and a number of other things to no avail....

Anyone think of where I might look in my code?

Cheers

Nick

jatar_k

4:55 pm on Sep 17, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Nick,

Have you tried adding a step and putting

$somevar = $_COOKIE['value'];
$othervar = stripslashes($somevar);

I know it's longer but just to test if it, for some reason, doesn't want to do it straight out of the cookie.

Nick_W

5:16 pm on Sep 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, thanks Jatar, actually I ended up finding the problem in the $_POST array.

When I do this now:

setcookie('val', stripslashes($_POST['val']);

all is well. Strange though as I thought I'd tried that before posting?

Well, weirder things happen when you're knee deep in a simple script grown scary ;)

Cheers

Nick

ergophobe

5:22 pm on Sep 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Forget it - I see Nick found the problem. Strange.

Tom