Re: Filtering out \ when a ' is user entered?

From: Date: Thu, 28 Jun 2001 00:37:46 +0000
Subject: Re: Filtering out \ when a ' is user entered?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55443@lists.php.net to get a copy of this message
I sent a reply to this earlier but for some reason some of my posts never make it to the list, so here it is again (hopefully it will post this time, and only once:) >> The way I do it is to use a function to check if magic quotes are on (because if they're on the conversion is done automatically for you) and if they're not, use the AddSlashes function before writing to the database and use StripSlashes after reading from the database. You can use these two functions: function myAddSlashes($st) { if (get_magic_quotes_gpc()==1) { return $st; } else { return AddSlashes($st); } } function myStripSlashes($st) { if (get_magic_quotes_gpc()==1) { return $st; } else { return StripSlashes($st); } } Hope this helps, ______________________________ (aral@kismia.com) New Media Producer, Kismia, Inc. (aral@american.edu) Adj. Prof., American University ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

« previous php.general (#55443) next »