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

From: Date: Wed, 27 Jun 2001 16:04:50 +0000
Subject: Re: Filtering out \ when a ' is user entered?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55405@lists.php.net to get a copy of this message
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 :) ______________________________ (aral@kismia.com) New Media Producer, Kismia, Inc. (aral@american.edu) Adj. Prof., American University ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

« previous php.general (#55405) next »