|
 |
栏目导栏 |
|
| |
|
|
|
|
 |
资料搜索 |
|
| |
|
|
|
|
 |
热门文章 |
|
| |
|
|
|
|
 |
最新文章 |
|
| |
|
|
|
| |
| |
|
|
|
|
用这个可以来验证用户和生成随机密码--teaman 5S3Linux联盟 <? 5S3Linux联盟 //---------------------------------------------------- 5S3Linux联盟 // Function GetSID() 5S3Linux联盟 // 5S3Linux联盟 // Parameters : $nSize number of caracters, default 24 5S3Linux联盟 // Return value : 24 caracters string 5S3Linux联盟 // 5S3Linux联盟 // Description : This function returns a random string 5S3Linux联盟 // of 24 caracters that can be used to identify users 5S3Linux联盟 // on your web site in a more secure way. You can also 5S3Linux联盟 // use this function to generate passwords. 5S3Linux联盟 //---------------------------------------------------- 5S3Linux联盟 function GetSID ($nSize=24) { 5S3Linux联盟 5S3Linux联盟 // Randomize 5S3Linux联盟 mt_srand ((double) microtime() * 1000000); 5S3Linux联盟 for ($i=1; $i<=$nSize; $i++) { 5S3Linux联盟 5S3Linux联盟 // if you wish to add numbers in your string, 5S3Linux联盟 // uncomment the two lines that are commented 5S3Linux联盟 // in the if statement 5S3Linux联盟 $nRandom = mt_rand(1,30); 5S3Linux联盟 if ($nRandom <= 10) { 5S3Linux联盟 // Uppercase letters 5S3Linux联盟 $sessionID .= chr(mt_rand(65,90)); 5S3Linux联盟 // } elseif ($nRandom <= 20) { 5S3Linux联盟 // $sessionID .= mt_rand(0,9); 5S3Linux联盟 } else { 5S3Linux联盟 // Lowercase letters 5S3Linux联盟 $sessionID .= chr(mt_rand(97,122)); 5S3Linux联盟 } 5S3Linux联盟 5S3Linux联盟 } 5S3Linux联盟 return $sessionID; 5S3Linux联盟 } 5S3Linux联盟 // Test the function 5S3Linux联盟 echo GetSID(16); 5S3Linux联盟 ?> 5S3Linux联盟
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论 |
|
|
|
|
|