<?php
function RandomString($m,$mx,$isspecial=null)
{
$min = $m;
$max = $mx;
$passwd = "";
$passwdstr = "abcdefghijklmnopqrstuvwxyz";
$passwdstr .= strtoupper($passwdstr);
$passwdstr .= "12345678901234567890";
for($i=0; $i<=strlen($passwdstr) - 1; $i++) {
$passwdchars[$i]=$passwdstr[$i];
}
srand ((float)microtime()*1000000);
shuffle($passwdchars);
$length = rand($min,$max);
for($i=0; $i<$length; $i++) {
$charnum = rand(0, count($passwdchars) - 1);
$passwd .= $passwdchars[$charnum];
}
return htmlentities($passwd);
}
?>
This function generates pin numbers.. what happens in real scenario is that , a pin is generated , and an entry is made into the table , i.e. a pin is assigned to the user id .