Re: addslashes()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi:

I just posted a solution I used recently. Here it is:

One way to turn off magic quotes is to place a ".htaccess" file in your root folder. It's simply a text file that contains:

php_value magic_quotes_gpc 0
php_value magic_quotes_sybase 0
php_value magic_quotes_runtime 0

It works for me.

tedd

It's at: http://www.weberforums.com/ftopic8718.html&highlight=



At 5:32 PM -0600 3/29/06, Chris Boget wrote:
I totally blew past that part with the sybase because we aren't using sybase. I guess I should have paid more attention. I'm curious why that directive affects general PHP code and not just the sybase functions.

Oh, well.

Thanks for the heads up.

thnx,
Chris

----- Original Message ----- From: "Jasper Bryant-Greene" <jasper@xxxxxxxxxxx>
To: "Chris Boget" <chris.boget@xxxxxxxx>
Cc: "PHP General" <php-general@xxxxxxxxxxxxx>
Sent: Wednesday, March 29, 2006 5:29 PM
Subject: Re:  addslashes()

From http://php.net/addslashes :

"Having the PHP directive magic_quotes_sybase set to on will mean ' is instead escaped with another '."

Jasper

Chris Boget wrote:
Can someone explain something to me:

<script language="php">
 $string = "Bob's carwash's door";
 echo 'addslashes(): ' . addslashes( $string ) . '<br>';
 echo 'mysql_escape_string(): ' . mysql_escape_string( $string ) . '<br>';
</script>

Outputs:

addslashes(): Bob''s carwash''s door
mysql_escape_string(): Bob\'s carwash\'s door

According to the documentation (http://us2.php.net/manual/en/function.addslashes.php), addslashes() should be doing exactly what mysql_escape_string is doing above (namely, add backslashes in front of each apostrophe). However, it's merely adding an additional apostrophe. Why?

I'm running 4.3.11 on Windows NT 5.2 build 3790.

thnx,
Chris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
--------------------------------------------------------------------------------
http://sperling.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux