Forum Moderators: coopster

Message Too Old, No Replies

Problem with Image

after setting register_globals=OFF and magic_quotes_gpc=OFF

         

Gian04

12:42 pm on Jul 8, 2007 (gmt 0)

10+ Year Member



Recently I've found that my host magic_quotes_gpc and register_globals are set to ON, but using the php.ini Ive successfully set the 2 functions to OFF.

But I've noticed that the following codes no long works after ive set the 2 functions to OFF.


$imagename = "http://www.example.com/image.png";
$image1 = @imagecreatefrompng($imagename);
$textcolor = imagecolorallocate($image1, 146, 2, 2);

imagestring($image1, 2, 3, 100, 'Sample Text', $textcolor);

header("Content-type: image/png");
imagepng($image1);
imagedestroy($image1);

Is there any other adjustments needed because of the effect of magic_quotes_gpc=OFF and register_globals=OFF?

[edited by: Gian04 at 12:56 pm (utc) on July 8, 2007]

phparion

5:23 am on Jul 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



the effect of magic_quotes_gpc=Off

quotes and double quotes will no longer be escaped automatically in the POSTED data so you need to use functions like addslashes() manually to escape them as they DO cause problems and break queries etc in certain cases.

the effect of register_globals=Off

your direct variable name references will no longer work and you must have to fetch the posted data from variables using Global Arrays e.g $_POST, $_GET etc etc

tip: instead of switching off things permanently in the php.ini, especially on a live serve with different applications, you should use ini_set() function or htaccess to change the php behavior just for the LIFE TIME of your script. this is the best chosen method to avoid any crashes.