Jump to content
Sign in to follow this  
Druide

NEW: Anti Robot Registration Validation

Recommended Posts

Hi,

 

i have a question,

 

if i change my password i must entry a code this is ok, but if i change the passwort immediately again i see the same code like before and the code is wrong...

 

 

what must i change to see a new code if i klick on "new password" ?

 

 

thank you

Share this post


Link to post
Share on other sites

Tracy and Paul,

 

Your problems looked identical. It could be the browser's cache which showed the last png image rather than the new one. I will dig into this and see what I can do.


Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Share this post


Link to post
Share on other sites
Tracy and Paul,

 

Your problems looked identical. It could be the browser's cache which showed the last png image rather than the new one. I will dig into this and see what I can do.

 

Hi,

 

my english is not good, sorry, but you have right, it is the same problem, i hope you have a Solution for the problem...

 

i see the Problem not with Internet Exlporer but with Firefox...

 

in Firefox i must press F5 to see the new code <_<

 

thanks :D

Edited by paulchen2005

Share this post


Link to post
Share on other sites
Tracy and Paul,

 

Your problems looked identical. It could be the browser's cache which showed the last png image rather than the new one. I will dig into this and see what I can do.

 

It seems to have a time limit associated with it (not sure if browser cache does or not). But, if I wait several minutes and then load a page with the validation form it gives me new images. Don't know if it helps or not, but figured I'd let you know in case it does :blush:

 

I am testing mainly in FireFox right now - but I will try it in IE7 and NN8.1 and report back ;)


~Tracy
 

Share this post


Link to post
Share on other sites

I am wondering, how can I use the Anti Robot Registration Validation on other pages?

 

I am using the Links Manager for osC v1.00 and there's a links_submit.php page that is open to spammers. I've temporarily disabled that page, but that's not allowing folks to submit their link to me.

 

Dare I ask this? Where do I stick the code? :-" :snerk:

 

I've also noticed that the $email used in the Anti Robot code is $links_contact_email in this page. Will that be a problem? If so, how is that handled?

 

  require('includes/application_top.php');

// needs to be included earlier to set the success message in the messageStack
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LINKS_SUBMIT);
 require(DIR_WS_FUNCTIONS . 'links.php');

 $process = false;
 if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
$process = true;

$links_title = tep_db_prepare_input($HTTP_POST_VARS['links_title']);
$links_url = tep_db_prepare_input($HTTP_POST_VARS['links_url']);  
$links_category = tep_db_prepare_input($HTTP_POST_VARS['links_category']);
$links_category_suggest = tep_db_prepare_input($HTTP_POST_VARS['links_cat_suggest']);
$links_description = tep_db_prepare_input($HTTP_POST_VARS['links_description']);
$links_image = tep_db_prepare_input($HTTP_POST_VARS['links_image']);
$links_contact_name = tep_db_prepare_input($HTTP_POST_VARS['links_contact_name']);
$links_contact_email = tep_db_prepare_input($HTTP_POST_VARS['links_contact_email']);
if (LINKS_RECIPROCAL_REQUIRED == 'True') $links_reciprocal_url = tep_db_prepare_input($HTTP_POST_VARS['links_reciprocal_url']);

$error = false;

if (strlen($links_title) < ENTRY_LINKS_TITLE_MIN_LENGTH) {
  $error = true;

  $messageStack->add('submit_link', ENTRY_LINKS_TITLE_ERROR);
}

if (strlen($links_url) < ENTRY_LINKS_URL_MIN_LENGTH) {
  $error = true;

  $messageStack->add('submit_link', ENTRY_LINKS_URL_ERROR);
}

if (strlen($links_description) < ENTRY_LINKS_DESCRIPTION_MIN_LENGTH) {
  $error = true;

  $messageStack->add('submit_link', ENTRY_LINKS_DESCRIPTION_ERROR);
}

if (strlen($links_contact_name) < ENTRY_LINKS_CONTACT_NAME_MIN_LENGTH) {
  $error = true;

  $messageStack->add('submit_link', ENTRY_LINKS_CONTACT_NAME_ERROR);
}

if (strlen($links_contact_email) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
  $error = true;

  $messageStack->add('submit_link', ENTRY_EMAIL_ADDRESS_ERROR);
} elseif (tep_validate_email($links_contact_email) == false) {
  $error = true;

  $messageStack->add('submit_link', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}

if (LINKS_RECIPROCAL_REQUIRED == 'True') {
 if (strlen($links_reciprocal_url) < ENTRY_LINKS_URL_MIN_LENGTH) {
   $error = true;
   $messageStack->add('submit_link', ENTRY_LINKS_RECIPROCAL_URL_ERROR);
 }
 else if (CheckURL($links_reciprocal_url) == 0)
 {
   $error = true;
   $messageStack->add('submit_link', sprintf(ENTRY_LINKS_RECIPROCAL_URL_MISSING_ERROR, $links_reciprocal_url));
 }
}
else $links_reciprocal_url = '';

// CHECK FOR DUPLICAE ENTRIES
if (LINKS_CHECK_DUPLICATE == 'True') 
{
  $duplink_query = tep_db_query("select l.links_id, l.links_url, l.links_reciprocal_url,  ld.links_id, ld.links_title from " . TABLE_LINKS . " l, " . TABLE_LINKS_DESCRIPTION . " ld where l.links_id = ld.links_id AND (ld.links_title = '" . $links_title . "' OR l.links_url = '" . $links_url . "' OR l.links_reciprocal_url = '" . $links_reciprocal_url . "' ) AND language_id = '" . (int)$languages_id . "'");
  if (tep_db_num_rows($duplink_query) > 0)
  {
	 $error = true;
	 $messageStack->add('submit_link', ENTRY_LINKS_DUPLICATE_ERROR);	
  }
}

if ($error == false) {
  if($links_image == 'http://') {
	$links_image = '';
  }

  // default values
  $links_date_added = 'now()';
  $links_status = '1'; // Pending approval
  $links_rating = '0'; 

  $sql_data_array = array('links_url' => $links_url,
						  'links_image_url' => $links_image,
						  'links_contact_name' => $links_contact_name,
						  'links_contact_email' => $links_contact_email,
						  'links_reciprocal_url' => $links_reciprocal_url,
						  'links_category_suggest' => $links_category_suggest,
						  'links_date_added' => $links_date_added, 
						  'links_status' => $links_status, 
						  'links_rating' => $links_rating);

  tep_db_perform(TABLE_LINKS, $sql_data_array);

  $links_id = tep_db_insert_id();

  $categories_query = tep_db_query("select link_categories_id from " . TABLE_LINK_CATEGORIES_DESCRIPTION . " where link_categories_name = '" . $links_category . "' and language_id = '" . (int)$languages_id . "'");

  $categories = tep_db_fetch_array($categories_query);
  $link_categories_id = $categories['link_categories_id'];

  tep_db_query("insert into " . TABLE_LINKS_TO_LINK_CATEGORIES . " (links_id, link_categories_id) values ('" . (int)$links_id . "', '" . (int)$link_categories_id . "')");

  $language_id = $languages_id;

  $sql_data_array = array('links_id' => $links_id, 
						  'language_id' => $language_id, 
						  'links_title' => $links_title,
						  'links_description' => $links_description);

  tep_db_perform(TABLE_LINKS_DESCRIPTION, $sql_data_array);

  // build the message content
  $name = $links_contact_name;

  //send message to link partner
  $email_text = sprintf(EMAIL_GREET_NONE, $links_contact_name);
  $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
  tep_mail($name, $links_contact_email, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

  //send message to store owner 
  $RECIPROCAL = (LINKS_RECIPROCAL_REQUIRED == 'True') ? $links_reciprocal_url : 'Not Required';
  $newlink_subject = sprintf(EMAIL_OWNER_TEXT, $name, $links_url, $RECIPROCAL); 
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_OWNER_SUBJECT, $newlink_subject, $name, $links_contact_email);

  tep_redirect(tep_href_link(FILENAME_LINKS_SUBMIT_SUCCESS, '', 'SSL'));
}
 }

 // links breadcrumb
 $breadcrumb->add(NAvb script:popupWindow(\'' . tep_href_link(FILENAME_POPUP_LINKS_HELP) . '\')">' . TEXT_LINKS_HELP_LINK . '</a>'; ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main"><b><?php echo CATEGORY_CONTACT; ?></b></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table width="60%" border="0" cellspacing="2" cellpadding="2">
		  <tr>
			<td class="smallText" width="25%"><?php echo ENTRY_LINKS_CONTACT_NAME; ?></td>
			<td class="main"><?php echo tep_draw_input_field('links_contact_name') . ' ' . (tep_not_null(ENTRY_LINKS_CONTACT_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LINKS_CONTACT_NAME_TEXT . '</span>': ''); ?></td>
		  </tr>
		  <tr>
			<td class="smallText"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
			<td class="main"><?php echo tep_draw_input_field('links_contact_email') . ' ' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>

<?php if (LINKS_RECIPROCAL_REQUIRED == 'True') { ?>		
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="smallText"><b><?php echo CATEGORY_RECIPROCAL; ?></b></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table width="60%" border="0" cellspacing="2" cellpadding="2">
		  <tr>
			<td class="main" width="25%"><?php echo ENTRY_LINKS_RECIPROCAL_URL; ?></td>
			<td class="main"><?php echo tep_draw_input_field('links_reciprocal_url', 'http://') . ' ' . (tep_not_null(ENTRY_LINKS_RECIPROCAL_URL_TEXT) ? '<span class="inputRequirement">' . ENTRY_LINKS_RECIPROCAL_URL_TEXT . '</span>': ''); ?><?php echo '<a href="java script:popupWindow(\'' . tep_href_link(FILENAME_POPUP_LINKS_HELP) . '\')">' . TEXT_LINKS_HELP_LINK . '</a>'; ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php } ?> 


  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
</table></form>

Share this post


Link to post
Share on other sites
It seems to have a time limit associated with it (not sure if browser cache does or not). But, if I wait several minutes and then load a page with the validation form it gives me new images. Don't know if it helps or not, but figured I'd let you know in case it does :blush:

 

I am testing mainly in FireFox right now - but I will try it in IE7 and NN8.1 and report back ;)

 

Hi Tracy

 

It will be a client or server caching issue. Try the following:

 

Example in create_account.php change

 

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

 

to

 

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

 

This forces a change to the url on each refresh by appending a parameter based on the current time.

 

Good luck!

Share this post


Link to post
Share on other sites
I am wondering, how can I use the Anti Robot Registration Validation on other pages?

 

I am using the Links Manager for osC v1.00 and there's a links_submit.php page that is open to spammers. I've temporarily disabled that page, but that's not allowing folks to submit their link to me.

 

Dare I ask this? Where do I stick the code? :-" :snerk:

 

I've also noticed that the $email used in the Anti Robot code is $links_contact_email in this page. Will that be a problem? If so, how is that handled?

 

Okay - try this:

 

Find:

 

  require('includes/application_top.php');

 

Paste after it:

 

// BOF Anti Robot Validation v2.4
 if (ACCOUNT_VALIDATION == 'true' && ACCOUNT_CREATE_VALIDATION == 'true') {
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_VALIDATION);
include_once('includes/functions/' . FILENAME_ACCOUNT_VALIDATION);
 }
// EOF Anti Robot Registration v2.4

 

Find:

 

	$error = false;

 

Paste above it:

 

// BOF Anti Robot Registration v2.4
if (ACCOUNT_VALIDATION == 'true' && ACCOUNT_CREATE_VALIDATION == 'true') {
$antirobotreg = tep_db_prepare_input($HTTP_POST_VARS['antirobotreg']);
}
// EOF Anti Robot Registration v2.4

 

Find:

 

		 $error = true;
	 $messageStack->add('submit_link', ENTRY_LINKS_DUPLICATE_ERROR);	
  }
}

 

