Jump to content
Sign in to follow this  
Druide

NEW: Anti Robot Registration Validation

Recommended Posts

I have installed this fantasic contribution into an established osc store setup, and everything went smoothly (great install instructions).

 

I just have one small issue; I set the controls for this contribution (in the admin panel) to display a text link and an image link that the user can click to obtain a new validation image, but the controls do not appear on the validation forms (all of the anti robot forms are missing these controls).

 

Sam, if you are still reading this thread, do I need to add the code you posted here to the latest release by Richard Cranium, or do you know if the functionality I am after is fully implemented in his release?

 

Every other aspect of the contribution works perfectly for me, I am just unable to get the image refresh controls to display, no matter how I have the admin options set; any help will be most gratefully received.

 

Best regards,

Cyb

Share this post


Link to post
Share on other sites

Ok, I now see what the problem is, it would appear that the validation image refresh code in 2.9.1 was a bit of a quick fix solution; naughty naughty.

 

It has a text string for output hardcoded into the pages of the site, rather than being in the language files; furthermore, the code which enables the validation image refresh functionality isn't included in the installation instructions for an existing osCommerce store, so you can only expect to see this functionality working if you copy the provided files over a clean osCommerce install.

 

I am now going to create a proper solution to the validation image refresh fuctionality, and will post when I have something worth sharing.

 

I do really appreciate the efforts of those who have brought this great contribution to osCommerce, but honestly, if a jobs worth doing.....

 

Cheers,

Cyb

Share this post


Link to post
Share on other sites

Right then, the following code does not make the button function for the validation refresh work, but it does make the text link functionality work correctly. I have made changes in the 'catalog/includes/languages/english/account_validation.php' page, thus:

 

<?php
 define('CATEGORY_ANTIROBOTREG', 'Validation Code');

 define('ENTRY_ANTIROBOTREG', 'Please enter the characters shown in this image into the text box below:<br /><br />');
 define('ENTRY_ANTIROBOTREG_TEXT', '*');
 define('ENTRY_ANTIROBOTREG_REFRESH_TEXT_1', 'If you cannot read the characters, please click ');
 define('ENTRY_ANTIROBOTREG_REFRESH_TEXT_2', 'HERE');
 define('ENTRY_ANTIROBOTREG_REFRESH_TEXT_3', ' for another image.');

 define('ERROR_VALIDATION', 'Error:');
 define('ERROR_VALIDATION_1', 'Could not obtain registration information');
 define('ERROR_VALIDATION_2', 'Invalid Validation Code');
 define('ERROR_VALIDATION_3', 'Could not delete validation key');
 define('ERROR_VALIDATION_4', 'Could not optimize database');
 define('ERROR_VALIDATION_5', 'Could not check registration information');
?>

 

 

 

I have also made changes to the code where the contributions' functionality is displayed on the store pages; this following snippet is from my 'catalog/account_edit.php' page. Although I haven't tested it in all the required pages yet, it should (errrr, will lol) work:

 

	  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

<?php
// START: Anti Robot Registration v2.9.1
 if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'account_edit') &&  ACCOUNT_EDIT_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
