<?php
@session_start();
include('inc/conn.php');
include('checkstate.php');
include('inc/function.php');
include('fun/funcount.php');
 

 ?>
<!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 name="robots" content="noindex,nofllow">
<title><?php echo $info['company'];  ?> - 子帐户管理- ETW国际客服系统 </title>
<link rel="stylesheet" type="text/css" href="css/css.css" />

</head>

<body>
<div id="main">
    <div id="top">
       <?php include('header.php');  ?>
       <div id="logo">
       <div id="menu">
          <ul><li class="current"><a href="manage.php">系统首页</a></li>
         <li><a href="news.php">新闻</a></li>
          <li><a href="commontools.php">工具箱</a></li>
       </ul><iframe style=" float:right;" width='350' height='30' marginwidth='0' marginheight='0' hspace='0' vspace='0' frameborder='0' scrolling='No' src='http://m.weather.com.cn/m/p3/weather1.htm' name="I6"></iframe></div>
       </div>
  </div>
     <!-- left -->
     <?php include('left.php');?>
     
     <div id="right">
       <p class="title"><strong>企业信息栏 &gt;&gt; 子帐户管理</strong> </p>
       
      <p><br />
       说明：1. 子帐户以电子邮件作为用户名,主要用于"在线洽谈",<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2. 子帐户只可以阅读处理其权限内的询盘,不能阅读所有询盘信息,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3. 子帐户可以在首页登陆页面直接登陆,也可以登陆后在"在线洽谈"模板登陆.<br />
<br />
</p>

 <script type="text/javascript" src="js/checkuser.js"></script>
 <script type="text/javascript">
 function doaddchild(){
     if(document.getElementById("userstatenow").value=="ok"){
	    return true;
	 }else{
	 return false;
	 }
 }
 </script> 
      <form name="form1" method="post" action="childaccount.php" id="form1" onsubmit="return doaddchild()">
  <table width="711" style="background:#f9f9f9; width:800px; margin:0 auto;">
  
  	<tr>
  	  <td colspan="2"><div align="center"><strong>添 加 子 账 户</strong></div></td>
    </tr>
      	<tr>
    	<td width="109" align="right">公司名称:</td>
        <td width="679"><input type="text" name="companyname" id="companyname" value="<?php echo $info['company'];  ?>"  size="26"  /><!--onchange="checkcompany()"--> 
        <span style="font-size:12PX;">格式:拼音:公司电话,同一公司请用相同公司名称(例如：ETW:+86-22-61609688)</span></td>
    </tr>
  	<!--<tr>
  	  <td><div align="right">公司编号:</div></td>
  	  <td>--><input type="hidden" name="userid" id="userid" value="<?php echo $_SESSION['guestid'];?>" readonly /><!--<span>同一公司请用同一ID号,</span></td>
	  </tr>-->

  	<tr>
    	<td><div align="right">用户名:</div></td>
        <td><input type="text" name="username" id="childname" onchange="checkuser()" size="26"  /> 
          <span id="showstate" style="font-size:12PX;"> 用客户邮箱地址 </span></td>
    </tr>
  	<tr>
    	<td><div align="right">密码:</div></td>
        <td><input type="password" name="password" id="password" value="123456"  size="27"/> <span style="font-size:12PX;">默认密码为123456</span></td>
    </tr>
  	<tr>
    	<td><div align="right">确认密码:</div></td>
        <td><input type="password" name="repassword" id="repassword" value="123456" size="27" /></td>
    </tr>
  	<tr>
    	<td><div align="right">真实姓名:</div></td>
        <td><input type="text" name="realname" id="realname" size="26"  /> </td>
    </tr>

  	<tr>
    	<td><div align="right">注册时间:</div></td>
        <td><input type="text" name="regtime" value="<?php echo date("Y-m-d h:i:s")  ?>" readonly  size="26"/></td>
    </tr>
  	<tr>
    <td>    </td>
   
  	   <td><input type="submit" value="添 加 用 户" ></td>
    </tr>
  </table>
 </form>

 <?php
if(!empty($_POST['password'])&& $_POST['password']==$_POST['repassword'] )
{
	$sql="insert into chat_user(userid,username,password,realname,companyname,regtime) values(".$_POST['userid'].",'".$_POST['username']."','".md5($_POST['password'])."','".$_POST['realname']."','".$_POST['companyname']."','".$_POST['regtime']."')";
	mysql_query($sql);
	echo "<script type='text/javascript'>alert('添加成功');</script>";
	echo "<meta http-equiv='refresh' content='0' />";
}

 ?>
   <div id="con">
     子账户列表如下：<br />
     <table width="691" border="1" cellpadding="0" cellspacing="0" style=" margin:0 auto; width:600px; text-align:center">
  <tr>
    <th width="109" scope="col">序 号 </th>
    <th width="290" scope="col">真实姓名</th>
    <th width="290" scope="col">用户名</th>
    <th width="140" scope="col">操作</th>
  </tr>
  <?php  $i=1;
        $sql="select * from chat_user where userid=".$_SESSION['guestid'];
        $result=mysql_query($sql);
		while($rs=mysql_fetch_array($result)){ ?>
  <tr>
    <td><?php echo $i; $i++; ?></td>
    <td><?php echo $rs[realname]; ?></td>
    <td><?php echo $rs[username]; ?></td>
    <td><?php echo "<a href='childmanage.php?action=mod&id=".$rs[id]."'>修改</a>/<a href='childmanage.php?action=del&id=".$rs[id]."'>删除</a>";?></td>
  </tr>
  <?php } ?>
</table>

    </div>
 
 
     </div>
<div id="footer"> Copy Rright &copy; 2008-2009 ETW International <?php if( @$_SESSION["username"]<>''){?>
<input type="hidden" id="onlineu" value="<?php echo $_SESSION["username"] ?>" />
<script type="text/javascript" src="js/onlinelisten.js"></script>
<script type="text/javascript">
window.setInterval(onlinemessage,30000);
</script>
<?php } ?></div>  
</div>
<script type="text/javascript" src="js/opencommon.js"></script>
<?php mysql_close();?>
</body>
</html>