Paste after it:

 

// BOF Anti Robotic Registration v2.4
if (ACCOUNT_VALIDATION == 'true' && ACCOUNT_CREATE_VALIDATION == 'true') {
  $sql = "SELECT * FROM " . TABLE_ANTI_ROBOT_REGISTRATION . " WHERE session_id = '" . tep_session_id() . "' LIMIT 1";
  if( !$result = tep_db_query($sql) ) {
	$error = true;
	$entry_antirobotreg_error = true;
	$text_antirobotreg_error = ERROR_VALIDATION_1;
  } else {
	$entry_antirobotreg_error = false;
	$anti_robot_row = tep_db_fetch_array($result);
	if (( strtoupper($HTTP_POST_VARS['antirobotreg']) != $anti_robot_row['reg_key'] ) || ($anti_robot_row['reg_key'] == '') || (strlen($antirobotreg) != ENTRY_VALIDATION_LENGTH)) {
	  $error = true;
	  $entry_antirobotreg_error = true;
	  $text_antirobotreg_error = ERROR_VALIDATION_2;
	} else {
	  $sql = "DELETE FROM " . TABLE_ANTI_ROBOT_REGISTRATION . " WHERE session_id = '" . tep_session_id() . "'";
	  if( !$result = tep_db_query($sql) ) {
		$error = true;
		$entry_antirobotreg_error = true;
		$text_antirobotreg_error = ERROR_VALIDATION_3;
	  } else {
		$sql = "OPTIMIZE TABLE " . TABLE_ANTI_ROBOT_REGISTRATION . "";
		if( !$result = tep_db_query($sql) ) {
		  $error = true;
		  $entry_antirobotreg_error = true;
		  $text_antirobotreg_error = ERROR_VALIDATION_4;
		} else {
		  $entry_antirobotreg_error = false;
		}
	  }
	}
  }
  if ($entry_antirobotreg_error == true) $messageStack->add('submit_link', $text_antirobotreg_error);
}
// EOF Anti Robotic Registration v2.4

 

 

