|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /var/www/html/pathumthani_eoffice/application/tool/ |
Upload File : |
<?
session_start();
include "../../config/config.inc.php";
function randigit($numchar){
$frchar = array("1","2","3","4","5","6","7","8","9","0") ;
$ran_digit ="";
for ($ii = 0 ; $ii < $numchar ; $ii++ ){
$ran_digit .= $frchar[rand(1,10)] ;
}
return $ran_digit ;
} ## END function
//echo "xxxx = ".randigit(4);
//echo rand(1000,1000);
if($action == "run"){
$strSQL_sel = "SELECT * FROM epm_staff WHERE staffname NOT LIKE '%Administrator%'";
$result_sel = mysql_db_query($dbname,$strSQL_sel);
$i=0;
while($rs_s = mysql_fetch_assoc($result_sel)){
$temp_pass = randigit(4);
$len_p = strlen($temp_pass);
if($len_p == 2){
$password = $temp_pass."01";
}else if($len_p == 3){
$password = $temp_pass."0";
}else if($len_p == 1){
$password = $temp_pass."001";
}else{
$password = $temp_pass;
}
$sql_up = "UPDATE epm_staff SET password='".$password."' WHERE staffid = '$rs_s[staffid]'";
@mysql_db_query($dbname,$sql_up);
$i++;
} // end while($rs_s = mysql_fetch_assoc($result_sel)){
echo "รายการทั้งหมด $i รายการ";
} // end if($action == "run"){
?>
<html>
<head>
<title>tool gen password</title>
<META http-equiv=Content-Type content="text/html; charset=windows-874">
<link href="../../common/style.css" type="text/css" rel="stylesheet" />
<script language='javascript' src='daily_popcalendar.js'></script>
<script language='javascript' src='displayelement.js'></script>
<style type="text/css">
<!--
body { margin: 0px 0px; padding: 0px 0px}
a:link { color: #005CA2; text-decoration: none}
a:visited { color: #005CA2; text-decoration: none}
a:active { color: #0099FF; text-decoration: underline}
a:hover { color: #0099FF; text-decoration: underline}
-->
</style>
</head>
<body>
<a href="?action=run"> || run gen password || </a>
</body>
</html>