Re: Stripslashes

From: Date: Mon, 15 Jan 2007 19:32:39 +0000
Subject: Re: Stripslashes
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-247109@lists.php.net to get a copy of this message
On 1/14/07, Beauford <phpuser@netscan.ca> wrote:
I guess I'm just doing something wrong, 'cause that doesn't work either - nor do the hundreds of other snippets I've used. Here's the scenario. I have a form - after they submit the form it shows what they have entered, this is where I get the \. It also does it if the form redisplays after the user has input invalid data.
Just a refresher/reminder, and try to make things simple... escape input/output according to the context: if reading a form variable from POST/GET/COOKIES and magic_gpc is on: unescape the vars via stripslashes other wise do nothing if putting a variable, to a db use the databases escape function before passing it to the db if putting it to html, htmlspecialchar() or htmlenties() the variable before displaying it if putting it in a url, urlencode it. if putting it to X, Xencode it. (where X some other output) When following these guidelines you will be able to find the exact area where the problem is. Curt

« previous php.general (#247109) next »