note 22788 deleted from function.addslashes by philip
| From: | philip@php.net | Date: | Tue, 20 Jul 2004 17:19:06 +0000 |
| Subject: | note 22788 deleted from function.addslashes by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73713@lists.php.net to get a copy of this message | ||
Note Submitter:
----
I think its a big prob that addslashes keeps adding slashes if you run it over and over on the
same var. For ex. If magic quotes are on (witch is usually always) this would happen.. open this
script with ?log=joes_dog
echo $_GET[log]
would print joe/s_dog
but if you insert that to a db, and use addslashes like every tutorial says out there
You end up
with a joe//s_dog". There needs to be an optional pram to skip if already slashed, the
func below isnt the best way cuz if the data inside has / in it for some reason it would think
addslashes has gotten to it.. An internal function change is really the only easy way to fix the
slash fight.
Heres a basic func that tell if the info is already slashed..
function is_slashed($data) {
if(stripslashes($data) == $data) {
return 0;
} else {
return 1;
}
}