Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

问答插件,所有的回答不能分页,哪位高手帮忙解决下

[复制链接]
hf126 发表于 2009-11-23 14:22:13 | 显示全部楼层 |阅读模式
问答插件,所有的回答不能分页,哪位高手帮忙解决下

<?php
if ( !defined( "IN_UCHOME" ) )
{
    exit( "Access Denied" );
}
$id = (int)$_GET['id'];
if (empty($id)) {
showmessage('参数错误', 'ask.php');
}
$ask_id = & $id;
//获取信息
$sql = "SELECT * FROM ".tname("app_ask")." WHERE id= $id ";
$query = $_SGLOBAL['db']->query( $sql );
$ask = $_SGLOBAL['db']->fetch_array( $query );
    realname_set($ask['uid'],$ask['username']);
if (empty($ask)) {
showmessage("信息不存在或者已经被删除", 'ask.php?do=ask');
}
//更新点击数回复数
$ask_hfx = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM ".tname('app_ask_reply')." WHERE ask_id = $ask_id"), 0);
$sql = "UPDATE ".tname("app_ask")." SET view_count = view_count + 1, reply_count =$ask_hfx WHERE id = ".$id;
$_SGLOBAL['db']->query( $sql );
//评论
$theurl = "ask.php?do=ask&ac=view&id={$ask_id}";
$reply = array();
$sql = "SELECT * FROM ".tname('app_ask_reply')." WHERE ask_id = $ask_id ORDER BY id ";
$query = $_SGLOBAL['db']->query($sql);
$count = 0;
$arr_ids = array();
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
    realname_set($value['uid'],$value['username']);
$value['content'] = nl2br(htmlspecialchars($value['content'])) ;
$reply[] = $value;
$arr_ids[] = $value['id'];
$count++;
}
//取 hot
$filePath = S_ROOT."./data/ask_hot_cache.php";
//如果获取失败     或者 缓存内容为空  或者    缓存文件的修改时间 早于$expire_time前  ,就重构缓存
if ( file_exists($filePath) &&  (time() - filemtime($filePath)) < 60*3  )
{
$code = @file_get_contents($filePath); //获取缓存内容
$hotask = unserialize($code);
}
if (empty($hotask) ) {
$hotask = array();
$where = "WHERE status=1 ";
$sql = "SELECT * FROM ".tname("app_ask")." $where ORDER BY score DESC limit 10";
$query = $_SGLOBAL['db']->query( $sql );
while ( $value = $_SGLOBAL['db']->fetch_array( $query ) )
{
  $hotask[] = $value ;
}
swritefile($filePath, serialize($hotask));
}

//$sql = "UPDATE ".tname("app_ask")." SET reply_count ={$count} WHERE id = ".$id;
//$_SGLOBAL['db']->query( $sql );
$str_ids = implode(",", $arr_ids);
//实名
realname_get();
include_once( template( "ask/view/ask_view" ) );
?>
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-11-20 00:49 , Processed in 0.020647 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表