?? add_admin.php
字號:
<?
session_start();
require "../config.php";
require "../fun.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><?=$sys_site_name?>_新增管理員</title>
<link href="template/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="768" height="361" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30" rowspan="2" valign="top" bgcolor="#f8f8f8"> </td>
<td width="607" bgcolor="#f8f8f8" valign="top"> </td>
</tr>
<tr>
<td bgcolor="#f8f8f8" valign="top"><?
if($_SESSION['login_status']=="adminstrator1"){
if(empty($action))
{
print <<<EOT
<form id="form1" name="form1" method="post" action="add_admin.php?action=add">
管理帳戶:
<input name="admin_name" type="text" id="admin_name" size="12" maxlength="12" />
管理密碼:
<input name="psd" type="password" id="psd" size="16" maxlength="16" />
<input type="submit" name="Submit" value="添加" />
</form>
EOT;
/////////////////////
$dh=opendir("../$sys_data_dir/admin/");
while ($userfile=readdir($dh))
{
if (($userfile!=".") && ($userfile!="..") && ($userfile!="") && strpos($userfile,".php"))
{
$user_data=file("../$sys_data_dir/admin/$userfile");
$user_info=explode("|",$user_data[1]);
echo "$user_info[0]---$user_info[2]----<a href=\"javascript:if(confirm('你確定要刪除管理員$user_info[0]?'))window.location='add_admin.php?action=del&user=$user_info[0]';\">刪除?</a><br>";
}
}
closedir($dh);
//////////////////////
}
elseif($action=="add")
{
$admin_name=$_POST['admin_name'];
$psd=$_POST['psd'];
$psd=md5($psd);
$admin_name=check_out($admin_name);
if (file_exists("../$sys_data_dir/admin/$admin_name.php"))
{
echo "此管理員已經存在,請更換用戶名";
exit;
}
$date=get_date();
$user_info="<?echo\"你的操作非法!\";exit;?>\n$admin_name|$psd|$date|";
writeto("../$sys_data_dir/admin/$admin_name.php",$user_info);
echo "添加完成!<a href=add_admin.php>返回</a>";
}
elseif($action=="del")
{
$user=$_GET['user'];
if (file_exists("../$sys_data_dir/admin/$user.php"))unlink("../$sys_data_dir/admin/$user.php");
echo "刪除管理員{$user}成功!<a href=add_admin.php>返回</a>";
}
}
else
{
echo "您還沒有登錄,請您先登錄,<a href=login.php>點這里進入登錄頁面</a>";
}
?></td>
</tr>
</table>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -