<?php
	session_start(); 
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/check.php');
	$opendb=new mydb();
	require_once('inc/char_set.php');
	
	$statisticsUrl=$_POST['statisticsUrl'];
	$statisticsName=$_POST['statisticsName'];
	$statisticsPsd=$_POST['statisticsPsd'];
	
	$onlinechartName=$_POST['onlinechartName'];
	$onlinechartPsd=$_POST['onlinechartPsd'];
	
	$ls=$_POST['ls']; 
	
	switch($ls)
	{
		case "insert":
			$select_sql="select * from ls_functioncode ";
			$select_query=$opendb->query($select_sql);
			
			while ($select_rows = mysql_fetch_assoc($select_query)){
				switch($select_rows['codeID']){
					case "statistics":  //访问统计
						$update_sql=sprintf("update ls_functioncode set codeURLusername=%s, codeURLpsw=%s where codeID=%s", 
							GetSQLValueString($statisticsName, "text"),
							GetSQLValueString($statisticsPsd, "text"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "onlinechartUrl":  //在线客服
						$update_sql=sprintf("update ls_functioncode set codeURLusername=%s, codeURLpsw=%s where codeID=%s", 
							GetSQLValueString($onlinechartName, "text"),
							GetSQLValueString($onlinechartPsd, "text"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
				}
			}
			break;
	}
	
	$select_sql="select * from ls_functioncode ";
	$select_query=$opendb->query($select_sql);
	
	while ($select_rows = mysql_fetch_assoc($select_query)){
		switch($select_rows['codeID']){
			case "statistics":  //访问统计
				$statisticsName2=$select_rows['codeURLusername'];
				$statisticsPsd2 = $select_rows['codeURLpsw'];
				$statisticsCodeURL2 = $select_rows['codeURL'];
			break;
			case "onlinechartUrl":  //在线客服
				$onlinechartName2=$select_rows['codeURLusername'];
				$onlinechartPsd2 = $select_rows['codeURLpsw'];
				$onlinechartUrl2 = $select_rows['codeURL'];
			break;
		}
	}
	
	$ls_msg="访问统计";
	
?>
<!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">
<link href="css/admin.css" rel="stylesheet" type="text/css">
<title>无标题文档</title>
</head>

<body>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#6396D6">
  <tr> 
	<td height="18" background="images/admin_bg.gif"><div align="center"><font color="#FFFFFF"><strong>常用入口</strong></font></div></td>
  </tr>

  <tr>
  	<td bgcolor="#E8F1FF" valign="top" align="center">
	<br>
		<form name="form1" method="post" action="statistics.php">
        <input type="hidden" value="insert" name="ls">
        <table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
          <tr bgcolor="#B9DAFF">
            <td width="5%" align="center">序号</td>
            <td width="8%" align="center">类型</td>
            <td width="33%" align="center">用户名</td>
            <td width="33%" align="center">密码</td>
            <td height="28" colspan="2" align="center"   >操作</td>
          </tr>
          <tr bgcolor="#f4f4f4">
            <td width="5%" align="center">1</td>
            <td width="8%" align="center">访问统计 </td>
            <td width="33%" align="center" style="padding-left:10px;" ><input type="text" value="<?php echo $statisticsName2;?>" name="statisticsName" style="width:200px;" ></td>
            <td width="33%" align="center" style="padding-left:10px;" > <input type="text" value="<?php echo $statisticsPsd2;?>" name="statisticsPsd" style="width:200px;" ></td>
            <td width="21%" align="center"><input type="button" onclick="window.open('<?=$statisticsCodeURL2?>')" value="查看统计" /></td>
          </tr>
          <tr bgcolor="#f4f4f4">
            <td align="center">2</td>
            <td align="center">在线客服</td>
            <td align="center" style="padding-left:10px;" ><input type="text" value="<?php echo $onlinechartName2;?>" name="onlinechartName" style="width:200px;" ></td>
            <td align="center" style="padding-left:10px;" ><input type="text" value="<?php echo $onlinechartPsd2;?>" name="onlinechartPsd" style="width:200px;" ></td>
            <td width="21%" align="center"><input type="button" onclick="window.open('<?=$onlinechartUrl2?>')" value="登录客服"></td>
          </tr>
          <tr bgcolor="#f4f4f4">
            <td colspan="5" align="center"><input type="submit" value="确定" /></td>
          </tr>
         </table>
	  </form>
	<br>
	</td>
 </tr>
</table>

</body>
</html>
