<?php
require("../../class/connect.php");
if(!defined('InEmpireCMS'))
{
	exit();
}
require("../../class/db_sql.php");
require("../../class/q_functions.php");
require "../".LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
//分类id
$bid=(int)$_GET['bid'];
$gbr=$empire->fetch1("select bid,bname,groupid from {$dbtbpre}enewsgbookclass where bid='$bid'");
if(empty($gbr['bid']))
{
	printerror("EmptyGbook","",1);
}
//权限
if($gbr['groupid'])
{
	include("../../member/class/user.php");
	$user=islogin();
	include("../../data/dbcache/MemberLevel.php");
	if($level_r[$gbr[groupid]][level]>$level_r[$user[groupid]][level])
	{
		echo"<script>alert('您的会员级别不足(".$level_r[$gbr[groupid]][groupname].")，没有权限提交信息!');history.go(-1);</script>";
		exit();
	}
}
esetcookie("gbookbid",$bid,0);
$bname=$gbr['bname'];
$search="&bid=$bid";
$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$start=0;
$line=$public_r['gb_num'];//每页显示条数
$page_line=10;//每页显示链接数
$offset=$start+$page*$line;//总偏移量
$totalnum=(int)$_GET['totalnum'];
if($totalnum>0)
{
	$num=$totalnum;
}
else
{
	$totalquery="select count(*) as total from {$dbtbpre}enewsgbook where bid='$bid' and checked=0";
	$num=$empire->gettotal($totalquery);//取得总条数
}
$search.="&totalnum=$num";
$query="select lyid,name,email,`mycall`,lytime,lytext,retext from {$dbtbpre}enewsgbook where bid='$bid' and checked=0";
$query=$query." order by lyid desc limit $offset,$line";
$sql=$empire->query($query);
$listpage=page1($num,$line,$page_line,$start,$page,$search);
$url="<a href='".ReturnSiteIndexUrl()."'>".$fun_r['index']."</a>&nbsp;>&nbsp;".$fun_r['saygbook'];
?>
<!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" />
<title>在线留言咨询</title>
<link href="/themes/style/default.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body{background:#fff;}
</style>
</head>

<body>

<form action="../../enews/index.php" method="post" name="form1" id="form1">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="guesttable">
  <tr>
    <td class="tdtitle">请您留言</td>
  </tr>
<tr>
<td class="tdcon">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="220" height="30">姓名：<input name="name" type="text" id="name" class="leftin" /> *</td>
    <td rowspan="3"><textarea name="lytext" cols="50" rows="8" id="lytext" class="rightin"></textarea></td>
  </tr>
  <tr>
    <td  height="30">邮箱：<input name="email" type="text" id="email" class="leftin" /> *</td>
    </tr>
  <tr>
    <td height="30">电话：<input name="call" type="text" id="call" class="leftin" /></td>
    </tr>
  <tr>
    <td colspan="2" align="center" height="40"><input type="submit" name="Submit3" value="提交" class="button" />
											<input type="reset" name="Submit22" value="重置" class="button" />
											<input name="enews" type="hidden" id="enews" value="AddGbook" /></td>
    </tr>
</table>

</td>
</tr>
</table></form>

<?
while($r=$empire->fetch($sql))
{
	$r['retext']=nl2br($r[retext]);
	$r['lytext']=nl2br($r[lytext]);
?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="guesttable">
  <tr>
    <td class="tdtitle"><?=$r[name]?> 于 <?=$r[lytime]?> 留言咨询</td>
  </tr>
  <tr>
    <td class="tdcon"><?=$r[lytext]?>
<?
if($r[retext])
{
?>
<div class="huifu">管理员回复：<?=$r[retext]?></div>
<?
}
?></td>
  </tr>
</table>

<?
}
?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="guesttable">
<tr>
<td class="tdpage">分页：<?=$listpage?></td>
</tr>
</table>

</body>
</html>

<?php
db_close();
$empire=null;
?>