Monday, 20 July 2015

Simple Human verification code in php

This article related on Human verification code (CAPTCHA). its check to the requiring little human maintenance or intervention in administering the test. CAPTCHA must be taken to correctly identify each character after to submit form value post on database.

random

so now i make simple verification code generator its generate automatic random code that code and user fill code matching form value post on database otherwise again generate another code.

PHP
<?php
if(isset($_POST['submit']))
{
$code1=$_POST['code1'];
$code=$_POST['code'];
if($code1!="$code")
{
$msg="Invalide code";
}
else
{
$msg="Your code is correct";
}
}
?>
<form name="form" method="post">
<p>Type Below this code <?php $Random_code=rand(); echo$Random_code; ?> </p><br />
<p>Enter the random code<br />
<input type="text" name="code1" title="random code" />
<input type="hidden" name="code" value="<?php echo $Random_code; ?>" />
</p>
<p><input type="submit" value="check" title="code check" name="submit"/></p>
</form>
<p><?php if(isset($_POST['submit']))
{ echo $msg; } ?>
</p>

0 comments:

Post a Comment