⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comguestbook.php

📁 强大的PHP内容管理系统尽量不要让站长把时间都花费在为您修正说明上。压缩包解压
💻 PHP
字号:
<?php
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/com_config.php");


$dsql = new DedeSql(false);

if(empty($pagesize)) $pagesize = 5;
if(empty($pageno)) $pageno = 1;
if(empty($dopost)) $dopost = '';
if(empty($orderby)) $orderby = 'aid';

//重载列表
if($dopost=='getlist'){
	PrintAjaxHead();
	GetList($dsql,$pageno,$pagesize,$orderby);
	$dsql->Close();
	exit();
}
//删除留言
if($dopost=='del')
{
	if(!empty($aid)){
	   $aid = ereg_replace("[^0-9]","",$aid);
	   $dsql->ExecuteNoneQuery("Delete From #@__member_guestbook where aid='$aid' And mid='".$cfg_ml->M_ID."'; ");
  }else if(!empty($ids)){
  	$ids = explode(',',$ids);
  	$idsql = "";
  	foreach($ids as $aid){
  		$aid = ereg_replace("[^0-9]","",$aid);
  		if(empty($aid)) continue;
  		if($idsql=="") $idsql .= " aid='$aid' ";
  		else $idsql .= " Or aid='$aid' ";
  	}
  	if($idsql!=""){
  		$dsql->ExecuteNoneQuery("Delete From #@__member_guestbook where ($idsql) And mid='".$cfg_ml->M_ID."'; ");
  	}
  }
	PrintAjaxHead();
	GetList($dsql,$pageno,$pagesize,$orderby);
	$dsql->Close();
	exit();
}

//第一次进入这个页面
if($dopost==''){
	$row = $dsql->GetOne("Select count(*) as dd From #@__member_guestbook where mid='".$cfg_ml->M_ID."'; ");
	$totalRow = $row['dd'];
	include(dirname(__FILE__)."/templets/comguestbook.htm");
  $dsql->Close();
}

//获得特定的关键字列表
//---------------------------------
function GetList($dsql,$pageno,$pagesize,$orderby='aid'){
	global $cfg_phpurl,$cfg_ml;
	$start = ($pageno-1) * $pagesize;
  $dsql->SetQuery("Select * From #@__member_guestbook where mid='".$cfg_ml->M_ID."' order by $orderby desc limit $start,$pagesize ");
	$dsql->Execute();
  while($row = $dsql->GetArray()){
    $row['msg'] = ereg_replace("[ \t\r]"," ",$row['msg']);
    $row['msg'] = str_replace("  "," ",$row['msg']);
    $row['msg'] = str_replace("\n","<br>\n",$row['msg']);
    $line = "";
    $line .= "<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#D9EDC0\" style=\"margin-bottom:6px;\">";
    $line .= "\r\n<tr bgcolor=\"#E2EBC0\" height=\"30px\"> ";
    $line .= "\r\n<td height=\"30\" colspan=\"2\" background=\"img/gbookbg.gif\">";
    $line .= "\r\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr> ";
    $line .= "\r\n<td width=\"85%\" style=\"text-indent:10px;font-weight:700;color:#355b00;\">留言标题:".$row['title']."</td>";
    $line .= "\r\n<td width=\"15%\" align=\"center\">";
    $line .= "\r\n<input name=\"ids\" type=\"checkbox\" id=\"ids\" value=\"".$row['aid']."\">";
    $line .= "[<a href='#' onclick='DelNote(".$row['aid'].")'>删除</a>]";
    $line .= "\r\n</td></tr></table> ";
    $line .= "\r\n</td></tr>";
    $line .= "\r\n<tr height=\"30\"> ";
    $line .= "\r\n<td width=\"31%\" bgcolor=\"#F7FEE0\" style=\"text-indent:10px;\">";
    $line .= "\r\n&nbsp;用户称呼:<span style=\"color:red;\">".$row['uname'];
    $line .= "\r\n</td>";
    $line .= "\r\n<td width=\"69%\" height=\"30\" bgcolor=\"FDFEF5\" style=\"text-indent:10px;\">";
    $line .= "时间:".strftime("%y-%m-%d %H:%M",$row['dtime'])."&nbsp;IP地址:".$row['ip']."&nbsp;";
    if(!empty($row['gid'])){
    	$line .= " <a href='index.php?uid=".$row['gid']."&action=memberinfo' target='_blank'>资料</a>
    	           <a href='index.php?uid=".$row['gid']."' target='_blank'>空间</a>
    	           <a href='index.php?uid=".$row['gid']."&action=feedback' target='_blank'>回复</a>
    	         ";
    }
    $line .= "\r\n</td></tr>";
    $line .= "\r\n<tr height=\"60\" bgcolor=\"FDFEF5\">";
    $line .= "\r\n<td valign=\"top\">";
    $line .= "\r\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
    $line .= "\r\n<tr><td height=\"24\" style=\"text-indent:10px;border-bottom:1px solid #d9edc0;color:#999;\">&nbsp;Email:".$row['email']."</td></tr>";
    $line .= "\r\n<tr><td height=\"24\" style=\"text-indent:10px;border-bottom:1px solid #d9edc0;color:#999;\">&nbsp;联系电话:".$row['tel']."</td></tr>";
    $line .= "\r\n<tr><td height=\"24\" style=\"text-indent:10px;border-bottom:1px solid #d9edc0;color:#999;\">&nbsp;其它:".$row['qq']."</td></tr>";
    $line .= "\r\n</table>";
    $line .= "\r\n</td>";
    $line .= "\r\n<td valign=\"top\" style=\"text-indent:10px;padding:5px 10px 5px 0px;\">";
    $line .= $row['msg'];
    $line .= "\r\n</td></tr>";
    $line .= "\r\n</table>";
    echo $line;
   }
}

function PrintAjaxHead(){
	header("Pragma:no-cache\r\n");
  header("Cache-Control:no-cache\r\n");
  header("Expires:0\r\n");
	header("Content-Type: text/html; charset=gb2312");
}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -