Jump to content
Sign in to follow this  
Druide

NEW: Anti Robot Registration Validation

Recommended Posts

try in admin to change the TrueType Font Size ... to a higher value i am using 30

I found the solution For my problem thaks anyway ..

 

How did you find the solution? Im having the same problem. Please let us know.

Share this post


Link to post
Share on other sites
Hi all ...i just installed the contrib AntiRobotRegistrationValidation2.6.....and in it doesn't show any image ..... it's blank ..... i read the install file and it sayd that if i have any contrib installed it may not work ....

contrib installed in my website are :

Order Editor

Image Subdirectories

More Pics 6

Qtpro 4

otf_autothumb

 

this is how it look's (the "no image" image is from thumbs) untitledjr0.jpg

 

Sorry it was this solution I was after.

Share this post


Link to post
Share on other sites
Ok thanks for that. Can you try the following piece of code and let me know if it produces the text 'Simple Text' in a rectangle please.

 

<?php
header ("Content-type: image/png");
$im = @imagecreatetruecolor(120, 20)
    or die("Cannot Initialize new GD image stream");
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 5, 5, 5,  "Simple Text", $text_color);
imagepng($im);
imagedestroy($im);
?> 

 

Thanks, Tone.

 

Hi, I am definitely GOING CRAZY in getting this contribution to work.

Trouble is that I cannot get any image displayed (broken image or red X only).

I have antispambots contributions installed along with Antirobot and EVERYTHING in this forum I tried so far was unsuccessful: finally I came across your suggestion above and could get "Simple Text" displayed, however, I have no idea on how to proceed any further.

Can you assist?

 

Thanks a lot in advance

 

Mendoh

Share this post


Link to post
Share on other sites

Has anyone found a FULL solution to the "invalid code" problem. I've searched this thread for hours and have only found bits and pieces. The code verification code only works on my "create and account" page, but not on any others. (contact us, change password, or edit account info).

 

I'm a newbie and very frustrated! Thanks in advance!

Share this post


Link to post
Share on other sites

To all of you that are having the "invalid verification code" problem even when you KNOW the code is right. I seriously have looked through every posting in this forum 3 times and never figured it out. Just now I found the post below, but I didn't know what page this code was in....The code is in the specific pages that are having trouble (contact_us.php, account_edit.php, etc.) Just delete the line of code that PerlSOL suggests and it works!!

 

|| (strlen($antirobotreg) != ENTRY_VALIDATION_LENGTH) :angry:

 

after much time I found that if I removed the above it worked, from what I can work out it is pointless anyhow with the compare check.

TFFT!

 

I hope this helps others from banging one's head :blink:

Share this post


Link to post
Share on other sites

If anyone has problems getting truetype fonts to work..

 

You have to be sure to place the GD Environment Variable in the correct place... I was going nuts figuring out the problem as to why it wasnt working.. but in anycase.. just place the line

 

putenv('GDFONTPATH=' . realpath('.') . '/' . DIR_WS_IMAGES . 'fonts');

 

at the top of the page.. (the path is to my fonts folder which is located in my images folder)

 

.. also if anyone is interested in colourized text

 

here is the complete validation_png.php file that goes in the catalog folder.. you can simple change it out or if you have any mods done to it.. look for the random colour allocation..

 

<?php
/*
 $Id: validation_png.php,v 2.7 2008/04/10 18:44:27 insaini Exp $
- modified from the version 2.1 by alexstudio

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2006 osCommerce

 Released under the GNU General Public License
*/
define('ANTI_ROBOT_IMAGE_PHP_BITMAP_FONT', 5);
error_reporting(0);

require_once('includes/configure.php');
require_once(DIR_WS_INCLUDES . 'filenames.php');
require_once(DIR_WS_INCLUDES . 'database_tables.php');
require_once(DIR_WS_FUNCTIONS . 'database.php');

//	define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);

// establish database connection	
tep_db_connect() or die('Unable to connect to database server!');

// load configuration settings 
$configuration_query = tep_db_query('
SELECT configuration_key AS cfgKey, configuration_value AS cfgValue 
FROM ' . TABLE_CONFIGURATION);
while ($configuration = tep_db_fetch_array($configuration_query)) {
define($configuration['cfgKey'], $configuration['cfgValue']);
}

// Derived from the original contribution by AlexStudio
// Note to potential users of this code ...
//
// Remember this is released under the _GPL_ and is subject
// to that licence. Do not incorporate this within software 
// released or distributed in any way under a licence other
// than the GPL. We will be watching ...;)

// Do we have an id? No, then just exit
if(empty($_GET['rsid'])) {
 echo 'Empty rsid!!';
 exit;
}
$s_id = tep_db_output($_GET['rsid']);

// set image type
header('Content-Type: image/png');
header('Cache-control: no-cache, no-store');

// Try and grab reg_key for this id and session
$check_anti_robotreg_query = tep_db_query("
SELECT reg_key 
FROM anti_robotreg 
WHERE session_id = '".$s_id."'");
$new_query_for_reg_key = tep_db_fetch_array($check_anti_robotreg_query);
$code = $new_query_for_reg_key['reg_key'];

// calculate character pixel sizes
if (ANTI_ROBOT_IMAGE_USE_TTF=='true') {
 putenv('GDFONTPATH=' . realpath('.') . '/' . DIR_WS_IMAGES . 'fonts');

$total_code_width = 0;
$max_code_height = 0;

 for ($i=0; $i < strlen($code); $i++) {
$angle_char[] = rand(-15, 15);
$char_bbox = imagettfbbox(ANTI_ROBOT_IMAGE_FONT_SIZE, $angle_char[$i], ANTI_ROBOT_IMAGE_TTF, $code[$i]);
	$width_char[] = max($char_bbox[2], $char_bbox[4]) - min($char_bbox[0], $char_bbox[6]) + ANTI_ROBOT_IMAGE_WHITE_SPACE;
$total_code_width += $width_char[$i];
$max_code_height = max($max_code_height, max($char_bbox[1],$char_bbox[3]) -  max($char_bbox[5], $char_bbox[7]));
 }
} else {
$total_code_width = (imagefontwidth(ANTI_ROBOT_IMAGE_FONT_SIZE) + ANTI_ROBOT_IMAGE_WHITE_SPACE) * strlen($code);
$max_code_height = imagefontheight(ANTI_ROBOT_IMAGE_FONT_SIZE);
}

// image size
$height = (ANTI_ROBOT_IMAGE_HEIGHT) ? ANTI_ROBOT_IMAGE_HEIGHT : $max_code_height + ANTI_ROBOT_IMAGE_TOP_MARGIN;
$width = (ANTI_ROBOT_IMAGE_WIDTH) ? ANTI_ROBOT_IMAGE_WIDTH : $total_code_width;

// create image based on character size
$image = @imagecreatetruecolor($total_code_width, $max_code_height + ANTI_ROBOT_IMAGE_TOP_MARGIN);

// colourize image
$bgc = hexdec(ANTI_ROBOT_IMAGE_BACKGROUND_COLOR);
$tc = hexdec(ANTI_ROBOT_IMAGE_TEXT_COLOR);
imagefilledrectangle($image, 0, 0, $width, $height, $bgc);

// allocate colors
$bg_color = imagecolorallocate($image, ($bgc >> 16) & 0xFF, ($bgc >> 8) & 0xFF, $bgc & 0xFF);
$fg_color = imagecolorallocate($image, ($tc >> 16) & 0xFF, ($tc >> 8) & 0xFF, $tc & 0xFF);

// add characters to image
// - Added 2.7 random color chacters
$pos_x = rand(0,ANTI_ROBOT_IMAGE_WHITE_SPACE-1);
for ($i=0; $i < strlen($code); $i++) {
// random colours
$colours = array(rand(0,85),rand(86,171),rand(172,255));

$r_red = rand(0,2);
while ($r_green == $r_red) {
	$r_green = rand(0,2);		
}
while ($r_blue == $r_green || $r_blue == $r_red) {
	$r_blue = rand(0,2);		
}
// we made sure that the random colours will never be the same otherwise there is potential for the colours to 
// show up as the background colour..

$char_color = imagecolorallocate($image, $colours[$r_red], $colours[$r_green], $colours[$r_blue]);

 if (ANTI_ROBOT_IMAGE_USE_TTF=='true') {
  imagettftext($image, ANTI_ROBOT_IMAGE_FONT_SIZE, $angle_char[$i], $pos_x, $max_code_height + ANTI_ROBOT_IMAGE_TOP_MARGIN/2, $char_color, ANTI_ROBOT_IMAGE_TTF, $code[$i]);
 } else {
  imagechar($image, ANTI_ROBOT_IMAGE_PHP_BITMAP_FONT, $pos_x, ANTI_ROBOT_IMAGE_TOP_MARGIN/2+rand(-ANTI_ROBOT_IMAGE_TOP_MARGIN/2, ANTI_ROBOT_IMAGE_TOP_MARGIN/2), $code[$i], $char_color);
 }
$pos_x += (ANTI_ROBOT_IMAGE_USE_TTF=='true') ? $width_char[$i] : imagefontwidth(ANTI_ROBOT_IMAGE_FONT_SIZE) + ANTI_ROBOT_IMAGE_WHITE_SPACE;
}

// create resizes image of original
$resized_image = @imagecreatetruecolor($width, $height);
if ((ANTI_ROBOT_IMAGE_HEIGHT != 0) || (ANTI_ROBOT_IMAGE_WIDTH != 0)) {
imagecopyresized($resized_image, $image, 0, 0, 0, 0, (ANTI_ROBOT_IMAGE_WIDTH) ? ANTI_ROBOT_IMAGE_WIDTH : $width, (ANTI_ROBOT_IMAGE_HEIGHT) ? ANTI_ROBOT_IMAGE_HEIGHT : $height, $total_code_width, $max_code_height + ANTI_ROBOT_IMAGE_TOP_MARGIN);
} else {
$resized_image = $image;
}

// apply artifacts
if (ANTI_ROBOT_IMAGE_FILTER_GREYSCALE=='true')
image_greyscale($resized_image);
if (ANTI_ROBOT_IMAGE_FILTER_SCATTER=='true')
image_scatter($resized_image);
if (ANTI_ROBOT_IMAGE_FILTER_NOISE=='true')
image_noise($resized_image); 
if (ANTI_ROBOT_IMAGE_FILTER_INTERLACE=='true')
image_interlace($resized_image, $fg_color, $bg_color);

// output image
imagepng($resized_image);
imagedestroy($image);
imagedestroy($resized_image);
exit;

function image_noise (&$image) {
  $imagex = imagesx($image);
  $imagey = imagesy($image);

  for ($x = 0; $x < $imagex; ++$x) {
  for ($y = 0; $y < $imagey; ++$y) {
	 if (rand(0,1)) {
		$rgb = imagecolorat($image, $x, $y);
		$red = ($rgb >> 16) & 0xFF;
		$green = ($rgb >> 8) & 0xFF;
		$blue = $rgb & 0xFF;
		$modifier = rand(-128,128);
		$red += $modifier;
		$green += $modifier;
		$blue += $modifier;

		if ($red > 255) $red = 255;
		if ($green > 255) $green = 255;
		if ($blue > 255) $blue = 255;
		if ($red < 0) $red = 0;
		if ($green < 0) $green = 0;
		if ($blue < 0) $blue = 0;

		$newcol = imagecolorallocate($image, $red, $green, $blue);
		imagesetpixel($image, $x, $y, $newcol);
	 }
  }
  }
}

function image_scatter(&$image) {
  $imagex = imagesx($image);
  $imagey = imagesy($image);

  for ($x = 0; $x < $imagex; ++$x) {
  for ($y = 0; $y < $imagey; ++$y) {
	 $distx = rand(-1, 1);
	 $disty = rand(-1, 1);

	 if ($x + $distx >= $imagex) continue;
	 if ($x + $distx < 0) continue;
	 if ($y + $disty >= $imagey) continue;
	 if ($y + $disty < 0) continue;

	 $oldcol = imagecolorat($image, $x, $y);
	 $newcol = imagecolorat($image, $x + $distx, $y + $disty);
	 imagesetpixel($image, $x, $y, $newcol);
	 imagesetpixel($image, $x + $distx, $y + $disty, $oldcol);
  }
  }
}

  function image_interlace (&$image, $fg=0, $bg=255) {
  $imagex = imagesx($image);
  $imagey = imagesy($image);

  $fg_red = ($fg >> 16) & 0xFF;
  $fg_green = ($fg >> 8) & 0xFF;
  $fg_blue = $fg & 0xFF;
  $bg_red = ($bg >> 16) & 0xFF;
  $bg_green = ($bg >> 8) & 0xFF;
  $bg_blue = $bg & 0xFF;
  $red = ($fg_red+$bg_red)/2;
  $green = ($fg_green+$bg_green)/2;
  $blue = ($fg_blue+$bg_blue)/2;

  $band = imagecolorallocate($image, $red, $green, $blue);

  for ($y = 0; $y < $imagey; $y+=2) {
		for ($x = 0; $x < $imagex; ++$x) {
		   imagesetpixel($image, $x, $y, $band);
		}
  }
  }

function image_greyscale (&$image) {
  $imagex = imagesx($image);
  $imagey = imagesy($image);
  for ($x = 0; $x <$imagex; ++$x) {
  for ($y = 0; $y <$imagey; ++$y) {
	 $rgb = imagecolorat($image, $x, $y);
	 $red = ($rgb >> 16) & 0xFF;
	 $green = ($rgb >> 8) & 0xFF;
	 $blue = $rgb & 0xFF;
	 $grey = (int)(($red+$green+$blue)/3);
	 $newcol = imagecolorallocate($image, $grey, $grey, $grey);
	 imagesetpixel($image, $x, $y, $newcol);
  }
  }
}
?>

Share this post


Link to post
Share on other sites
I just found out that if you set the "images required" in admin config to false the anti-robot-reg. image won't show up. Try setting it to true and see if that makes a difference. It worked for me :)

With the (admin -> configuration -> images ->) images required = false , unmodified html_output.php (function tep_image) will not show the validation picture.

I did need images required = false.

 

Solution for my problem I found in post #286:

Change

$validation_images = tep_image('validation_png.php?rsid=' . $new_guery_anti_robotreg['session_id']);

to

$validation_images = '<img src="validation_png.php?rsid=' . $new_guery_anti_robotreg['session_id'] . '">';

 

Regards

Shaun

I did change this in create_account.php, account_edit.php, account_password.php, contact_us.php and password_forgotten.php

IT WORKS!!!

So, many thanks to Shaun

Share this post


Link to post
Share on other sites

VERY IMPORTANT: PHP 5 UPDATE

IF YOU HAVE A PROBLEM: Empty rsid!! with link having rsid inside .

 

in file validation_png.php

 

CHANGE IN LINE 39 and 45

 

$HTTP_GET_VARS

 

TO

 

$_GET

Share this post


Link to post
Share on other sites
If anyone has problems getting truetype fonts to work..

 

You have to be sure to place the GD Environment Variable in the correct place... I was going nuts figuring out the problem as to why it wasnt working.. but in anycase.. just place the line

 

putenv('GDFONTPATH=' . realpath('.') . '/' . DIR_WS_IMAGES . 'fonts');

 

at the top of the page.. (the path is to my fonts folder which is located in my images folder)

 

.. also if anyone is interested in colourized text

 

here is the complete validation_png.php file that goes in the catalog folder.. you can simple change it out or if you have any mods done to it.. look for the random colour allocation..

 

<?php
/*
 $Id: validation_png.php,v 2.7 2008/04/10 18:44:27 insaini Exp $
- modified from the version 2.1 by alexstudio

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2006 osCommerce

 Released under the GNU General Public License
*/
define('ANTI_ROBOT_IMAGE_PHP_BITMAP_FONT', 5);
error_reporting(0);

require_once('includes/configure.php');
require_once(DIR_WS_INCLUDES . 'filenames.php');
require_once(DIR_WS_INCLUDES . 'database_tables.php');
require_once(DIR_WS_FUNCTIONS . 'database.php');

//	define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);

// establish database connection	
tep_db_connect() or die('Unable to connect to database server!');

// load configuration settings 
$configuration_query = tep_db_query('
SELECT configuration_key AS cfgKey, configuration_value AS cfgValue 
FROM ' . TABLE_CONFIGURATION);
while ($configuration = tep_db_fetch_array($configuration_query)) {
define($configuration['cfgKey'], $configuration['cfgValue']);
}

// Derived from the original contribution by AlexStudio
// Note to potential users of this code ...
//
// Remember this is released under the _GPL_ and is subject
// to that licence. Do not incorporate this within software 
// released or distributed in any way under a licence other
// than the GPL. We will be watching ...;)

// Do we have an id? No, then just exit
if(empty($_GET['rsid'])) {
 echo 'Empty rsid!!';
 exit;
}
$s_id = tep_db_output($_GET['rsid']);

// set image type
header('Content-Type: image/png');
header('Cache-control: no-cache, no-store');

// Try and grab reg_key for this id and session
$check_anti_robotreg_query = tep_db_query("
SELECT reg_key 
FROM anti_robotreg 
WHERE session_id = '".$s_id."'");
$new_query_for_reg_key = tep_db_fetch_array($check_anti_robotreg_query);
$code = $new_query_for_reg_key['reg_key'];

// calculate character pixel sizes
if (ANTI_ROBOT_IMAGE_USE_TTF=='true') {
 putenv('GDFONTPATH=' . realpath('.') . '/' . DIR_WS_IMAGES . 'fonts');

$total_code_width = 0;
$max_code_height = 0;

 for ($i=0; $i < strlen($code); $i++) {
$angle_char[] = rand(-15, 15);
$char_bbox = imagettfbbox(ANTI_ROBOT_IMAGE_FONT_SIZE, $angle_char[$i], ANTI_ROBOT_IMAGE_TTF, $code[$i]);
	$width_char[] = max($char_bbox[2], $char_bbox[4]) - min($char_bbox[0], $char_bbox[6]) + ANTI_ROBOT_IMAGE_WHITE_SPACE;
$total_code_width += $width_char[$i];
$max_code_height = max($max_code_height, max($char_bbox[1],$char_bbox[3]) -  max($char_bbox[5], $char_bbox[7]));
 }
} else {
$total_code_width = (imagefontwidth(ANTI_ROBOT_IMAGE_FONT_SIZE) + ANTI_ROBOT_IMAGE_WHITE_SPACE) * strlen($code);
$max_code_height = imagefontheight(ANTI_ROBOT_IMAGE_FONT_SIZE);
}

// image size
$height = (ANTI_ROBOT_IMAGE_HEIGHT) ? ANTI_ROBOT_IMAGE_HEIGHT : $max_code_height + ANTI_ROBOT_IMAGE_TOP_MARGIN;
$width = (ANTI_ROBOT_IMAGE_WIDTH) ? ANTI_ROBOT_IMAGE_WIDTH : $total_code_width;

// create image based on character size
$image = @imagecreatetruecolor($total_code_width, $max_code_height + ANTI_ROBOT_IMAGE_TOP_MARGIN);

// colourize image
$bgc = hexdec(ANTI_ROBOT_IMAGE_BACKGROUND_COLOR);
$tc = hexdec(ANTI_ROBOT_IMAGE_TEXT_COLOR);
imagefilledrectangle($image, 0, 0, $width, $height, $bgc);

// allocate colors
$bg_color = imagecolorallocate($image, ($bgc >> 16) & 0xFF, ($bgc >> 8) & 0xFF, $bgc & 0xFF);
$fg_color = imagecolorallocate($image, ($tc >> 16) & 0xFF, ($tc >> 8) & 0xFF, $tc & 0xFF);

// add characters to image
// - Added 2.7 random color chacters
$pos_x = rand(0,ANTI_ROBOT_IMAGE_WHITE_SPACE-1);
for ($i=0; $i < strlen($code); $i++) {
// random colours
$colours = array(rand(0,85),rand(86,171),rand(172,255));

$r_red = rand(0,2);
while ($r_green == $r_red) {
	$r_green = rand(0,2);		
}
while ($r_blue == $r_green || $r_blue == $r_red) {
	$r_blue = rand(0,2);		
}
// we made sure that the random colours will never be the same otherwise there is potential for the colours to 
// show up as the background colour..

$char_color = imagecolorallocate($image, $colours[$r_red], $colours[$r_green], $colours[$r_blue]);

 if (ANTI_ROBOT_IMAGE_USE_TTF=='true') {
  imagettftext($image, ANTI_ROBOT_IMAGE_FONT_SIZE, $angle_char[$i], $pos_x, $max_code_height + ANTI_ROBOT_IMAGE_TOP_MARGIN/2, $char_color, ANTI_ROBOT_IMAGE_TTF, $code[$i]);
 } else {
  imagechar($image, ANTI_ROBOT_IMAGE_PHP_BITMAP_FONT, $pos_x, ANTI_ROBOT_IMAGE_TOP_MARGIN/2+rand(-ANTI_ROBOT_IMAGE_TOP_MARGIN/2, ANTI_ROBOT_IMAGE_TOP_MARGIN/2), $code[$i], $char_color);
 }
$pos_x += (ANTI_ROBOT_IMAGE_USE_TTF=='true') ? $width_char[$i] : imagefontwidth(ANTI_ROBOT_IMAGE_FONT_SIZE) + ANTI_ROBOT_IMAGE_WHITE_SPACE;
}

// create resizes image of original
$resized_image = @imagecreatetruecolor($width, $height);
if ((ANTI_ROBOT_IMAGE_HEIGHT != 0) || (ANTI_ROBOT_IMAGE_WIDTH != 0)) {
imagecopyresized($resized_image, $image, 0, 0, 0, 0, (ANTI_ROBOT_IMAGE_WIDTH) ? ANTI_ROBOT_IMAGE_WIDTH : $width, (ANTI_ROBOT_IMAGE_HEIGHT) ? ANTI_ROBOT_IMAGE_HEIGHT : $height, $total_code_width, $max_code_height + ANTI_ROBOT_IMAGE_TOP_MARGIN);
} else {
$resized_image = $image;
}

// apply artifacts
if (ANTI_ROBOT_IMAGE_FILTER_GREYSCALE=='true')
image_greyscale($resized_image);
if (ANTI_ROBOT_IMAGE_FILTER_SCATTER=='true')
image_scatter($resized_image);
if (ANTI_ROBOT_IMAGE_FILTER_NOISE=='true')
image_noise($resized_image); 
if (ANTI_ROBOT_IMAGE_FILTER_INTERLACE=='true')
image_interlace($resized_image, $fg_color, $bg_color);

// output image
imagepng($resized_image);
imagedestroy($image);
imagedestroy($resized_image);
exit;

function image_noise (&$image) {
  $imagex = imagesx($image);
  $imagey = imagesy($image);

  for ($x = 0; $x < $imagex; ++$x) {
  for ($y = 0; $y < $imagey; ++$y) {
	 if (rand(0,1)) {
		$rgb = imagecolorat($image, $x, $y);
		$red = ($rgb >> 16) & 0xFF;
		$green = ($rgb >> 8) & 0xFF;
		$blue = $rgb & 0xFF;
		$modifier = rand(-128,128);
		$red += $modifier;
		$green += $modifier;
		$blue += $modifier;

		if ($red > 255) $red = 255;
		if ($green > 255) $green = 255;
		if ($blue > 255) $blue = 255;
		if ($red < 0) $red = 0;
		if ($green < 0) $green = 0;
		if ($blue < 0) $blue = 0;

		$newcol = imagecolorallocate($image, $red, $green, $blue);
		imagesetpixel($image, $x, $y, $newcol);
	 }
  }
  }
}

function image_scatter(&$image) {
  $imagex = imagesx($image);
  $imagey = imagesy($image);

  for ($x = 0; $x < $imagex; ++$x) {
  for ($y = 0; $y < $imagey; ++$y) {
	 $distx = rand(-1, 1);
	 $disty = rand(-1, 1);

	 if ($x + $distx >= $imagex) continue;
	 if ($x + $distx < 0) continue;
	 if ($y + $disty >= $imagey) continue;
	 if ($y + $disty < 0) continue;

	 $oldcol = imagecolorat($image, $x, $y);
	 $newcol = imagecolorat($image, $x + $distx, $y + $disty);
	 imagesetpixel($image, $x, $y, $newcol);
	 imagesetpixel($image, $x + $distx, $y + $disty, $oldcol);
  }
  }
}

  function image_interlace (&$image, $fg=0, $bg=255) {
  $imagex = imagesx($image);
  $imagey = imagesy($image);

  $fg_red = ($fg >> 16) & 0xFF;
  $fg_green = ($fg >> 8) & 0xFF;
  $fg_blue = $fg & 0xFF;
  $bg_red = ($bg >> 16) & 0xFF;
  $bg_green = ($bg >> 8) & 0xFF;
  $bg_blue = $bg & 0xFF;
  $red = ($fg_red+$bg_red)/2;
  $green = ($fg_green+$bg_green)/2;
  $blue = ($fg_blue+$bg_blue)/2;

  $band = imagecolorallocate($image, $red, $green, $blue);

  for ($y = 0; $y < $imagey; $y+=2) {
		for ($x = 0; $x < $imagex; ++$x) {
		   imagesetpixel($image, $x, $y, $band);
		}
  }
  }

function image_greyscale (&$image) {
  $imagex = imagesx($image);
  $imagey = imagesy($image);
  for ($x = 0; $x <$imagex; ++$x) {
  for ($y = 0; $y <$imagey; ++$y) {
	 $rgb = imagecolorat($image, $x, $y);
	 $red = ($rgb >> 16) & 0xFF;
	 $green = ($rgb >> 8) & 0xFF;
	 $blue = $rgb & 0xFF;
	 $grey = (int)(($red+$green+$blue)/3);
	 $newcol = imagecolorallocate($image, $grey, $grey, $grey);
	 imagesetpixel($image, $x, $y, $newcol);
  }
  }
}
?>

 

 

Insaini, I would really like to say THANK YOU for your posting.

I gave up installing this contrib as I really could not get it working...after quite a while I decided to come back to see if there were any replies to my help request and I found your validation_png.php code above.

I replaced the validation_png.php file within the original contribution with yours and right now it all works 100%!!!

Once again THANK YOU!

 

It is know my turn to give back some useful information in return...

 

For those interested: it is possible to use ANTIROBOT REG + ANTISPAMBOT SUITE (Antispambot, Antispambot Contact, Antispambot Tell a Friend and Reviews) to TOTALLY secure your website against spambots.

Installation of these two contributions is feasible and I would like to inform you all how I succeeded to do this: just install ANTISPAMBOT suite to secure contact us, tell a Friend and reviews boxes, then install ANTIROBOT REG to secure account registration and submit link boxes.

When installing ANTIROBOT REG, to avoid any conficts, please make sure you completely skip the installation for the contact us box (on the other hand, you may also decide not to install ANTISPAMBOT for contact us and use ANTIROBOT REG to protect contact us page...it is definitely up to you).

 

Hope the above helps!

 

Cheers,

 

Mendoh

Share this post


Link to post
Share on other sites

Great contribution!

 

Is there a way of adding this to the Tell-a-friend file (tell_a_friend.php), I tried, but I must tell you - the outcome was a mess.

 

Also, I noticed when adding the contrib in the newest release of Osc (as of today), a fresh install - that this contrib is partially installed in some files? Was this added to default osc now in some limited way?

 

Thanks for the help!

 

Carry

Share this post


Link to post
Share on other sites

Hello

Thankyou for thiis great contrib, and when i downloaded and see the screenshot, i believe it would be a great plugin and i tried to implement it to creat account, my contact us already using another plugin.

but i found the validation code cant be generateed, pls see the website

http://www.edge.com.hk/store/catalog/create_account.php

 

i checked with my webhosting, the GD library is enable, as i got other captcha plug work for contact us, but just donno why cant work for your plugin,can u suggest any solution or any possible hting i missed?

 

thanks a lot!

Edited by edgestore

Share this post


Link to post
Share on other sites

hello me again

i change the code at create account php

$validation_images = '<img src="validation_png.php?rsid=' . $new_guery_anti_robotreg['session_id'] . '">';

 

and i found i see something generated but it is too small and seem like it generated half , and cant really see the code, can anyone help?

 

i am using 2.6 validation_png.php

 

thanks

 

 

Hello

Thankyou for thiis great contrib, and when i downloaded and see the screenshot, i believe it would be a great plugin and i tried to implement it to creat account, my contact us already using another plugin.

but i found the validation code cant be generateed, pls see the website

http://www.edge.com.hk/store/catalog/create_account.php

 

i checked with my webhosting, the GD library is enable, as i got other captcha plug work for contact us, but just donno why cant work for your plugin,can u suggest any solution or any possible hting i missed?

 

thanks a lot!

Share this post


Link to post
Share on other sites

hello guyz,

Thanks for the great contri... I have installed v2.5 when I use it , i get this error ""Fout Please edit your message and remove html hyperlinks"

 

But I'm not using any html, just text..

 

Does anyone know what this could be ?

 

You can check what I mean at www.bibakado.nl

 

thanks durana

Share this post


Link to post
Share on other sites

Hello to Everyone,

 

I have checked this thread and have not found the same problem, which is also strange to me.

 

I have installed the v 2.5 contrib, and found the followings:

create acount: works

edit account, contact us, change password: code vaidation does not work even with the proper code entered.

 

I am not a php/mysql developer and I used the "install.html" file (created by alexstudio) as a manual.

I have selected "Install B - Live store with othr contribution installed"

 

It seems there is a difference between creat_ account.php and the other files:

 

// BOF Anti Robot Registration v2.5

if (ACCOUNT_VALIDATION == 'true' && ACCOUNT_CREATE_VALIDATION == 'true') {

$antirobotreg = tep_db_prepare_input($HTTP_POST_VARS['antirobotreg']);

}

// EOF Anti Robot Registration v2.5

 

This code above should be inserted only in case of create_account.php by the manual.

I have added this code to the other files and now they seems working. Is this a correct solution?

 

Thank you for any comments

lehjoz

Share this post


Link to post
Share on other sites

Hello guyz,

 

I have the same problem as above:

I have installed v2.5 and I can see the image, but when I enter de code. I still get the error "Verificatie Fout

ERROR_VALIDATION_2 ""

 

thanks durana

Edited by durana

Share this post


Link to post
Share on other sites

I installed 2.6 version and uploaded corrected password_validation and password_forgotten files also.

I followed instructions in Install file and made SQL changes also.

Some how I cannot see any changes, even on admin panel I cannot see Anti robot....

What can be the problem?

 

Thanks


Computers777dotcom

Share this post


Link to post
Share on other sites

OK, I resolved the problem.

I forgot to use 2.5sql, i did only 2.6. Now it works I guess, at least it shows the image.

The problem is that I can't recognise anything in there. I tried to change the colors but they stay unchanged somehow.

What I should do?

 

Thanks in advance for any help.

 

validation_code.jpg


Computers777dotcom

Share this post


Link to post
Share on other sites

Addition to the post above:

I checked anti-robotics table and it does have session ID stored and also the 5 letters key.

I checked again the validation picture generated and cannot see any letters (I thought they were there, but I couldn't see them), because there are no letters.

 

Thanks for any help.

 

Mike


Computers777dotcom

Share this post


Link to post
Share on other sites

Solved.

By default it set to use TT fonts. After I found tip in this thread I create a folder "fonts" in folder "images", copied tt font into it and then changed default AREAL settings to exact name of file I copied include extension.

I think that would be helpful if sample folder and font were included in full contribution or were mentioned at least.

 

Thanks for great contribution!


Computers777dotcom

Share this post


Link to post
Share on other sites

Hello Friend,

 

Thanks for this contribution. It is a great one. I installed the Anti Robot Registration Validation 2.6. Everything works fine. The image and the box are showing on create_account.php, password_forgotten.php and contact_us.php.

 

I've recently changed all my page URLs for SEO purposes. The site is working fine but Anti Robot Registration Validation stops showing.

 

What I did is: I renamed catalog/create_account.php, catalog/password_forgotten.php and catalog/contact_us.php to something else, renamed their corresponding files in the language directory and renamed them in the includes/filename.php file.

 

Although Anti Robot Registration Validation doesn't show up anymore, when somebody tries to register on the site and submit the registration form,he/she gets an error message: "invalid or incorrect validation code etc".

 

When I put back the original file oscommerce file name, the Anti Robot Registration Validation starts showing/working back.

 

I can't figure out what I should change within the above files to get Anti Robot Registration Validation to display.

 

Please, help!

 

Thanks.

 

JBS7

Share this post


Link to post
Share on other sites

Hello to everyone!

 

Does anyone know the code for integrating Antirobot Validation into the ticket_create.php of OSC Ticket V1.1a ? also into any file that needs it.

 

I have the Antirobot Validation working good (great contribution) in contact_us and all other suitable files, now I installed OSC Ticket and cannot find out the code to add to ticket_create for making it work there as well. Anyone can help please?

 

Thanks and all the best

Share this post


Link to post
Share on other sites

Hello everybody,

 

I have installed this Anti Robot Registration Validation version 2.5 in a local installation to test it before adding it to the online website. It works excellent for creating new accounts. But anywhere else(edit info, change password, etc), it always say wrong code. No matter if write it upper case or lower case.

 

What i did to install it was to backup and replace the files that comes in the download and run the script in the database.

 

How can i fix that. This is the first contribution i add to my oscommerce so it is mods free.

 

Help please.

Share this post


Link to post
Share on other sites
Hello everybody,

 

I have installed this Anti Robot Registration Validation version 2.5 in a local installation to test it before adding it to the online website. It works excellent for creating new accounts. But anywhere else(edit info, change password, etc), it always say wrong code. No matter if write it upper case or lower case.

 

What i did to install it was to backup and replace the files that comes in the download and run the script in the database.

 

How can i fix that. This is the first contribution i add to my oscommerce so it is mods free.

 

Help please.

 

I am also having this problem. Only works in create new account and nothing else. I was reading above a few posts of this:

 

 

 

// BOF Anti Robot Registration v2.5

if (ACCOUNT_VALIDATION == 'true' && ACCOUNT_CREATE_VALIDATION == 'true') {

$antirobotreg = tep_db_prepare_input($HTTP_POST_VARS['antirobotreg']);

}

// EOF Anti Robot Registration v2.5

 

This code above should be inserted only in case of create_account.php by the manual.

I have added this code to the other files and now they seems working. Is this a correct solution?

 

Thank you for any comments

lehjoz

 

Where are you supposed to put these lines in each of the files please?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×