<?
session_start();
require_once "../init.php";
require_once "../authority.inc.php";
if($_POST['UserName'] != '')
{
	$UserName = $_POST['UserName'];
}
else
{
	$UserName = $_GET['UserName'];
}
if($_POST['backUrl'] != '')
{
	$backUrl = $_POST['backUrl'];
}
else
{
	$backUrl = $_GET['backUrl'];
}
if($_POST['key'] != '')
{
	$key = $_POST['key'];
}
else
{
	$key = $_GET['key'];
}
$Edit = $_POST['Edit'];
$iStatus = $_POST['iStatus'];
$Company_GB = $_POST['Company_GB'];
$dtCreate = $_POST['dtCreate'];
$dtLogin = $_POST['dtLogin'];
$iLevel = $_POST['iLevel'];
$Company_EN = $_POST['Company_EN'];
$Country = $_POST['Country'];
$Province_GB = $_POST['Province_GB'];
$City_GB = $_POST['City_GB'];
$Addr_GB = $_POST['Addr_GB'];
$Addr_EN = $_POST['Addr_EN'];
$PostCode = $_POST['PostCode'];
$Contact_GB = $_POST['Contact_GB'];
$Contact_EN = $_POST['Contact_EN'];
$Tel = $_POST['Tel'];
$Fax = $_POST['Fax'];
$Email = $_POST['Email'];


if(!CheckHashKey('users'.$UserName,$key)){
   $DB->close();
   die("非法入侵");
}
$sql = "select * from users where UserName='$UserName'";
$UserInfo = $DB->getdata($sql);

$UserLevel = explode(",",$_CFG[AgentType]);
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/favicon.ico" >
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/admin/lib/html5.js"></script>
<script type="text/javascript" src="/admin/lib/respond.min.js"></script>
<script type="text/javascript" src="../lib/PIE_IE678.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/admin/lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="admin/static/h-ui.admin/js/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>修改会员</title>
<LINK href="../share/style.css" rel=stylesheet>
<script src='../share/global.js'></script>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 会员管理 <span class="c-gray en">&gt;</span> 会员详情<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>