// ARE WE USING THE ACCOUNT VALIDATION FUNCTION?
if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'account_edit') &&  ACCOUNT_EDIT_VALIDATION == 'true') {
  if ($is_read_only == false || (strstr($PHP_SELF,'account_edit')) ) {
	$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() . "')";
	// DID THE DATABASE OPERATION COMPLETE?
	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
	  // THIS SECTION CHECKS THE VALIDATION INPUT FOR ERRORS
	  $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);
				if (empty($new_guery_anti_robotreg['session_id'])) echo 'Error, unable to read session id.';
	  $validation_images = tep_image_captcha('validation_png.php?rsid=' . $new_guery_anti_robotreg['session_id'] .'&csh='.uniqid(0));
	  if ($entry_antirobotreg_error == true) {
?>
<span>
<?php
		// THERE IS AN ERROR, DRAW THE INPUT CONTROL PANEL AND ERROR MESSAGE
		echo $validation_images . '<br /><br />';
		echo tep_draw_input_field('antirobotreg');

		// TEXT LINK VALIDATION IMAGE REFRESH SELECTED IN ADMIN?
		if (DISPLAY_TEXT_REFRESH == 'true') {
			echo '<br /><br />' . ENTRY_ANTIROBOTREG_REFRESH_TEXT_1 . '<a href="' . $PHP_SELF . '">' 
								. ENTRY_ANTIROBOTREG_REFRESH_TEXT_2 . '</a>'
								. ENTRY_ANTIROBOTREG_REFRESH_TEXT_3;
		}
		echo '<br /><br /><b><font color="#FF0000">' . ERROR_VALIDATION . '</font> ' . $text_antirobotreg_error . '</b>';
	  } else {
?>
<span>
<?php	  
		// THERE IS NO ERROR, DRAW THE DEFAULT INPUT CONTROL PANEL
		echo $validation_images . '<br /><br />';
		echo tep_draw_input_field('antirobotreg', $account['entry_antirobotreg']);
		echo ' <font color="#FF0000">' . ENTRY_ANTIROBOTREG_TEXT . '</font>';

		// TEXT LINK VALIDATION IMAGE REFRESH SELECTED IN ADMIN?
		if (DISPLAY_TEXT_REFRESH == 'true') {
			echo '<br /><br />' . ENTRY_ANTIROBOTREG_REFRESH_TEXT_1 . '<a href="' . $PHP_SELF . '">' 
								. ENTRY_ANTIROBOTREG_REFRESH_TEXT_2 . '</a>'
								. ENTRY_ANTIROBOTREG_REFRESH_TEXT_3;
		}
	  }
	}
  }
?>
</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>
<?php
}
// END: Anti Robot Registration v2.9.1
?>

 

 

 

I don't have any time to bundle this into a contribution, or provide any support, but if you have been looking at the code for this contribution after doing an upgrade install, and are wondering why the refresh link functionality is missing, you should know where this code needs to go.

 

Obviously, you will need to edit the other language files upon which this contribution depends so that they contain the same defines as my English example file.

 

Cheers,

Cyb

Share this post


Link to post
Share on other sites

Has anyone found a solution to this issue?

 

This mod is EXCELLENT! But without a refresh, the potential for frustration of having to fill out Create Account over again is very high. :)

Edited by gtilflm

Share this post


Link to post
Share on other sites

I did that a while ago, just havent got around to updating the contrib, as there have been quite a number of changes I`ve done since I did the last, I`ll release as soon as I`ve time.


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites

Awesome. Thanks!

 

 

I did that a while ago, just havent got around to updating the contrib, as there have been quite a number of changes I`ve done since I did the last, I`ll release as soon as I`ve time.

Share this post


Link to post
Share on other sites

Hi,

 

I recently installed this contribution and everything seems to have worked fine except for generating the image file. I have not modified the tep_image() function in the html_output.php file that was suggested may cause such an error. The ocsid is properly getting stored in the database and I've had no luck searching for a solution. Sorry if this problem was already addressed but I would be thankful if someone could point me in the right direction if that is the case

 

Thanks

 

J

Edited by therealjblizzle

Share this post


Link to post
Share on other sites
Hi,

 

I recently installed this contribution and everything seems to have worked fine except for generating the image file. I have not modified the tep_image() function in the html_output.php file that was suggested may cause such an error. The ocsid is properly getting stored in the database and I've had no luck searching for a solution. Sorry if this problem was already addressed but I would be thankful if someone could point me in the right direction if that is the case

 

Thanks

 

J

Forgot to mention, I am using version 2.9.1 and experienced these problems on the 'contact_us.php' page as well as the 'create_account.php' page. didn't check the rest of them and I am assuming they are the same. I ran the SQL file included in the v2.9.1 package and followed the instructions in that package.

Thanks again to whomever could help,

 

J

Edited by therealjblizzle

Share this post


Link to post
Share on other sites
Forgot to mention, I am using version 2.9.1 and experienced these problems on the 'contact_us.php' page as well as the 'create_account.php' page. didn't check the rest of them and I am assuming they are the same. I ran the SQL file included in the v2.9.1 package and followed the instructions in that package.

Thanks again to whomever could help,

 

J

 

 

I also tried it without using truetype fonts and this yielded no results.

 

J

Share this post


Link to post
Share on other sites
Forgot to mention, I am using version 2.9.1 and experienced these problems on the 'contact_us.php' page as well as the 'create_account.php' page. didn't check the rest of them and I am assuming they are the same. I ran the SQL file included in the v2.9.1 package and followed the instructions in that package.

Thanks again to whomever could help,

 

