Page 1 of 1

captcha in 1.3.3 disappeared

Posted: Fri Nov 06, 2009 3:34 pm
by mspot
Is it me or the captcha image in reviews and contact form disappeared?
Default new installation of 1.3.3 (check http://133testshop.e-lasithi.gr/)
On the same server same configuration captcha in 1.3.2 works without a problem.

## UPDATE ##

Gzip compression is causing the error. If you set it (compression level) to zero the problem goes away.

Any quick fix for Gzip?

Re: captcha in 1.3.3 disappeared

Posted: Sun Nov 08, 2009 4:01 am
by mspot
I apologize. Actually I forgot the gzip compression setting to 0, so you couldn't see the error ( http://133testshop.e-lasithi.gr ). I changed that to 4 and now you can see it.

Re: captcha in 1.3.3 disappeared

Posted: Sun Nov 08, 2009 5:19 am
by Daniel
its just comming up that nothing is there.

Re: captcha in 1.3.3 disappeared

Posted: Sun Nov 08, 2009 6:57 am
by mspot
Daniel wrote:its just comming up that nothing is there.
I don't understand what you mean.
In order to "see" the error you must visit the "Reviews" section of a product or the Contact form. The (captcha) image simply doesn' t appear.

Re: captcha in 1.3.3 disappeared

Posted: Sun Nov 08, 2009 7:41 am
by Daniel
this has to be something to do with your server.

it works fine on my demo site or dev site.

maybe the html is already sent out compressed.

Re: captcha in 1.3.3 disappeared

Posted: Sun Nov 08, 2009 7:47 am
by mspot
On the very same server, same settings (gzip compression = 4) version 1.3.2 works flawlessly. Check it out.
http://testshop.e-lasithi.gr

By the way server in Centos 5 Apache 2.2.3 PHP 5.2.9

#UPDATE#

It seems the problems come from the file /system/library/responce.php
When I replace this file with the old one from version 1.3.2 everything works again ^-^

There are some differences in those files

responce.php 1.3.3

Code: Select all

line 26>> if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false) {
			$encoding = 'gzip';
		} 

line 30>> if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== false) {
			$encoding = 'x-gzip';

line 66>> header($key . ': ' . $value);
responce.php 1.3.2

Code: Select all

line 26>> if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
			$encoding = 'gzip';
		} 

line 30>> if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip')) {
			$encoding = 'x-gzip';
line 66>>header($key. ': ' . $value);

Re: captcha in 1.3.3 disappeared

Posted: Sun Nov 08, 2009 10:13 am
by Daniel
if you use the old version then it won't compress the out put.

Re: captcha in 1.3.3 disappeared

Posted: Sun Nov 08, 2009 2:23 pm
by mspot
OK I give up :(
Something else might be the problem...
All I know is that version 1.3.2 doesn't seem to have this problem while 1.3.3 does ! (On the same server and domain!).
I hope you come up with an idea Daniel.
Either way OpenCart Rocks

Re: captcha in 1.3.3 disappeared

Posted: Mon Nov 09, 2009 11:10 pm
by JNeuhoff
There is indeed a bug.

Use this showImage function in file system/library/captcha.php:

Code: Select all

	function showImage() {
		$image = imagecreatetruecolor($this->height, $this->width);

		$width = imagesx($image); 
		$height = imagesy($image);
		
		$black = imagecolorallocate($image, 0, 0, 0); 
		$white = imagecolorallocate($image, 255, 255, 255); 
		$red = imagecolorallocatealpha($image, 255, 0, 0, 75); 
		$green = imagecolorallocatealpha($image, 0, 255, 0, 75); 
		$blue = imagecolorallocatealpha($image, 0, 0, 255, 75); 
		
		imagefilledrectangle($image, 0, 0, $width, $height, $white); 
		
		imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $red); 
		imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $green); 
		imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $blue); 

		imagefilledrectangle($image, 0, 0, $width, 0, $black); 
		imagefilledrectangle($image, $width - 1, 0, $width - 1, $height - 1, $black); 
		imagefilledrectangle($image, 0, 0, 0, $height - 1, $black); 
		imagefilledrectangle($image, 0, $height - 1, $width, $height - 1, $black); 
		
		imagestring($image, 10, intval(($width - (strlen($this->code) * 9)) / 2),  intval(($height - 15) / 2), $this->code, $black);
	
		header('Content-Type: image/png');
		
		imagepng($image);
		
		imagedestroy($image);
		exit;
	}


Re: captcha in 1.3.3 disappeared

Posted: Tue Nov 10, 2009 5:45 am
by mspot
God sent man.

Thanx

Re: captcha in 1.3.3 disappeared

Posted: Tue Nov 10, 2009 5:52 am
by cc6264
Thankyou - that fixed it!

Cheers
CraigG