Quantcast
Channel: PHP Magic Book - Free PHP Scripts, Tutorials and Downloads » Spam Control
Viewing all articles
Browse latest Browse all 5

Random Number Verification – Simple Form Authentication Using PHP

$
0
0

This is simple form authentication by a random number generated by PHP and authenticated by javascript. It can be used for spam control.

~~~ Head Section Code ~~~

PHP Code

<?php
$mynumber= rand(673,62389);
echo $mynumber;
?>

Javascript Code

<script type="text/javascript">
//defining variable and storinging in script
var randomnumber= <?= $mynumber?>;
// Validating
function CheckData()
{
with(document.mail)
{
if(q.value != randomnumber)
{
alert("Please Enter Correct Number");
q.focus();
return false;
}
}
return true;
}
</script>

~~~ Body Section Code ~~~

Form Code

<form name="mail" action="go.php" method="post" onsubmit="return CheckData()">
<input type="text" name="q">
<input type="submit" name="Submit" value="Submit">
</form>

Random Number Verification PHP Script Download

Random Number Verification – Simple Form Authentication Using PHP is a post from: PHP Magic Book - Free PHP Scripts, Tutorials and Downloads


Viewing all articles
Browse latest Browse all 5

Trending Articles