<?php
session_start();
mb_http_input("utf-8");
mb_http_output("utf-8");
require "q/global.php";
require "q/function.php";
require "q/word-wrap.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" />
<title>lyb</title>
<style>
body{margin:0;padding:0; font-family:Arial, Helvetica, sans-serif; font-size:14px;teat-align:center;}
.atab{clear:both;margin:0 auto;border-collapse:collapse}
h1{text-align:center;}
p{margin:0;padding:2px}
a{color:blue}
/*
.usem{}
.usem b{float:left;width:34%;}
.usem span{float:left;width:66%;text-align:left}
*/
.content{padding:0 2%;overflow:auto;line-height:24px;word-break:break-all;}/*/text-indent:24px*/
.uinfo{height:30px;line-height:30px;color:#999;font-size:12px}
.uinfo span{padding:0 8px;background:url(q/i.gif) no-repeat 50% 50%}
.ql{clear: both;border-bottom: 1px dashed #c2c3ba;padding:10px 0}
.feng{padding:5px 0;text-align:right}
.gl,.gl2{border:1px solid #e1e1e1;width:98%;padding:1%}
.gl2{background-color:#FFFDEE}
</style>
<script>
<!--
classid=<?=$classid?>;
//-->
</script>
</head>
<body>
<div id="box" style="width:<?=$cssWidth?>px;margin:0 auto;overflow:hidden">
<h1><?php
if($classid){
//此位置可以放入的类别或文章内容
}
if($type)
echo "评 论";
else
echo "留 言";
?>
<span style="float:right;font-size:12px;font-weight:normal">
<?php
$cheus=false;
if($_SESSION["c_u"]!=""&&$_SESSION["c_p"]!=""&&$_SESSION["c_c"]!=""){
echo "管理员:";
echo $_SESSION["c_u"];
echo " <a href=\"q/admin_login.php?a=out\">退出</a>";
$cheus=true;
}else{
echo "<a href=\"q/admin_login.php\">管理</a>";
}
?>
</span>
</h1>
<table border="1" cellpadding="6" bordercolor="#6699CC" class="atab" width="<?=($cssWidth-2)?>">
<?php
$cf=new check;
$w=new my_wordwrap;
$PageSize=$pagesize;
$page=$_GET["page"];
if($page==""){
$page=1;
}else{
if(!is_numeric($page)){$page=1;}
$page=intval($page);
if($page<1){
$page=1;
}
}
//获得总记录数
$sql="select count(*) as scount from ".$db_prefix."content where classid=".$classid;
$result=$DB->query($sql);
$myrow=$DB->fetch_array($result);
$count=$myrow['scount'];//总记录数
mysql_free_result($result);//释放所有结果集
if($count){
$page_count=ceil($count/$PageSize);//总分页
if($page>$page_count){$page=$page_count;}
$pages=intval($count/$PageSize);
if($count%$PageSize){
$pages++;
}
//设置页数
if(isset($page)){
$page=intval($page);
}else{
$page=1;
}
//计算记录偏移量
$offset=$PageSize*($page-1);
if($type){
$sql="select * from ".$db_prefix."content where classid=".$classid." order by adddate desc,ding desc,renum desc limit ".$offset.", $PageSize";
}else{
$sql="select * from ".$db_prefix."content where topid=0 and classid=".$classid." order by adddate desc,ding desc,renum desc limit ".$offset.", $PageSize";
}
$result=$DB->query($sql);
echo "<tr><td width='100%'>";
while($row=$DB->fetch_array($result)){
$gip="";
echo "<div id=\"l_".$row['int']."\" class=\"ql\">";;
echo "<div class=\"gl\">";
$renum=$row['renum'];
$ints=$row['int'];
$mk=0;
$tdata="";$mydata2="";
if($row['topid']!='0'&&$row['renum']==0&&$type){
$topidstr=$row['topidstr'].",".$row['topid'];
$topid_array=explode(',',$topidstr);
$topidcount=count($topid_array);
$mydata="";
$i=$topidcount;
while($i>=0){
$mk++;
$i--;
if(!$topid_array[$i]){break;}
$sql2="select * from ".$db_prefix."content where `int`=".$topid_array[$i];
$result2=$DB->query($sql2);
$row2=$DB->fetch_array($result2);
if(!$row2){
//echo $topid_array[$i];
/*
if($row['topidstr']==0){
$sql3="update ".$db_prefix."content set topid=0,level=0 where `int`=".$row['int'];
}else{
$stopid=$topid_array[$i-1];
if(!$stopid){$stopid=0;}
$sql3="update ".$db_prefix."content set topid='".$stopid."',topidstr='".str_replace(',,','',str_replace($topid_array[$i],'',$row['topidstr']))."' where `int`=".$row['int'];
}
$DB->query($sql3);
*/
//break;
}
$ints=$row2['topid'];
$mydata="<div class=\"gl2\" id=\"l_".$row['int']."_".$i."\">";
$mydata=$mydata."|restr|";
$mydata=$mydata."<div align=\"left\" class=\"uinfo\"><table width=\"100%\"><tr><td>";
$mydata=$mydata."Date:".date('Y-m-d H:i',$row2['adddate'])."<span> </span>";
$mydata=$mydata."Nickname:";
if($row2['username']!=""){
$mydata=$mydata.$row2['username'];
}else{
$mydata=$mydata."Null";
}
if($row2['ip']!=""){
$ip=explode('.',$row2['ip']);
$gip=$ip[0].'.'.$ip[1].'.';
if($cheus){
$gip.=$ip[2].'.'.$ip[3];
}else{
$gip.='*.*';
}
$gip="<a href=\"http://open.baidu.com/ipsearch/s?wd=".$gip."&tn=baiduip\" target=\"_blank\">".$gip."</a>";
}else{
$gip.="*.*.*.*";
}
$mydata=$mydata."<span> </span>IP:".$gip;
if($cheus){
$mydata=$mydata."<span> </span>Email:";
if($row2['email']){
$mydata=$mydata."<a href=\"mailto:".$row2['email']."\">".$row2['email']."</a>";
}else{
$mydata=$mydata."Null";
}
//$mydata=$mydata." <a href=\"javascript:void(0)\" onclick=\"edit('".$row2['int']."_".$i."')\">修改</a>";// | <a href=\"javascript:void(0)\" onclick=\"del('".$row2['int']."_".$i."')\">删除</a>";
}
$mydata=$mydata."</td><td align=\"right\">";
if($row['topidstr']=='0'){
$mydata=$mydata.$i;
}else{
$mydata=$mydata.($i+1);
}
$mydata=$mydata."</td></tr></table>";
$mydata=$mydata."</div>";
$mydata=$mydata."<div class=\"content\" id=\"content_".$row2['int']."_".$i."\">";
$mydata=$mydata.$w->word_wrap($row2['content'],$wrapLen,"<br />\n");
$mydata=$mydata."</div>";
$mydata=$mydata."</div>";
if($i<$topidcount-1){
$tdata=str_replace("|restr|",$mydata,$tdata);
}else{
$tdata=$mydata;
}
}
}elseif($row['topid']==0&&$row['renum']>0){
$sql2="select * from ".$db_prefix."content where isadmin=1 and topid=".$row['int']." limit 1";
$result2=$DB->query($sql2);
$row2=$DB->fetch_array($result2);
if($row2){
$mydata2="<div class=\"gl2\" id=\"l_".$row['int']."_".$i."\">";
$mydata2=$mydata2."<div align=\"left\" class=\"uinfo\"><font style=\"color:#000;font-weight:bold\">回复</font> ";
$mydata2=$mydata2."Date:".date('Y-m-d H:i',$row2['adddate'])."<span> </span>";
$mydata2=$mydata2."<a href=\"javascript:void(0)\" onclick=\"edit('".$row2['int']."_".$i."')\">修改</a><span> </span><a href=\"javascript:void(0)\" onclick=\"del('".$row2['int']."_".$i."')\">删除</a>";
$mydata2=$mydata2."</div>";
$mydata2=$mydata2."<div class=\"content\" id=\"content_".$row2['int']."_".$i."\">";
$mydata2=$mydata2.$w->word_wrap($row2['content'],$wrapLen,"<br />\n");
$mydata2=$mydata2."</div>";
$mydata2=$mydata2."</div>";
}
}
if($tdata!=""){$tdata=str_replace("|restr|",'',$tdata);}
echo $tdata;
//if ($r++>1){exit;}
echo "<div align=\"left\" class=\"uinfo\">";
echo "Date:".date('Y-m-d H:i',$row['adddate'])."<span> </span>";
echo "Nickname:";
if($row['username']!=""){
echo $row['username'];
}else{
echo "Null";
}
if($row2['ip']!=""){
$ip=explode('.',$row2['ip']);
$gip=$ip[0].'.'.$ip[1].'.';
if($cheus){
$gip.=$ip[2].'.'.$ip[3];
}else{
$gip.='*.*';
}
$gip="<a href=\"
- 1
- 2
前往页