<?php
$action=_get('action');
if($action=="")
$action=_post('action');
$id=_get('id');
if($id=="")
$id=_post('id');

include("qs.php");
require( '../data/config.php');
$conn=mysql_connect($db_host,$db_user,$db_pass);
mysql_query("set names 'utf8'");
mysql_select_db($db_name);
if (PHP_VERSION >= '5.1' && !empty($timezone))
{
    date_default_timezone_set($timezone);
}
if($action=="del")
 {
if(isset($_POST['chkkindid']) && is_array($_POST['chkkindid'])){
foreach($_POST['chkkindid'] as $tempid){
$exec="delete from tm_admin where id=".$tempid;
mysql_query($exec);
}
} 
 echo "<script>location.href='menber.php';</script>";
 exit();
 }
elseif($action=="tj")
 {

if(isset($_POST['chkkindid']) && is_array($_POST['chkkindid'])){
foreach($_POST['chkkindid'] as $tempid){
$exec="update tm_admin set show1=1 where id=".$tempid;
mysql_query($exec);
}
} 

 echo "<script>location.href='menber.php';</script>";
 exit();
 }
elseif($action=="utj")
 {
 
if(isset($_POST['chkkindid']) && is_array($_POST['chkkindid'])){
foreach($_POST['chkkindid'] as $tempid){
$exec="update admin set show1=0 where art_id=".$tempid;
mysql_query($exec);
}
}  
 echo "<script>location.href='menber.php';</script>";
 exit();
 }
elseif($action=="edit")
{
$pass=md5($_POST[pass]);
$dian=$_POST[dian];
if($_POST[pass]<>"")
$sql="update tm_admin set pass='$pass',dian='$dian' where id='$id'";
else
$sql="update tm_admin set dian='$dian' where id='$id'";
mysql_query($sql);
echo "<script>location.href='menber.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=UTF-8" />
<META http-equiv="Pragma" content="no-cache" />
<LINK href="css/general.css" rel="stylesheet" type="text/css" />
<LINK href="css/main.css" rel="stylesheet" type="text/css" />
</HEAD><BODY>
<div class="h2">系统管理 >> 会员管理 >> <?php if($id=="") echo "添加";else echo "编辑";?></div>
<div class="list-div">

<table cellspacing='1' cellpadding='3'>
<tr>
  <th align='left'><table width="100" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><div align="left">&nbsp;&nbsp;会员管理</div></td>
        <td width="150">&nbsp;</td>
      </tr>
    </table></th>
</tr>
<tr><td align="left" valign="top" style="background:#F5F5F5;padding-bottom:8px;">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 
            CALLPADDING="0">
              <TBODY>
			                <TR BORDER="0" WIDTH="100%">
                <TD style="PADDING-LEFT: 8px; PADDING-TOP: 8px" vAlign=top 
                align=left width="100%" bgColor=#ffffff height=30>
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="85%"><img src="images/url_01.gif" width="7" height="10" />&nbsp;<?php if($id=="") echo "<strong>添加</strong>";else echo "<strong>编辑</strong>";?></td>
                    <td width="15%">&nbsp;</td>
                  </tr>
                </table>				 </TD>
              </TR>
 <?php 
if($action=="" and $id<>"")
{
$sql="select * from tm_admin where id='$id'";
$rsql=mysql_query($sql);
$rs=mysql_fetch_object($rsql);
if(!$rs)
   {
   echo "<script>alert('无相关会员!');location.href='art.php'</script>";
   exit();
   }
 ?>
 <form id="form1" name="form1" method="post" action="menber_w.php">
			<TR BORDER="0" WIDTH="100%">
			                  <TD height="20"><span style="PADDING-LEFT: 8px; PADDING-TOP: 8px">用户名：
                                  <input name="user" type="text" id="user" value="<?php echo $rs->user;?>" size="50" disabled="disabled" />
              </span>			                  </TD>
    </TR>
		<TR BORDER="0" WIDTH="100%">
			                  <TD height="20"><span style="PADDING-LEFT: 8px; PADDING-TOP: 8px">密　码：
                                  <input name="pass" type="text" id="pass" size="50" />
          </span>			                  </TD>
    </TR>
			<TR BORDER="0" WIDTH="100%">
			                  <TD height="20"><span style="PADDING-LEFT: 8px; PADDING-TOP: 8px">点　数：
                                  <input name="dian" type="text" id="dian" value="<?php echo $rs->dian;?>" size="50" />
              </span>			                  </TD>
    </TR>
			<TR BORDER="0" WIDTH="100%">
                <TD style="PADDING-LEFT: 8px; PADDING-TOP: 8px" vAlign=top 
                align=left bgColor=#ffffff height=30><span class="help">
                  <input type="image" 
                        src="images/submit.gif" align="absmiddle" border="0" 
                        name="submit" onclick="return checkform(this.form)" />
                  <input name="action" type="hidden" id="action" value="edit" />
                  <input name="id" type="hidden" id="id" value="<?php echo $id;?>" />
                </span></TD>
              </TR>
 </form>
 <?PHP }
 ?>
      </TABLE>
</td>
</tr></table></div>

<?php include "boot.php";?>
</body></html>