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

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["fct"]))
  8. {
  9.  $fct=$_GET["fct"];
  10.  $id=$_GET["id"];
  11.  if($fct=="stop") mysql_query("update son_manage set deleted='1' where ID='$id'",$conn);
  12.  if($fct=="use") mysql_query("update son_manage set deleted='0' where ID='$id'",$conn);
  13. }
  14. function outscript($arr)
  15. {
  16.   echo "<script language='javascript'>alert('".$arr."');window.location.href='config_manage_son.php';</script>";
  17. }
  18. if(isset($_GET["act"]))
  19. { $act=$_GET["act"];
  20.  if($act=="add")
  21.  {
  22.  $username="am".$_POST["add_account"];
  23.  $add_pwd1=$_POST["add_pwd1"];
  24.  $add_pwd2=$_POST["add_pwd2"];
  25.  $password=md5($add_pwd1);
  26.    if($username=="")
  27.    {
  28.     outscript('请输入用户名!');
  29.    }elseif($add_pwd1==""||$add_pwd2=="")
  30.    {
  31.     outscript('请输入用户密码!');
  32.    }elseif($add_pwd1<>$add_pwd2)
  33.    {
  34.     outscript('两次密码不一致!');
  35.    }else
  36.    {
  37.      $sqp=mysql_query("select * from son_manage where account='$username'",$conn);
  38.  if(mysql_num_rows($sqp)<>0)
  39.  {
  40.   outscript('添加失败,该账号已经存在!');
  41.  }else  $sqls=mysql_query("insert into son_manage(account,password,sign)values('$username','$password','1')",$conn);
  42.    if($sqls) outscript('添加成功!');
  43.    }
  44.  }elseif($act=="mod")
  45.  {
  46.  $id=$_POST["id"];
  47.  $username=$_POST["mod_account"];
  48.  $mod_pwd1=$_POST["mod_pwd1"];
  49.  $mod_pwd2=$_POST["mod_pwd2"];
  50.  $password=md5($mod_pwd1);
  51.   if($mod_pwd1==""||$mod_pwd2=="")
  52.    {
  53.     outscript('请输入用户密码!');
  54.    }elseif($mod_pwd1<>$mod_pwd2)
  55.    {
  56.     outscript('两次密码不一致!');
  57.    }else
  58.    {
  59.    $sqls=mysql_query("update son_manage set password='$password' where ID='$id'",$conn);
  60.    if($sqls) outscript('修改成功!');
  61.    }
  62.  }elseif($act=="del")
  63.  {
  64.    $id=$_GET["id"];
  65.    mysql_query("delete from son_manage where ID='$id'",$conn);
  66.    outscript('删除成功!');
  67.  }
  68. }
  69. $sqlr=mysql_query("select * from son_manage order by id desc",$conn);
  70. ?>
  71. <html>
  72. <head>
  73. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  74. <link href="../css/css.CSS" rel="stylesheet" type="text/css">
  75. <title></title>
  76. <style type="text/css">
  77. <!--
  78. body {
  79. margin-left: 0px;
  80. }
  81. -->
  82. </style></head>
  83.  <script language="JavaScript">
  84.   <!--
  85.   function chkuser()
  86.   {
  87.   var uname;
  88.   uname="am"+myform.add_account.value;
  89. if (myform.add_account.value=="") 
  90. {
  91. alert("您还没有输入账号!");
  92. myform.add_account.focus();
  93. return false;
  94. }
  95. else
  96. {
  97. window.open("isson.php?searchuser=" + uname ,"","width=2,height=2,top=1000,left=5000");
  98. }
  99.   }
  100.   //-->
  101. </script>
  102. <body oncontextmenu="return false" onselectstart="return false" 
  103. onkeydown="return (event.ctrlKey &amp;&amp; event.keyCode == 78) ? false : true" 
  104. ondragstart="return false" onmouseover="window.status=''; return true">
  105. <table width="100%" height="82" border="0" align="left" cellpadding="0" cellspacing="0" class="tmove">
  106.   <tr>
  107.     <td height="82" valign="top"><table width="100%" height="78" border="0" cellpadding="0" cellspacing="1" class="t12">
  108.       <tr class="t11">
  109.         <td width="127" height="22"><div align="center" class="fw12">子账号</div></td>
  110.         <td width="132"><div align="center" class="fw12">新密码</div></td>
  111.         <td width="140"><div align="center" class="fw12">确认密码</div></td>
  112.         <td width="70"><div align="center"><span class="fw12">状态</span></div></td>
  113.         <td width="170"><div align="center" class="fw12">功能</div></td>
  114.       </tr>
  115.       <?php while($rs=mysql_fetch_array($sqlr))
  116.   { ?><form name="form2" method="post" action="config_manage_son.php?act=mod&menu=8">
  117.   <tr class="t17">
  118.         <td height="28"><div align="center">
  119.           
  120.        <?=$rs["account"]?> </div></td>
  121.         <td><div align="center">
  122.           <input name="mod_pwd1" type="password" class="input" id="mod_pwd1" value="<?=$rs["password"]?>" size="16" maxlength="16" onClick="this.value='';">
  123.         </div></td>
  124.         <td><div align="center">
  125.           <input name="id" type="hidden" id="id" value="<?=$rs["ID"]?>">
  126.           <input name="mod_pwd2" type="password" class="input" id="mod_pwd2" value="<?=$rs["password"]?>" size="16" maxlength="16" onClick="this.value='';">
  127.         </div></td>
  128.         <td><div align="center"><?
  129.  if($rs["deleted"]=="1")
  130.  {
  131.  echo "<a href='config_manage_son.php?fct=use&id=".$rs["ID"]."&act=uselist'>停用</a>";
  132.  }else
  133.  {
  134.  echo "<a href='config_manage_son.php?fct=stop&id=".$rs["ID"]."&act=stoplist'>启用</a>";
  135.  }
  136.  ?></div></td>
  137.         <td><div align="center">
  138.           <input type="submit" name="Submit" value="修改">&nbsp;<input type="button" name="Submit4" value="权限" onClick="javascript:window.location.href='config_manage_son_details.php?user=<?=$rs["account"]?>&id=<?=$rs["ID"]?>'">&nbsp;<input type="button" name="Submit2" value="删除" onClick="javascript:window.location.href='config_manage_son.php?act=del&id=<?=$rs["ID"]?>'">
  139.         </div></td>
  140.       </tr> </form><? }?> <form name="myform" method="post" action="config_manage_son.php?act=add&menu=8">
  141.       <tr class="t17">
  142.         <td height="28"><div align="center">am
  143.             <input name="add_account" type="text" class="input" id="add_account" size="15" maxlength="15">
  144.         </div></td>
  145.         <td><div align="center">
  146.             <input name="add_pwd1" type="password" class="input" id="add_pwd1" size="16" maxlength="16">
  147.         </div></td>
  148.         <td><div align="center">
  149.             <input name="add_pwd2" type="password" class="input" id="add_pwd2" size="16" maxlength="16">
  150.         </div></td>
  151.         <td>&nbsp;</td>
  152.         <td><div align="center">
  153.             <span class="fbred">&nbsp;<input type="button" name="Submit3" value="检测" onClick="chkuser();"></span>&nbsp;<input type="submit" name="Submit" value="添加">
  154.         </div></td>
  155.       </tr> </form>
  156.     </table></td>
  157.   </tr>
  158. </table>
  159. <p>&nbsp;</p>
  160. <p>&nbsp;</p>
  161. </body>
  162. </html>