Finally, find:

 

	  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
</table></form></td>
<!-- body_text_eof //-->

 

And paste before it:

 

<!-- // BOF Anti Robot Registration v2.4-->
<?php
if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'links_submit') &&  ACCOUNT_CREATE_VALIDATION == 'true') {
?>
  <tr>
	<td class="main"><b><?php echo CATEGORY_ANTIROBOTREG; ?></b></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" cellspacing="2" cellpadding="2">
		  <tr>
<?php
  if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'links_submit') &&  ACCOUNT_CREATE_VALIDATION == 'true') {
	if ($is_read_only == false || (strstr($PHP_SELF,'links_submit')) ) {
	  $sql = "DELETE FROM " . TABLE_ANTI_ROBOT_REGISTRATION . " WHERE timestamp < '" . (time() - 3600) . "' OR session_id = '" . tep_session_id() . "'";
	  if( !$result = tep_db_query($sql) ) { die('Could not delete validation key'); }
		$reg_key = gen_reg_key();
		$sql = "INSERT INTO ". TABLE_ANTI_ROBOT_REGISTRATION . " VALUES ('" . tep_session_id() . "', '" . $reg_key . "', '" . time() . "')";
		if( !$result = tep_db_query($sql) ) { die('Could not check registration information'); }
?>
			<tr>
			  <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea">
				<tr>
				  <td class="main"><table border="0" cellspacing="0" cellpadding="2">
					<tr>
					  <td class="main" width="100%" NOWRAP><span class="main"> <?php echo ENTRY_ANTIROBOTREG; ?></span></td>
					</tr>
					<tr>
					  <td class="main" width="100%">
<?php
		  $check_anti_robotreg_query = tep_db_query("select session_id, reg_key, timestamp from anti_robotreg where session_id = '" . tep_session_id() . "'");
		  $new_guery_anti_robotreg = tep_db_fetch_array($check_anti_robotreg_query);

		  $validation_images = tep_image('validation_png.php?rsid=' . $new_guery_anti_robotreg['session_id'] . '&' . time() . '.png');
		  if ($entry_antirobotreg_error == true) {
?>
<span>
<?php
			echo $validation_images . ' <br> ';
			echo tep_draw_input_field('antirobotreg') . ' <br><b><font color="red">' . ERROR_VALIDATION . '<br>' . $text_antirobotreg_error . '</b></font>';
		  } else {
?>
<span>
<?php	  
			echo $validation_images . ' <br> ';
			echo tep_draw_input_field('antirobotreg', $account['entry_antirobotreg']) . ' ' . ENTRY_ANTIROBOTREG_TEXT;
		  }
		}
	  }
?>
</span>
					  </td>
					</tr>
				  </table></td>
				</tr>
			  </table></td>
			</tr>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<tr>
 <td>
<?php
	  echo tep_draw_separator('pixel_trans.gif', '100%', '10');
	}
?>
	</td>
  </tr>

<!-- // EOF Anti Robot Registration v2.4-->

 

Good Luck!

Share this post


