I built a site which you may access:
http:www.madonnamodelschools.com
At the foot of the site, if you click on checkresult it next you to a page that has;
Registration No:
Pin No:
So I need an admin page to generate the Pin No: that can login to check the result. Or a complete example with source code.
Thanks
How and when are these numbers generated?
Where are they stored?
Alpha-numeric, Upper and lower case, just numbers?
There are many ways to do it. Here are two versions.
<?php
//Upper or Lower or Both defined with $case
function swd_rand($length = 10, $letters = true, $numbers = true, $case = 'i'){
$chars = array();
if ($numbers){
$chars = array_merge($chars, range(48, 57));
}
if ($letters || !$numbers){
$chars = array_merge($chars, range(65, 90), range(97, 122));
}
for ($string = ''; strlen($string) < $length; $string .= chr($chars[array_rand($chars)]));
switch ($case){
case 'i': default: return $string;
case 'u': return strtoupper($string);
case 'l': return strtolower($string);
}
}
echo swd_rand(8);
echo "<br />";
//Simple lower case version
function createnumber() {
$string = md5(uniqid(rand(), true));
return substr($string, 0, 8);
}
echo createnumber();
?>
system
Closed
3
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.