<?php
require ("inc/function.php");
$thistitle="修改资料";
include ("top.php");
?>
<?php
if ($_GET["action"]=="out")
{
session_destroy();
echo "<script language='javascript'>alert('成功退出登录！');location.href='admin.php'</script>";
}

if ($_GET["action"]=="login")
{
$admin=$_POST["admin"];
$passwords=$_POST["passwords"];
axing_connect();
$sql="select * from admin where admin='$admin'";
$result=mysql_query($sql);
if (mysql_num_rows($result)>0)
{
$myrow=mysql_fetch_assoc($result);
if ($passwords==$myrow["passwords"])
{
$_SESSION['admin']=$admin; 
echo "<script language='javascript'>alert('登录成功！');location.href='admin.php'</script>";
}
else
{
echo "<script language='javascript'>alert('密码不正确，请重新输入！');location.href='admin.php'</script>";
}
}
mysql_close();
}

if ($_GET["action"]=="editok")
{
$admin=$_SESSION["admin"];
axing_connect();
$sql="update admin set passwords='$_POST[passwords]',admin='$_POST[admin]' where admin='$admin'";
$result=mysql_query($sql);
if (mysql_affected_rows()>0)
{
$_SESSION['admin']=$_POST[admin]; 
echo "<script language='javascript'>alert('修改成功！');location.href='admin_change.php'</script>";
}
mysql_close();
}

?>
<DIV id="no_index_container">

<DIV id="no_index_content">
<div id="no_index_content_top">
管理中心
</div>
<?php
include ("admin_box.php");
?>
</DIV>

<DIV id="no_index_content">

<div id="no_index_content_top">修改资料</div>
<div id="no_index_content_content">
<?php
if ($_SESSION['admin'])
{
?>

<?php
$admin=$_SESSION["admin"];
axing_connect();
$sql="select * from admin where admin='$admin'";
$result=mysql_query($sql);
$myrow=mysql_fetch_assoc($result);
?>
<ul style="list-style-type:none;border:1px #CCCCCC dashed; padding:10px; width:600px">
<form action="?action=editok" method="post">
  <li>帐号：<input name="admin" type="text" class="text_axing" style="width:150px" value="<?echo($myrow[admin])?>"></li>
  <li>密码：<input name="passwords" type="text" class="text_axing" style="width:150px" value="<?echo($myrow[passwords])?>"></li>
  <li style="margin-top:5px"><input type="submit" value="修改" class="put"></li>
 </form>
</ul>
<?php
}
else
{
echo("请先登录！");
}
?>
  </div>
  </DIV>
  </div>
  </body>