J

 

 

I haven't made any progress so far looking for the solution through the forums and can not figure it out on my own. However, when performing the tests recommended in the installation guide, i started getting an error message instead of it not generating an image at all (ie. when i go to the address unique to the image, it was as if it didn't exist.) This error reads as follows:

 

The image "http://www.yourdomain.com/validation_png.php?rsid=5e84....(id number)" cannot be displayed, because it contains errors.

 

Hope this sounds familiar to someone because i am unfamiliar with the functions that are generating the image.

 

Thanks,

 

J

Share this post


Link to post
Share on other sites

O.K., I installed the latest Anti-Robot 2.9 contrib. I see the gray text box and it does generate random text. Problem is that when I enter the exact same text as in the box it does not validate. I get " Invalid Validation Code" every time. Any ideas where to look?

 

Also, I had to use the validation_png_25.php(86kb). Is this correct? When using the validation_png.php (9kb) I would only get a box with red X and no text generation.

Share this post


Link to post
Share on other sites
O.K., I installed the latest Anti-Robot 2.9 contrib. I see the gray text box and it does generate random text. Problem is that when I enter the exact same text as in the box it does not validate. I get " Invalid Validation Code" every time. Any ideas where to look?

 

Also, I had to use the validation_png_25.php(86kb). Is this correct? When using the validation_png.php (9kb) I would only get a box with red X and no text generation.

 

I also have the same issue and have been looking through the forums for three hours trying to find a solution. I hope we're able to get this resolved soon. Thanks in advance to those who can solve this problem.

Share this post


Link to post
Share on other sites

 

:lol: Thank goodness!!! Thank you Leslie!!!! I can't believe missed that. This definitely helped me. The only page that wouldn't work for me was contact_us.php. Thank you for leading me to where I needed to go and to all those who have contributed towards this add-on.

Share this post


Link to post
Share on other sites

No problem.. you're very welcome! I had the same problem so I could relate...

:-)

Leslie

 

 

:lol: Thank goodness!!! Thank you Leslie!!!! I can't believe missed that. This definitely helped me. The only page that wouldn't work for me was contact_us.php. Thank you for leading me to where I needed to go and to all those who have contributed towards this add-on.

Share this post


Link to post
Share on other sites

This is truly an awesome contribution. It's working great for me, but now I have another question. Suppose I want to add the validation to files outside of create_account.php, edit_account.php, etc. How do I correctly input the code? I am no PHP expert and I tried to figure out on my own to no avail. Any tips?

Share this post


Link to post
Share on other sites

If you look on the original contribution page there is a modification, dated 31 Jul 2006 with the code to add validation to reviews and I think the code for adding it to tell a friend is somewhere in this forum. Use the search box at the bottom of the forum and look for Tell-a-friend.. you should be able to find it.

 

This is truly an awesome contribution. It's working great for me, but now I have another question. Suppose I want to add the validation to files outside of create_account.php, edit_account.php, etc. How do I correctly input the code? I am no PHP expert and I tried to figure out on my own to no avail. Any tips?

Share this post


Link to post
Share on other sites

Hi,

 

I installed 2.9, its working good.

 

One problem is that I have modified live shop, and I am not getting refresh option......can any one guide me ?

 

I have enable refresh text and button option from admin but no option on any pages to refresh...

Edited by ankurdhoom

Share this post


Link to post
Share on other sites
If you look on the original contribution page there is a modification, dated 31 Jul 2006 with the code to add validation to reviews and I think the code for adding it to tell a friend is somewhere in this forum. Use the search box at the bottom of the forum and look for Tell-a-friend.. you should be able to find it.

 

Thank you again!! :D

 

I found the code for tell a friend, but not product_reviews_write.php; however I was able to get the contribution to work on the file on my own. It took me a while, but I did it. Thank you once again uncommonhound. You rock!

Share this post


Link to post
Share on other sites
Hi,

 

I installed 2.9, its working good.

 

One problem is that I have modified live shop, and I am not getting refresh option......can any one guide me ?

 

I have enable refresh text and button option from admin but no option on any pages to refresh...

Hi any one guide me plz.......

Share this post


Link to post
Share on other sites

your site has many errors, could not reach contact or account pages & get no images.

 

validation_png.php is not intended to run independantly.

 

if sid is missing code generation will always fail

 

fixing your site errors will no doubt resolve matters


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

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  

×