Link to post
Share on other sites
Tone! Thank you so much! That worked like a charm.

 

 

Hi all, got the same issue as everyone else, Picture not showing on registraction contact us and edit password. tried copying the sessionid from my database table and posting the link directly but no image is displayed. I'm useing the latest Registration Validation with the PHP Hack also done by Alex. I'm Useing IE7. Help please

 

Pretty please :)

Share this post


Link to post
Share on other sites
Hi all, got the same issue as everyone else, Picture not showing on registraction contact us and edit password. tried copying the sessionid from my database table and posting the link directly but no image is displayed. I'm useing the latest Registration Validation with the PHP Hack also done by Alex. I'm Useing IE7. Help please

 

Pretty please :)

Did you run the v2.5 sql script?

 

BTW, I don't have done any PHP Hack...(sounds pretty scary)....


Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Share this post


Link to post
Share on other sites

I installed the 2.6 version , and got a blank black box , i checked on the database on the antirobot.. table i ca nsee my sessions then i test the trick http://www.yourdomain.com/catalog/validati...ng.php?rsid=the session id and i still see a blank balck rectangle .

 

My tep_image function has been changed for image magic , is there anyone that could check and see where i got to make a change , in the code you will see i tried something commented now but that didnt work

 

// BOF Image Magic 
function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {  
 global $product_info;

 //Allow for a new intermediate sized thumbnail size to be set 
 //without any changes having to be made to the product_info page itself. 
 //(see the lengths I go to to make your life easier :-)
 if (strstr($_SERVER['PHP_SELF'],"product_info.php")) {

	if (isset($product_info['products_image']) 
			   && $src == DIR_WS_IMAGES . $product_info['products_image']
			   && $product_info[products_id]==$_GET['products_id'])  {   //final check just to make sure that we don't interfere with other contribs
		$width = PRODUCT_INFO_IMAGE_WIDTH == 0?'':PRODUCT_INFO_IMAGE_WIDTH;
		$height = PRODUCT_INFO_IMAGE_HEIGHT == 0?'':PRODUCT_INFO_IMAGE_HEIGHT;
		$product_info_image=true;
		$page="prod_info"; 
	}
 }

 //Detect whether this is a pop-up image
 if (strstr($_SERVER['PHP_SELF'],"popup_image.php")) $page="popup";

 //do we apply the IE PNG alpha transparency fix?
 if  (strstr(strtolower($src),".png") && CFG_PNG_BUG=="True") $fix_png = true;
 else $fix_png=false; // added by azer

 //send the image for processing unless told otherwise
 $image = '<img src="' . $src . '"'; //set up the image tag just in case we don't want to process
 if (CFG_MASTER_SWITCH=="On") $calculate = true;
 else $calculate=false;

 // Don't calculate if the image is set to a "%" width
 if (strstr($width,'%') == true || strstr($height,'%') == true) $calculate = false; 

 // Dont calculate if a pixel image is being passed (hope you dont have pixels for sale)
 if (strstr($image, 'pixel')) $calculate = false;


 $image_size = @getimagesize($src);


 // Decide whether or not we want to process this image
 if (($width == '' && $height == '' && $page != 'popup' ) || ($width == $image_size[0] && $height == $image_size[0] && $page != 'popup')) {  
	if (CFG_PROCESS_GRAPHICS=="False") $calculate = false; //looks like this is a store graphic rather than product image
 }	

 // Is this image good to go?
  if ( CONFIG_CALCULATE_IMAGE_SIZE && $calculate) { 
 // tested for antirobot doesnt work 
 // if ((substr($src,0,24)!='validation_png.php?rsid=') && CONFIG_CALCULATE_IMAGE_SIZE && $calculate) { 



 if ($image_size) { 

  $ratio = $image_size[1] / $image_size[0];

  // Set the width and height to the proper ratio
  if (!$width && $height) { 
	$ratio = $height / $image_size[1]; 
	$width = intval($image_size[0] * $ratio); 
  } elseif ($width && !$height) { 
	$ratio = $width / $image_size[0]; 
	$height = intval($image_size[1] * $ratio); 
  } elseif (!$width && !$height && !$over_ride) { 
	$width = $image_size[0]; 
	$height = $image_size[1]; 
  } 

  //Encrypt the image filename if switched on
	if (CFG_ENCRYPT_FILENAMES == "True" && CFG_ENCRYPTION_KEY !="") {
		  $result = '';
		  $key=CFG_ENCRYPTION_KEY;
		  for($i=0; $i<strlen($src); $i++) {
			  $char = substr($src, $i, 1);
			  $keychar = substr($key, ($i % strlen($key))-1, 1);
			  $char = chr(ord($char)+ord($keychar));
			  $result.=$char;
		  }
		  $src=urlencode(base64_encode($result));
	}

   //Return the html
	$image = '<img src="imagemagic.php?img='.$src.'&w='.
	tep_output_string($width).'&h='.tep_output_string($height).'&page='.$page.'"';

} elseif (IMAGE_REQUIRED == 'false') { 
  return false; 
} 
 }  

//If the size asked for is greater than the image itself, we check the configs to see if this is allowed and if not over-ride
 if ($width > $image_size[0] || $height > $image_size[1]) {
	if (CFG_ALLOW_LARGER  != 'True'){
		  $width=$image_size[0];
		  $height=$image_size[1];
		  $over_ride = true;
	}
 }
 // Add remaining image parameters if they exist
 if ($width) { 
$image .= ' width="' . tep_output_string($width) . '"'; 
 } 

 if ($height) { 
$image .= ' height="' . tep_output_string($height) . '"'; 
 }	 

 if (tep_not_null($params)) $image .= ' ' . $params;

 $image .= ' border="0" alt="' . tep_output_string($alt) . '"';

 if (tep_not_null($alt)) {
$image .= ' title="' . tep_output_string($alt) . '"';
 }

 if ($fix_png && CFG_MASTER_SWITCH=="On") {
	$image .= ' onload="fixPNG(this)"'; 
 }

 $image .= '>';   
 return $image; 
}
//EOF Image Magic

