Tim96 Posted June 21, 2007 Share Posted June 21, 2007 I am putting together a sign up Form and I would like to put a visual verification at the end of it. I have found a few samples but I can't get anything to work. Can someone please help me out on this. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/56510-visual-verification/ Share on other sites More sharing options...
redarrow Posted June 21, 2007 Share Posted June 21, 2007 quick version of what you want 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> Quote Link to comment https://forums.phpfreaks.com/topic/56510-visual-verification/#findComment-279094 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.