Jump to content

Recommended Posts

Dont understand your quistion but this is a simple idear for you ok.

 

<?php 

ob_start(); 

session_start();

if( $_GET['cmd']=="get"){

if ($new_string == $random){ 

echo "<center> <b> Congratulations Code Correct ! </b> </center>";

}else{

echo "<center> <b> Dam you Code Incorrect ! </b> </center>";
}

}


$new_string=$_POST['new_string']; 
$random=$_POST['random'];


session_register('new_string'); 



$im = ImageCreate(150, 20);  


$white = ImageColorAllocate($im, 255, 255, 0); 

$black = ImageColorAllocate($im, 255, 69, 0); 

srand((double)microtime()*1000000);  


$string = md5(rand(0,9999));  


$new_string = substr($string, 17, 5); 

ImageFill($im, 0, 0, $black); 

  
ImageString($im, 4, 60, 3, $new_string, $white); 


Imagepng($im, "grey.png"); 

ImageDestroy($im);

?> 

<center>

<form method="POST" action="<?php $_SERVER['PHP_SELF']; ?>?cmd=get">

<?php echo "<img src=\"grey.png\">"; ?> 

<br>

<input type="text" name="random" value="Please enter code... ">

<p></p>

<input type="submit" name="submit" value="Register">

</form>

</center>

Link to comment
https://forums.phpfreaks.com/topic/55828-anti-spam-key/#findComment-275782
Share on other sites

Thanks redarrow, thats what I was looking for (well I assume it is, I wont have time to try it for a while, but it looks good).

 

The script was for a guestbook, to stop robots, which when the guestbook is on a primary school website, can cause a LOT of hassle.

 

Thanks again,

Alex

Link to comment
https://forums.phpfreaks.com/topic/55828-anti-spam-key/#findComment-276140
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.