Edited by azer

MS2

Share this post


Link to post
Share on other sites
Did you run the v2.5 sql script?

 

BTW, I don't have done any PHP Hack...(sounds pretty scary)....

 

Sorry yer I'm useing the "pbpBB2 and osC shared account creation hack."

 

yer I ran the v2.5 then the 2.6 sql script!!!!! all seems to work aprt from now image being displayed :(

Share this post


Link to post
Share on other sites
Sorry yer I'm useing the "pbpBB2 and osC shared account creation hack."

 

 

 

yer I ran the v2.5 then the 2.6 sql script!!!!! all seems to work apart from the image not being displayed :(

Share this post


Link to post
Share on other sites
yer I ran the v2.5 then the 2.6 sql script!!!!! all seems to work apart from the image not being displayed :(

I didn't try Tone's v2.6 yet. You can restore the v2.5 validation_png.php and see if the v2.5 code works.

Edited by AlexStudio

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Share this post


Link to post
Share on other sites
yer I ran the v2.5 then the 2.6 sql script!!!!! all seems to work apart from the image not being displayed :(

 

Have you changed the configuration options for Anti Robot in Admin configuration? The default install settings should reproduce the appearance of the 2.5 code - however try the following settings:

 

Use Truetype fonts: false

Background color: 0xFFFFFF

Text color: 0x000000

Apply noise filter? false

Apply scatter filter? false

Apply interlace filter? false

Apply grayscale filter? false

 

This should produce the validation code as black text on a white background using a plain PHP bitmap font and with no attempt to distort the image. If that's good then try re-introducing the noise then scatter filter options. If that's OK then try settings Use Truetype fonts to true. At what point does it break?

 

If that fails, then I would try AlexStudio's suggestion of replacing the validation_png.php file with the version from 2.5 to see if it's a 2.6 issue.

 

Let me know how you get on.

 

Tone.

Share this post


Link to post
Share on other sites

Hello,i'm using Anti Robot Registration Validation some time and it is great :D thanks to all the people who heve created this contribution.

 

But I have just done the upgrade from 2.5 to 2.6. Everything have gone well and work also, only if I set the treutype fonts to treu I get no characters or figures to see. in my opinion Anti Robot Registration Validation can't find the treutype fonts. where should i put these fonts?

 

ps: my english isn't very good but i hope you understand wath i mean :)

thanks, Roy

Share this post


Link to post
Share on other sites
Hello,i'm using Anti Robot Registration Validation some time and it is great :D thanks to all the people who heve created this contribution.

 

But I have just done the upgrade from 2.5 to 2.6. Everything have gone well and work also, only if I set the treutype fonts to treu I get no characters or figures to see. in my opinion Anti Robot Registration Validation can't find the treutype fonts. where should i put these fonts?

 

ps: my english isn't very good but i hope you understand wath i mean :)

thanks, Roy

The truetype font support requires the GD library to be available in PHP. You can check for this using Admin | Tools | Server Info from your store Admin. Look for gd listed under the PHP configuration details. If it's not there you will need to see if your host can make this available. If gd support is enabled, then the server environment variable GDFONTPATH points to the truetype font directory. Again, your host should be able to tell you which fonts are available. If you want to use your own truetype fonts you can set this variable to point to a directory of your own using PHP for example something like:

 

<?php
// Set the enviroment variable for GD fonts
putenv('GDFONTPATH=' . 'images/fonts/'));
?>

 

Good luck, Tone.

Share this post


Link to post
Share on other sites
I didn't try Tone's v2.6 yet. You can restore the v2.5 validation_png.php and see if the v2.5 code works.

 

your a superstar it works but only you use the direct url

 

e.g. validation_png.php?rsid=0b383f1d30190a37d055f018b20fd803

 

All I need to do now is make a few tweaks as suggested in the previous posts, all should good :)

 

Big Thumbs up

 

 

Have you changed the configuration options for Anti Robot in Admin configuration? The default install settings should reproduce the appearance of the 2.5 code - however try the following settings:

 

Use Truetype fonts: false

Background color: 0xFFFFFF

Text color: 0x000000

Apply noise filter? false

Apply scatter filter? false

Apply interlace filter? false

Apply grayscale filter? false

 

This should produce the validation code as black text on a white background using a plain PHP bitmap font and with no attempt to distort the image. If that's good then try re-introducing the noise then scatter filter options. If that's OK then try settings Use Truetype fonts to true. At what point does it break?

 

If that fails, then I would try AlexStudio's suggestion of replacing the validation_png.php file with the version from 2.5 to see if it's a 2.6 issue.

 

Let me know how you get on.

 

Tone.

 

tried your suggestion before doing AlexStudio's suggestion it was a no go :(

Edited by Optimalkiller

Share this post


Link to post
Share on other sites
Hello,i'm using Anti Robot Registration Validation some time and it is great :D thanks to all the people who heve created this contribution.

 

But I have just done the upgrade from 2.5 to 2.6. Everything have gone well and work also, only if I set the treutype fonts to treu I get no characters or figures to see. in my opinion Anti Robot Registration Validation can't find the treutype fonts. where should i put these fonts?

 

ps: my english isn't very good but i hope you understand wath i mean :)

thanks, Roy

Oh forgot - you can also provide the server path to the font file in the admin panel. So instead of just typing the font name for the 'Truetype font used' you can provide a complete path eg on a windows server it would be something like c:/windows/fonts/arial.ttf.

 

Tone.

Share this post


Link to post
Share on other sites
The truetype font support requires the GD library to be available in PHP. You can check for this using Admin | Tools | Server Info from your store Admin. Look for gd listed under the PHP configuration details. If it's not there you will need to see if your host can make this available. If gd support is enabled, then the server environment variable GDFONTPATH points to the truetype font directory. Again, your host should be able to tell you which fonts are available. If you want to use your own truetype fonts you can set this variable to point to a directory of your own using PHP for example something like:

 

<?php
// Set the enviroment variable for GD fonts
putenv('GDFONTPATH=' . 'images/fonts/'));
?>

 

Good luck, Tone.

 

Thank you for the replay,

 

The gd is fully enabled and supported at mij host so i going to try this.

 

Again thank you for the awnser

 

Greetz, Roy

Share this post


Link to post
Share on other sites
Thank you for the replay,

 

The gd is fully enabled and supported at mij host so i going to try this.

 

Again thank you for the awnser

 

Greetz, Roy

 

Maybe some stupid question, But in witch file should i paste the code you posted earlier ?

 

Thanks, Roy

Share this post


Link to post
Share on other sites
It may be that you have no GD library support on your PHP server.

 

Tone.

 

I'll check that out btw it's all working now made changes to the files and done the following for

 

account_edit etc etc

 

Replace:

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

 

with:

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

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  

×