This can be used to authenticate users and generate random passwords--teaman
//----------------------------------------------------
Function GetSID ()
//
Parameters: $nSize number of caracters, default 24
Return value:24 caracters String
//
Description:this function returns a random string
of caracters that can is used to identify users
On the your Web site in a more secure the. You can also
Use the This function to generate passwords.
//----------------------------------------------------
function GetSID ($nSize =24) {
Randomize
Mt_srand (Double) microtime () * 1000000);
for ($i =1; $i <= $nSize; $i + +) {
If you wish to add numbers in your string,
Uncomment the lines that is commented
In the IF statement
$nRandom = Mt_rand (1,30);
if ($nRandom <= 10) {
Uppercase letters
$sessionID. = Chr (Mt_rand (65,90));
} elseif ($nRandom <= 20) {
$sessionID. = Mt_rand (0,9);
} else {
lowercase letters
$sessionID. = Chr (Mt_rand (97,122));
}
}
return $sessionID;
}
Test the function
Echo GetSID (16);
?>
http://www.bkjia.com/PHPjc/316378.html www.bkjia.com true http://www.bkjia.com/PHPjc/316378.html techarticle Use this to authenticate users and generate random passwords--teaman?//----------------------------------------------------//Function GetSID ()//// Parameters: $nSize number of caracte ...