</div><div class="page-container">
<!--子导航-->
<? include "user_nav.inc.php"?>
<!--结束-->
<table border="0" cellpadding="0" cellspacing="0" class="table">
  <tr>
    <td height="128" valign="top" align="center">
	  <?
	  if($Edit==1){
		  $sql="update users set Company_GB='$Company_GB',".
			   "Company_EN='$Company_EN',Contact_GB='$Contact_GB',Contact_EN='$Contact_EN',".
			   "Country='$Country',Province_GB='$Province_GB',City_GB='$City_GB',Addr_GB='$Addr_GB',".
			   "Addr_EN='$Addr_EN',PostCode='$PostCode',Email='$Email',Tel='$Tel',Fax='$Fax',".
			   "iLevel='$iLevel',iStatus ='$iStatus' where UserName='$UserName'";
		  $DB->query($sql);
		  echo "<br><br><br>修改会员 $UserName 成功";
		  echo "<br><br><br><a href='$backUrl'> [ 返 回 ]</a>";
	  }else{ 
	  ?>
	  	<form action="user_edit.php" method="post">		 
        <table   border="0" cellspacing="0" cellpadding="0" align="center" class="table table-border table-bordered table-bg table-hover table-sort">
            <tr>
              <td height="29" colspan="2" align="center">
			  <center id="link">
			  修改客户信息 |
			  <a href='../financial/financial_add.php?UserName=<?=$UserName?>&ukey=<?=md5($UserName)?>&backUrl=<?=urlencode($backUrl)?>'>录款给客户</a>|
			    <a href="../financial/financial_user_record.php?UserName=<?=$UserName?>&key=<?=GetHashKey("users".$UserName)?>">财务记录</a> |
				<a href='../products/product_list.php?UserName=<?=$UserName?>'>产品管理</a> 
				 | 
				<a href='../../user/login.php?UserName=<?=$UserName?>&Password=<?=urlencode($UserInfo[Password])?>' target="_blank">进入会员中心</a>
			  </center>
			  </td>
            </tr>
			<tr id='tr'>
			  <td colspan='2' bgcolor="#EEEEEE"> 基本信息 </td>
			</tr>
			<tr>
			  <td align="right"> 用户名: </td>
			  <td><input name="UserName" value="<?=$UserInfo[UserName]?>" type="text" class="inputline" readonly>(此项不可修改)</td>
			</tr>
			<!--<tr>
			  <td align="right"> 密码: </td>
			  <td><input name="Password" value="<?=$UserInfo[Password]?>" type="text" class="inputline"></td>
			</tr>-->
            <tr>
			  <td align="right"> 注册时间: </td>
			  <td><input name="dtCreate" value="<?=$UserInfo[dtCreate]?>" type="text" class="inputline" readonly title="此项不可修改"></td>
			</tr>
			<tr>
			  <td align="right"> 最后登录: </td>
			  <td><input name="dtLogin" value="<?=$UserInfo[dtLogin]?>" type="text" class="inputline" readonly title="此项不可修改"></td>
			</tr>
			<tr>
			  <td align="right"> 会员级别: </td>
			  <td>
                <select name='iLevel'>
			      <option value='0'><?=$UserLevel[0]?$UserLevel[0]:"普通会员"?></option>
				  <option value='1' <?if($UserInfo[iLevel]==1)echo "selected"?>><?=$UserLevel[1]?$UserLevel[1]:"一级代理"?></option>
				  <option value='2' <?if($UserInfo[iLevel]==2)echo "selected"?>><?=$UserLevel[2]?$UserLevel[2]:"二级代理"?></option>
				  <option value='3' <?if($UserInfo[iLevel]==3)echo "selected"?>><?=$UserLevel[3]?$UserLevel[3]:"三级代理"?></option>
				  <option value='4' <?if($UserInfo[iLevel]==4)echo "selected"?>><?=$UserLevel[4]?$UserLevel[4]:"四级代理"?></option>
				  <option value='5' <?if($UserInfo[iLevel]==5)echo "selected"?>><?=$UserLevel[5]?$UserLevel[5]:"五级代理"?></option>
				  <option value='6' <?if($UserInfo[iLevel]==6)echo "selected"?>><?=$UserLevel[6]?$UserLevel[6]:"六级代理"?></option>
			   </select>
			  </td>
			</tr>
			<tr>
			  <td align="right"> 帐号状态: </td>
			  <td>
                <select name='iStatus'>
			      <option value='0'>禁用</option>
				  <option value='1' <?if($UserInfo[iStatus]==1)echo "selected"?>>正常</option>
			   </select>
			  </td>
			</tr>
			<tr id='tr'>
			  <td colspan='2' bgcolor="#EEEEEE" class='eng'> 联系信息 </td>
			</tr>
            <tr>
			  <td align="right"> 单位名称(中文): </td>
			  <td><input name="Company_GB" value="<?=$UserInfo[Company_GB]?>" type="text" class="inputline" size="50" maxlength="50"><br /><span class="gray">个人注册需填写个人姓名,单位注册需填写中文单位名称</span></td>
			</tr>
			<tr>
			  <td align="right"> 单位名称(英文): </td>
			  <td><input name="Company_EN" value="<?=$UserInfo[Company_EN]?>" type="text" class="inputline" size="50" maxlength="50"><br /><span class="gray">个人注册需填写个人姓名,单位注册需填写英文单位名称,没有英文名称请填写拼音</span></td>
			</tr>
			<tr>
			  <td align="right"> 国家: </td>
			  <td style="padding"><input name="Country" value="<?=$UserInfo[Country]?>" type="text" class="inputline" size="2" maxlength="2">
				  <br /><span class="gray">(请用两位大写英文字母表示,如"CN"代表中国)</span></td>
			</tr>
			<tr>
			  <td align="right"> 省份: </td>
			  <td><input name="Province_GB" value="<?=$UserInfo[Province_GB]?>" type="text" class="inputline"></td>
			</tr>
			<tr>
			  <td align="right"> 城市: </td>
			  <td><input name="City_GB" value="<?=$UserInfo[City_GB]?>" type="text" class="inputline" size="30"></td>
			</tr>
			<tr>
			  <td align="right"> 通讯地址(中文): </td>
			  <td><input name="Addr_GB" value="<?=$UserInfo[Addr_GB]?>" type="text" class="inputline" size="50" maxlength="100"></td>
			</tr>
			<tr>
			  <td align="right"> 通讯地址(英文): </td>
			  <td><input name="Addr_EN" value="<?=$UserInfo[Addr_EN]?>" type="text" class="inputline" size="50" maxlength="100"></td>
			</tr>
			<tr>
			  <td align="right"> 邮政编码: </td>
			  <td><input name="PostCode" value="<?=$UserInfo[PostCode]?>"type="text" class="inputline" size="10" maxlength="10"></td>
			</tr>
			<tr>
			  <td align="right"> 联系人姓名(中文): </td>
			  <td><input name="Contact_GB" value="<?=$UserInfo[Contact_GB]?>"type="text" class="inputline" size="20" maxlength="20"></td>
			</tr>
			<tr>
			  <td align="right"> 联系人姓名(英文): </td>
			  <td><input name="Contact_EN" value="<?=$UserInfo[Contact_EN]?>" type="text" class="inputline" size="20" maxlength="20">
				  <br /><span class="gray">(姓和名之间请空格,姓与名均不得少于两个字)</span></td>
			</tr>
			<tr>
			  <td align="right"> 电 话: </td>
			  <td><input name="Tel" value="<?=$UserInfo[Tel]?>" type="text" class="inputline" size="30" maxlength="30"><br /><span class="gray">格式如:+国家码.区位码电话号码,如+86.75583146589 区码前不要加"0"</span></td>
			</tr>
			<tr>
			  <td align="right"> 传 真: </td>
			  <td><input name="Fax" value="<?=$UserInfo[Fax]?>" type="text" class="inputline" size="30" maxlength="30"><br /><span class="gray">格式如:+国家码.区位码电话号码,如+86.75583146589 区码前不要加"0"</span></td>
			</tr>
			<tr>
			  <td align="right"> 电子邮件: </td>
			  <td><input name="Email" value="<?=$UserInfo[Email]?>" type="text" class="inputline" size="30" maxlength="30"></td>
			</tr>
            <tr>
              <td colspan='2' align='center'>
			      <input name="submit" type="submit" class="bt2" value="提  交">
				  &nbsp;&nbsp;&nbsp;
				  <input name="reset" type="button" class="bt2" value="返  回" onClick="location='<?=$backUrl?>'">
			      <input name="Edit" type="hidden" value="1">
				  <input name="backUrl" type="hidden" value="<?=$backUrl?>">
				  <input name="key" type="hidden" value="<?=$key?>">

			  </td>
            </tr>
        </table>
		</form>
	<?}?>
   </td>
  </tr>
</table>
</div>
<? 
$DB->close();
include "../share/bottom.php"?>
</body>
</html>
