Forums

PHP

This topic is locked

Phakt and magic_quotes off in PHP 4.2.1

Posted 27 Jun 2002 18:55:27
1
has voted
27 Jun 2002 18:55:27 Brent Colflesh posted:
Dear Folks (Cirstoiu in particular!),
One of my hosts upgraded to PHP 4.2.1, which has magic_quotes off by default. The site was built with Phakt 1.3.0 and Adodb 1.99 - I upgraded Adodb to 2.11, after reading the note about auto checking for magic_quotes, but I still get errors when attempting MySQL operations on fields that contain single or double quotes.

Before I mess up the nice Phakt code to addslashes, can someone tell me if the Phakt 1.5.0 code solves this problem?

Or tell me the most efficient way of solving this in the 1.3.0 code?

Thanks for your time & assistance!

Regards,
Brent

Replies

Replied 27 Jun 2002 19:44:08
27 Jun 2002 19:44:08 Tim Green replied:
This problem isn't an easy to one to resolve. The problem is that most providers are still using lower versions of PHP, and therefore changing all of the code in PHAkT isn't going to work, as it will break everyone else's site.

So it's a Catch 22 situation, I'm afraid.

One of the things that you could do, is to add the following code block to your connection file (as long as it is included on every page):-

<?php
if (!magic_quotes_runtime) {
set_magic_quotes_runtime(1);
}
?>

This should alleviate the problem without too much hassle.

Hope this helps.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 27 Jun 2002 20:34:20
27 Jun 2002 20:34:20 Brent Colflesh replied:
Dear Tim,
As always, you are source of helpful information - I'll do this when I get home...

I realize the part about changing the Phakt codebase - it seems like it wouldn't be much overhead to add a snippet like you suggest by default though...

Again - Thanks!

Brent

Replied 28 Jun 2002 00:28:18
28 Jun 2002 00:28:18 Brent Colflesh replied:
Update -
When I use Tim's code, I get:

[error] PHP Notice: Use of undefined constant magic_quotes_runtime - assumed 'magic_quotes_runtime'

If I change Tim's code slightly:

&lt;?php
if (get_magic_quotes_gpc()) {
set_magic_quotes_runtime(1);
}
?&gt;

Then I don't get an error, but it does not have the desired effect.

For my server, I had to add the following line to .htaccess in my web root directory:

php_value magic_quotes_gpc 1

Per some notes from the man pages on www.php.net

Regards,
Brent

Replied 28 Jun 2002 16:43:08
28 Jun 2002 16:43:08 Aurel Sorin Cirstoiu replied:
magic_quotes_gpc MUST be turn to ON end magic_quotes_runtime MUST be turn to OFF.

-----------------------
Cirstoiu Aurel Sorin
InterAKT Support
www.interakt.ro
-----------------------

Reply to this topic