config_manage_info.php
上传用户:m68239277
上传日期:2014-10-12
资源大小:824k
文件大小:4k
源码类别:

Web服务器

开发平台:

PHP

  1. <?php 
  2. session_start();
  3. include("checks.php");
  4. include("../inc/conn.php");
  5. include("../inc/base_status.inc.php");
  6. $_SESSION["menus"]="修改管理资料";
  7. if(isset($_GET["act"]))
  8. { $act=$_GET["act"];
  9.  if($act=="add")
  10.  {
  11.  $username=$_POST["add_admin"];
  12.  $add_pwd1=$_POST["add_pwd1"];
  13.  $add_pwd2=$_POST["add_pwd2"];
  14.  $password=md5($add_pwd1);
  15.    if($username=="")
  16.    {
  17.     echo "请输入用户名!";
  18.    }elseif($add_pwd1==""||$add_pwd2=="")
  19.    {
  20.     echo "请输入用户密码!";
  21.    }elseif($add_pwd1<>$add_pwd2)
  22.    {
  23.     echo "两次密码不一致!";
  24.    }else
  25.    {
  26.    $sqls=mysql_query("insert into admin(username,password)values('$username','$password')",$conn);
  27.    if($sqls) echo "添加成功!";
  28.     mysql_query("insert into pice(contents,user_account)values('10000','$username')",$conn);
  29.    }
  30.  }elseif($act=="mod")
  31.  {
  32.  $id=$_POST["id"];
  33.  $username=$_POST["mod_admin"];
  34.  $mod_pwd1=$_POST["mod_pwd1"];
  35.  $mod_pwd2=$_POST["mod_pwd2"];
  36.  $password=md5($mod_pwd1);
  37.   if($username=="")
  38.    {
  39.     echo "请输入用户名!";
  40.    }elseif($mod_pwd1==""||$mod_pwd2=="")
  41.    {
  42.     echo "请输入用户密码!";
  43.    }elseif($mod_pwd1<>$mod_pwd2)
  44.    {
  45.     echo "两次密码不一致!";
  46.    }else
  47.    {
  48.    $sqls=mysql_query("update admin set username='$username',password='$password' where ID='$id'",$conn);
  49.    if($sqls) echo "修改成功!";
  50.    }
  51.  }elseif($act=="del")
  52.  {
  53.    $id=$_GET["id"];
  54.    mysql_query("delete from admin where ID='$id'",$conn);
  55.  }
  56. }
  57. $sqlr=mysql_query("select * from admin ",$conn);
  58. ?>
  59. <html>
  60. <head>
  61. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  62. <link href="../css/css.CSS" rel="stylesheet" type="text/css">
  63. <title></title>
  64. <style type="text/css">
  65. <!--
  66. body {
  67. margin-left: 10px;
  68. }
  69. -->
  70. </style></head>
  71. <body><br><?php include("config_menu.inc.php");?><br>
  72. <table width="645" height="82" border="0" align="left" cellpadding="0" cellspacing="0" class="tmove">
  73.   <tr>
  74.     <td height="82" valign="top"><table width="645" height="78" border="0" cellpadding="0" cellspacing="1" class="t12">
  75.       <tr class="t11">
  76.         <td width="154" height="22"><div align="center" class="fw12">用户名</div></td>
  77.         <td width="174"><div align="center" class="fw12">新密码</div></td>
  78.         <td width="197"><div align="center" class="fw12">确认密码</div></td>
  79.         <td width="120"><div align="center" class="fw12">功能</div></td>
  80.       </tr>
  81.       <?php while($rs=mysql_fetch_array($sqlr))
  82.   { ?><form name="form2" method="post" action="config_manage_info.php?act=mod&menu=4">
  83.   <tr class="t17">
  84.         <td height="28"><div align="center">
  85.           
  86.             <input name="mod_admin" type="text" class="input" id="mod_admin" value="<?=$rs["username"]?>" size="15" maxlength="15">
  87.          
  88.         </div></td>
  89.         <td><div align="center">
  90.           <input name="mod_pwd1" type="password" class="input" id="mod_pwd1" value="<?=$rs["password"]?>" size="16" maxlength="16" onClick="this.value='';">
  91.         </div></td>
  92.         <td><div align="center">
  93.           <input name="id" type="hidden" id="id" value="<?=$rs["ID"]?>">
  94.           <input name="mod_pwd2" type="password" class="input" id="mod_pwd2" value="<?=$rs["password"]?>" size="16" maxlength="16" onClick="this.value='';">
  95.         </div></td>
  96.         <td><div align="center">
  97.           <input type="submit" name="Submit" value="修改">&nbsp;
  98.          <input type="button" name="Submit2" value="删除" onClick="javascript:window.location.href='config_manage_info.php?act=del&id=<?=$rs["ID"]?>'">
  99.         </div></td>
  100.       </tr> </form><? }?> <form name="form3" method="post" action="config_manage_info.php?act=add&menu=4">
  101.       <tr class="t17">
  102.         <td height="28"><div align="center">
  103.            
  104.            
  105.             <input name="add_admin" type="text" class="input" id="add_admin" size="15" maxlength="15">
  106.         </div></td>
  107.         <td><div align="center">
  108.             <input name="add_pwd1" type="password" class="input" id="add_pwd1" size="16" maxlength="16">
  109.         </div></td>
  110.         <td><div align="center">
  111.             <input name="add_pwd2" type="password" class="input" id="add_pwd2" size="16" maxlength="16">
  112.         </div></td>
  113.         <td><div align="center">
  114.             <input type="submit" name="Submit" value="添加">
  115. &nbsp;        </div></td>
  116.       </tr> </form>
  117.     </table></td>
  118.   </tr>
  119. </table>
  120. <p>&nbsp;</p>
  121. <p>&nbsp;</p>
  122. </body>
  123. </html>