日期:2014-05-17 浏览次数:20511 次
<? require_once("session.php"); $web_root_part = "../"; require_once($web_root_part."lib/db.php"); require_once($web_root_part."lib/function.php"); header('Content-type:text/html;charset=utf-8'); $AdminID = trim($_POST['AdminID']); $PassWord = trim($_POST['PassWord']); $Addtime = date("Y-m-d H:i:s"); $querySel = "select * from Admin where AdminID='".$AdminID."'"; if( !($result = $db->sql_query($querySel)) ) { message_die(DB_MESSAGE, 'Could not query Admin'); }else{ $row = $db->sql_fetchrow($result); //$db->sql_freeresult($result); if (empty($row['ID'])){ $sql="insert into Admin (AdminID,PassWord,Editer,Addtime) values('".$AdminID."','".md5($PassWord)."','".$_SESSION['AdminID']."','".$Addtime."')"; if( !($result = $db->sql_query($sql)) ) { //echo $sql; message_die(DB_MESSAGE, 'Could not query Admin'); }else{ echo "<script>location.replace('admin.php');</script>"; } }else{ echo "<Script Language='Javascript'>"; echo "alert('提示:管理员ID已存在,请重新输入!');"; echo "history.go(-1);"; echo "</Script>"; } } ?>