[ale] [OT] .php logic problem
ChangingLINKS.com
x3 at ChangingLINKS.com
Thu Aug 7 13:51:02 EDT 2003
I have spent a lot of time on a weird php problem.
I am trying to make sure that the ' character is always escaped in my
database.
* I do not have the ability to configure the server.
* I do not know or care to know if magic_quotes_gpc is ON
âÂÂ
* htmlspecchar is not an option
I am using a form to update a field in the table.
1. If I use addslashes over and over like this:
$description = addslashes($description);
each time I click "update" it adds more and more slashes. (\\\\')
2. If I stripslashes and addslashes like this:
$description = stripslashes($description);
$description = addslashes($description);
this results in ' (no slashes) (why?)
3. If I try getting fancy, I get lost like this:
$description = stripslashes($description);
$description = ereg_replace("'", "3edc1", $description);
$description = ereg_replace("3edc1", "'", $description);
$description = addslashes($description);
this still results in ' (no slashes)
4. My goal is to always end up with \' in the database after I update
How do I do that?
The code just modifys the "description" string:
$description = stripslashes($description);
$description = ereg_replace("%", "percent", $description);
$description = ereg_replace("\"", "", $description);
// $description = ereg_replace("'", "d4c1", $description);
// $description = ereg_replace("d4c1", "\\d4c1", $description);
// $description = ereg_replace("d4c1", "'", $description);
// $description = addslashes($description);
$description = ereg_replace("w/", "3edc", $description);
$description = ereg_replace("/", " ", $description);
$description = ereg_replace("3edc", "w/", $description);
$description = strtolower( $description );
$description = ereg_replace("&", "and", $description);
Also related:
Does anyone know how to change the open (and close) apostrophes into \'
as well?
--
Wishing you Happiness, Joy and Laughter,
Drew Brown
http://www.ChangingLINKS.com
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list