www.gusucode.com > 给力搜索小偷开源源码 3.0源码程序 > admin/admin_admin.php

    <?
include('data.php');
if($_COOKIE['x_Cookie']!=$adminname or $_COOKIE['y_Cookie']!=md5($password)){
	echo"<script>location.href='index.php';</script>";
	exit;
}
?>
<!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>帐户管理</title>
<script>
function chk(){
	if(form.adminname.value==''){
		alert('不好意思管理员帐号为空!');
		return false;
	}
	if(form.password.value=='' || form.password.value!=form.password1.value){
		alert('不好意思密码为空或再次输入不一致!');
		return false;
}
}
</script>
</head>

<body>
<?
$id=$_GET['id'];
if($id=='edit'){
	
?>
<form method="POST" action="?id=save" id="form" name="form" onSubmit="return chk();">
<table width="388" border="1" align="center" bordercolor="#666666">
  
    <tr>
      <td colspan="4" align="center" ><strong>管理员帐户修改</strong></td>
    </tr>
  <tr>
    <td>管理员帐号:</td>
    <td><input name="adminname" type="text" id="adminname" value="<? echo $adminname; ?>" /></td>
  </tr>
  <tr>
    <td>管理员密码:</td>
    <td><input name="password" type="password" id="password" value="" /></td>
  </tr>
  <tr>
    <td>请确认密码:</td>
    <td><input name="password1" type="password" id="password1" value="" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input name="cmdSave" type="submit" id="cmdSave" value="登录"/>
    &nbsp;&nbsp;
      <input type="reset" name="reset" value="重置" /></td>
  </tr>
</table>
</form>
</body>
</html>
<?
}elseif ($id=='save'){
	$con='<?'."\r\n".'$adminname='.'"'.$_POST['adminname'].'"'.";\r\n".'$password='.'"'.$_POST['password'].'"'.";\r\n?>";
	if(preg_match("/{|}|fputs|fopen/i", $con)){   
    echo"<script>alert('含有非法字符!');location.href='?id=edit';</script>";
}   
else{
	$fp=fopen("data.php","w");
	fwrite($fp,$con);
	fclose($fp);
	echo"<script>alert('修改成功!');location.href='?id=edit';</script>";
}
}
?>