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

 找回密码
 立即注册
搜索

[插件] [Hack·原创]会员今日发贴量,并按此对会员进行积分和金钱的奖励.

[复制链接]
天下最酷 发表于 2005-8-25 18:08:16 | 显示全部楼层
明明发了帖确显示暂未发帖,是怎么回事?
Image00000.jpg
回复

使用道具 举报

 楼主| oytktk 发表于 2005-8-25 18:11:51 | 显示全部楼层
原帖由 天下最酷 于 2005-8-25 18:08 发表
明明发了帖确显示暂未发帖,是怎么回事?

POST.PHP发上来我看看吧~
回复

使用道具 举报

天下最酷 发表于 2005-8-25 18:13:41 | 显示全部楼层
  1. <?php

  2. /*
  3. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4. :: [DISCUZ!]  Crossday Discuz! Board                                    ::
  5. :: (c) 2001-2005 Comsenz Technology Ltd (www.discuz.com)                ::
  6. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7. :: Author:  Crossday (tech@discuz.com) Cnteacher (cnteacher@discuz.com) ::
  8. :: Version: 2.5F   2004/10/01 05:15                                     ::
  9. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10. */
  11. //fix:  BY pk0909
  12. /*
  13. 1 smilecheck
  14. 2 保存文件名的stripslashes
  15. */
  16. require $discuz_root.'./include/thumbpic.php';
  17. if(!defined('IN_DISCUZ')) {
  18.         exit('Access Denied');
  19. }

  20. function attach_upload() {
  21.         global  $attach, $attach_name, $attach_size, $attach_fname, $attach_type, $attachperm, $allowsetattachperm, $timestamp;
  22.         $success_upload = array();

  23.         if (is_array($attach) && count($attach)){
  24.                 foreach( $attach as $key => $t_attach) {
  25.                         $t_attach_name = daddslashes($attach_name[$key]);
  26.                         $t_attachment = attach_upload_file($t_attach, $t_attach_name, $attach_size[$key], $attach_fname[$key],$attach_type[$key]);
  27.                         if ($t_attachment){
  28.                                 $success_upload[$key] = array (
  29.                                         'filename' => $t_attach_name,
  30.                                         'filetype' => $attach_type[$key],
  31.                                         'filesize' => $attach_size[$key],
  32.                                         'attachment' => $t_attachment,
  33.                                         'creditsrequire' => $allowsetattachperm ? $attachperm[$key] : 0,
  34.                                         'dateline' => $GLOBALS['timestamp'],
  35.                                         );
  36.                         }
  37.                 }
  38.         }elseif($attach){
  39.                 $attach_name = daddslashes($attach_name);
  40.                 $t_attachment = attach_upload_file($attach, $attach_name, $attach_size, $attach_fname,$attach_type);
  41.                 if ($t_attachment){
  42.                         $success_upload[0] =array(
  43.                                 'filename' => $attach_name,
  44.                                 'filetype' => $attach_type,
  45.                                 'filesize' => $attach_size,
  46.                                 'attachment' => $t_attachment,
  47.                                 'creditsrequire' => $allowsetattachperm ? $attachperm : 0,
  48.                                 'dateline' => $GLOBALS['timestamp'],
  49.                         );
  50.                 }
  51.         }
  52.         return $success_upload;
  53. }
  54. function attach_upload_file($attach, $attach_name, $attach_size, $attach_fname, $attach_type) {
  55.         global $db, $table_attachtypes, $extension,$watermark, $typemaxsize;
  56.         global $attachdir, $maxattachsize, $attachextensions,$attachsave;

  57.         if(!($attach != 'none' && strpos($attach, '..') === FALSE && $attach && trim($attach_name))) {
  58.                 return false;
  59.         }
  60.         $filename  = $attach_name;
  61.         $attach_ext = $extension = strtolower(fileext($attach_name));

  62.         if($attachextensions && @!eregi($attach_ext, $attachextensions)) {
  63.                 showmessage('post_attachment_ext_notallowed');
  64.         }

  65.         if(!$attach_size || ($maxattachsize && $attach_size > $maxattachsize)) {
  66.                 showmessage('post_attachment_toobig');
  67.         }

  68.         $query = $db->query("SELECT maxsize FROM $table_attachtypes WHERE extension='".addslashes($attach_ext)."'");
  69.         if($type = $db->fetch_array($query)) {
  70.                 if($type['maxsize'] == 0) {
  71.                         showmessage('post_attachment_ext_notallowed');
  72.                 } elseif($attach_size > $type['maxsize']) {
  73.                         $typemaxsize = sizecount($type['maxsize']);
  74.                         showmessage('post_attachment_type_toobig');
  75.                 }
  76.         }

  77.         if($attachsave) {
  78.                 switch($attachsave) {
  79.                         case 1: $attach_subdir = 'forumid_'.$GLOBALS['fid']; break;
  80.                         case 2: $attach_subdir = 'ext_'.$extension; break;
  81.                         case 3: $attach_subdir = 'month_'.date('ym'); break;
  82.                         case 4: $attach_subdir = 'day_'.date('ymd'); break;
  83.                 }
  84.                 $attach_dir = DISCUZ_ROOT.'./'.$attachdir.'/'.$attach_subdir;
  85.                 if(!is_dir($attach_dir)) {
  86.                         mkdir($attach_dir, 0777);
  87.                         fclose(fopen($attach_dir.'/index.htm', 'w'));
  88.                 }
  89.                 $attach_fname = $attach_subdir.'/';
  90.         } else {
  91.                 $attach_fname = '';
  92.         }

  93.         $filename = substr($filename, 0, strlen($filename) - strlen($extension) - 1);
  94.         if(preg_match("/[\x7f-\xff]+/s", $filename)) {
  95.                 $filename = str_replace('/', '', base64_encode(substr($filename, 0, 20)));
  96.         }
  97.         if(in_array($attach_ext, array('php', 'php3', 'jsp', 'asp', 'aspx', 'cgi', 'pl'))) {
  98.                 $extension = '_'.$extension;
  99.         }

  100.         $attach_saved = false;
  101.         $attach_fname .= substr($filename, 0, 64).'_'.random(12).'.'.$extension;
  102.         $target = DISCUZ_ROOT.'./'.$attachdir.'/'.stripslashes($attach_fname);

  103.         if(@copy($attach, $target) || (function_exists('move_uploaded_file') && @move_uploaded_file($attach, $target))) {
  104. //added by dream 图片压缩尺寸和体积
  105. if(in_array($extension, array('jpg','png'))) {
  106.         makethumb2($target,$photo_small,1);
  107.         }
  108.                 $attach_saved = true;
  109.         }

  110.         if(!$attach_saved && @is_readable($attach)) {
  111.                 @$fp = fopen($attach, 'rb');
  112.                 @flock($fp, 2);
  113.                 @$attachedfile = fread($fp, $attach_size);
  114.                 @fclose($fp);

  115.                 @$fp = fopen($target, 'wb');
  116.                 @flock($fp, 2);
  117.                 if(@fwrite($fp, $attachedfile)) {
  118.                         $attach_saved = true;
  119.                 }
  120.                 @fclose($fp);
  121.         }

  122.         if($attach_saved) {
  123.                 if(in_array($attach_ext, array('jpg', 'gif', 'png', 'swf', 'bmp')) && function_exists('getimagesize') && !getimagesize($target)) {
  124.                         @unlink($target);
  125.                         showmessage('post_attachment_ext_notallowed');
  126.                 } else {
  127.                         return $attach_fname;
  128.                 }
  129.         } else {
  130.                 showmessage('post_attachment_save_error');
  131.         }
  132. }

  133. function checkflood() {
  134.         global $disablepostctrl, $floodctrl, $discuz_uid, $timestamp, $lastpost, $forum;
  135.         if(!$disablepostctrl && $floodctrl) {
  136.                 if($discuz_uid) {
  137.                         if($timestamp - $floodctrl <= $lastpost) {
  138.                                 return TRUE;
  139.                         }
  140.                 } else {
  141.                         $lastpost = explode("\t", $forum['lastpost']);
  142.                         if(($timestamp - $floodctrl) <= $lastpost[1] && $discuz_user == $lastpost[2]) {
  143.                                 return TRUE;
  144.                         }
  145.                 }
  146.         }
  147.         return FALSE;
  148. }

  149. function checkpost() {
  150.         global $subject, $message, $disablepostctrl, $minpostsize, $maxpostsize;
  151.         if(strlen($subject) > 80) {
  152.                 return 'post_subject_toolang';
  153.         }
  154.         if(!$disablepostctrl) {
  155.                 if($maxpostsize && strlen($message) > $maxpostsize) {
  156.                         return 'post_message_toolang';
  157.                 } elseif($minpostsize && strlen(preg_replace("/\[quote\].+?\[\/quote\]/is", '', $message)) < $minpostsize) {
  158.                         return 'post_message_tooshort';
  159.                 }
  160.         }
  161.         return FALSE;
  162. }

  163. function checkbbcodes($message, $bbcodeoff) {
  164.         return !$bbcodeoff && !preg_match("/\[.+\].*\[\/.+\]/s", $message) ? -1 : $bbcodeoff;
  165. }

  166. function checksmilies($message, $smileyoff) {
  167.         $message = stripcslashes($message);
  168.         $smilies = array();
  169.         foreach($GLOBALS['_DCACHE']['smilies'] as $smiley) {
  170.                 $smilies[]= preg_quote($smiley['code'], '/');
  171.         }

  172.         return !$smileyoff && !preg_match('/'.implode('|', $smilies).'/', $message) ? -1 : $smileyoff;
  173. }

  174. function updatemember($operator, $uid, $credits) {
  175.         global $db, $table_members, $table_usergroups, $discuz_uid, $adminid, $groupid, $credit,$userthisday, $usertodaysum,  $timestamp;
  176.        
  177.         $addcredit = $addpost = $newcredit = $newpost =0;
  178.        
  179.         if(!$uid ) return;

  180.         if($uid == $discuz_uid) {
  181.                 $groupidadd = NULL;
  182.                 $newcredit = $credit + intval("$operator$credits");
  183.         //=======会员今日发贴量===by oytktk====start==============
  184.         if($operator == "+"){
  185.         $timer=$timestamp + $timeoffset * 3600;
  186.         $todaypt=mktime(0,0,0,gmdate("m",$timer),gmdate("d",$timer),gmdate("Y",$timer));
  187.         if($userthisday == $todaypt){

  188.         if($usertodaysum > 30 && $usertodaysum <= 50)//今日发贴量在 (30) 和 (50) 之间,数字自行修改
  189.         {
  190.                 $newcredit+=1;                //回一贴多加  (1)  积分, 数字自行修改;
  191.         }
  192.         elseif($usertodaysum > 50 && $usertodaysum <= 100)//今日发贴量在 (50) 和 (100) 之间,数字自行修改
  193.         {
  194.                 $newcredit+=2;                //回一贴多加  (2)  积分, 数字自行修改;
  195.         }
  196.         elseif($usertodaysum > 100)//今日发贴量在 (100) 之上的,数字自行修改
  197.         {
  198.                 $newcredit+=3;                //回一贴多加  (3)  积分, 数字自行修改;
  199.         }
  200.         
  201.         $usertodaysum = $usertodaysum + 1;
  202.         $userthisday = $userthisday;

  203.         }
  204.         else
  205.         {
  206.                 $userthisday = $todaypt;
  207.                 $usertodaysum = 1;
  208.         
  209.         }
  210.         }
  211.         //===================end=============
  212.                 if($adminid == 0 && $credits <> 0 && !($newcredit % 10)) {
  213.                         $query = $db->query("SELECT groupid FROM $table_usergroups WHERE type='member' AND '$newcredit'>=creditshigher AND '$newcredit'<creditslower");
  214.                         $groupidadd = ", groupid='".$db->result($query, 0)."'";
  215.                 }
  216.                 $db->query("UPDATE $table_members SET postnum=postnum$operator(1), credit=$newcredit,thisday='$userthisday', todaysum='$usertodaysum',  lastpost='$timestamp' $groupidadd WHERE uid='$uid'");
  217.         } else {
  218.                 $member = array();
  219.                 foreach(explode(',', $uid) as $id) {
  220.                         $member[trim($id)]++;
  221.                 }
  222.                 foreach($member as $uid => $posts) {
  223.                         if($credits) {
  224.                                 $query = $db->query("SELECT m.adminid, u.groupid FROM $table_members m
  225.                                                                 LEFT JOIN $table_usergroups u ON (u.creditshigher<>'0' || u.creditslower<>'0') AND m.credit$operator$credits*$posts>=u.creditshigher AND m.credit$operator$credits*$posts<u.creditslower
  226.                                                                 WHERE uid='$uid'");
  227.                                 if($member2 = $db->fetch_array($query)) {
  228.                                         $groupidadd = $member2['adminid'] == 0 ? ", groupid='$member2[groupid]'" : NULL;
  229.                                         $db->query("UPDATE $table_members SET postnum=postnum$operator$posts, credit=credit$operator($credits*$posts) $groupidadd WHERE uid='$uid'", 'UNBUFFERED');
  230.                                 }
  231.                         } else {
  232.                                 $db->query("UPDATE $table_members SET postnum=postnum$operator$posts WHERE uid='$uid'", 'UNBUFFERED');
  233.                         }
  234.                 }
  235.         }
  236. }
  237. function updatemoney($operator, $uid, $usermoneys) {
  238.         global $db, $table_members, $discuz_uid;
  239.        
  240.         $newmoney =0;

  241.         $newmoney = intval("$usermoneys");
  242.         //=======会员今日发贴量===by oytktk====start==============
  243.         if($operator == "+"){
  244.         $timer=time() + $timeoffset * 3600;
  245.         $todaypt=mktime(0,0,0,gmdate("m",$timer),gmdate("d",$timer),gmdate("Y",$timer));
  246.         if($userthisday == $todaypt){

  247.         if($usertodaysum > 30 && $usertodaysum <= 50)//今日发贴量在 (30) 和 (50) 之间,数字自行修改
  248.         {
  249.                 $newmoney+=3;                //回一贴多加  (3)  金钱, 数字自行修改;
  250.         }
  251.         elseif($usertodaysum > 50 && $usertodaysum <= 100)//今日发贴量在 (50) 和 (100) 之间,数字自行修改
  252.         {
  253.                 $newmoney+=5;                //回一贴多加  (5)  金钱, 数字自行修改;
  254.         }
  255.         elseif($usertodaysum > 100)//今日发贴量在 (100) 之上的,数字自行修改
  256.         {
  257.                 $newmoney+=10;                //回一贴多加  (10)  金钱, 数字自行修改;
  258.         }
  259.         
  260.         $usertodaysum = $usertodaysum;
  261.         $userthisday = $userthisday;

  262.         }
  263.         else
  264.         {
  265.                 $userthisday = $todaypt;
  266.                 $usertodaysum = 1;
  267.         
  268.         }
  269.         }
  270.         //===================end=============
  271.        
  272.         if(!$uid ) return;

  273.         if($uid == $discuz_uid) {
  274.                 $db->query("UPDATE $table_members SET money=money$operator$newmoney WHERE uid='$uid'");
  275.         } else {
  276.                 $member = explode(',', $uid);
  277.                 foreach($member as $uid) {
  278.                         $db->query("UPDATE $table_members SET money=money$operator$newmoney WHERE uid='$uid'");
  279.                 }
  280.         }
  281. }
  282. function updateforumcount($fid) {
  283.         global $db, $table_threads, $table_forums;
  284.         $query = $db->query("SELECT COUNT(*) AS threadcount, SUM(t.replies)+COUNT(*) AS replycount FROM $table_threads t, $table_forums f WHERE f.fid='$fid' AND t.fid=f.fid AND t.displayorder>='0'");
  285.         extract($db->fetch_array($query));

  286.         $query = $db->query("SELECT subject, lastpost, lastposter FROM $table_threads USE INDEX(displayorder) WHERE fid='$fid' AND displayorder>='0' ORDER BY lastpost DESC LIMIT 1");
  287.         $thread = $db->fetch_array($query);
  288.         $thread['subject'] = addslashes($thread['subject']);
  289.         $thread['lastposter'] = addslashes($thread['lastposter']);
  290.         $db->query("UPDATE $table_forums SET posts='$replycount', threads='$threadcount', lastpost='$thread[subject]\t$thread[lastpost]\t$thread[lastposter]' WHERE fid='$fid'", 'UNBUFFERED');
  291. }

  292. function updatethreadcount($tid) {
  293.         global $db, $table_threads, $table_posts;
  294.         $query = $db->query("SELECT COUNT(*) FROM $table_posts WHERE tid='$tid'AND invisible='0' ");
  295.         $replycount = $db->result($query, 0) - 1;
  296.         if($replycount < 0) {
  297.                 $db->query("DELETE FROM $table_threads WHERE tid='$tid'");
  298.                 $db->query("DELETE FROM $table_polls WHERE tid='$tid'");
  299.                 return;
  300.         }
  301.         $query = $db->query("SELECT author, dateline FROM $table_posts WHERE tid='$tid' AND invisible='0'  ORDER BY dateline DESC LIMIT 1");
  302.         $lastpost = $db->fetch_array($query);
  303.         $lastpost['author'] = addslashes($lastpost['author']);
  304.         $db->query("UPDATE $table_threads SET replies='$replycount', lastposter='$lastpost[author]', lastpost='$lastpost[dateline]' WHERE tid='$tid'", 'UNBUFFERED');
  305. }

  306. ?>
复制代码
回复

使用道具 举报

 楼主| oytktk 发表于 2005-8-25 18:23:10 | 显示全部楼层
viewthread.php,给我.
回复

使用道具 举报

天下最酷 发表于 2005-8-25 18:24:22 | 显示全部楼层
  1. <?php

  2. /*
  3. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4. :: [DISCUZ!]  Crossday Discuz! Board                                    ::
  5. :: (c) 2001-2005 Comsenz Technology Ltd (www.discuz.com)                ::
  6. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7. :: Author:  Crossday (tech@discuz.com) Cnteacher (cnteacher@discuz.com) ::
  8. :: Version: 2.5F   2004/10/01 05:15                                     ::
  9. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10. */
  11. //fix:  BY pk0909
  12. /*
  13. 1 发帖数衡量级别
  14. 2 转入最新帖
  15. */

  16. define('CURRSCRIPT',  'viewthread');

  17. require_once './include/common.php';
  18. require_once DISCUZ_ROOT.'./include/forum.php';
  19. require_once DISCUZ_ROOT.'./include/discuzcode.php';
  20. //---------------------宠物显示------------------------------
  21. require_once './pet/petfunction.php';
  22. //-----------------------------------------------------------

  23. $discuz_action = 3;

  24. if(!$discuz_uid) {
  25.         showmessage('not_loggedin','logging.php?action=login');
  26. }
  27. if ($tid && $forum){
  28.         $thread = $forum;
  29. }elseif($fid && defined('ViewLastPost')) {
  30.         $followforum = '';
  31.         foreach($_DCACHE['forums'] as $ffid => $fforum) {
  32.                 if($fforum['fup'] == $fid && $fforum['type'] == 'sub') {
  33.                         $followforum .= ','.$ffid;
  34.                 }
  35.         }
  36.         $followforumadd = $followforum ? "f.fid in ($fid{$followforum})" : "f.fid=$fid";
  37.         $query = $db->query("SELECT f.* $accessadd1 , t.* FROM $table_forums f, $table_threads t $accessadd2 WHERE $followforumadd AND t.displayorder>='0' AND f.fid=t.fid ORDER BY t.lastpost DESC LIMIT 1");
  38.         if(!$forum = $db->fetch_array($query)) {
  39.                         showmessage('thread_nonexistence');
  40.         }
  41. //家族Begin
  42. $query=$db->query("select * from $table_members where username='$discuz_user'");
  43. $fam=@mysql_fetch_array($query);
  44. if($forum['clan'] && $forum['clan']!=$fam[fam] && !$isadmin){
  45.        showmessage('本区只限同家族成员进入!');
  46. }
  47. //家族End

  48.         $thread = $forum;
  49.         $fid = $forum['fid'];
  50.         if(@!include DISCUZ_ROOT.'./forumdata/cache/style_'.intval(!empty($forum['styleid']) ? $forum['styleid'] : $styleid).'.php') {
  51.                         $styleid = $_DCACHE['settings']['styleid'];
  52.                         $cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/style_'.$styleid.'.php') ? '' : ' style_'.$styleid;
  53.         }
  54. } else {
  55.         showmessage('thread_nonexistence');
  56. }

  57. if (defined('ViewLastPost')) {
  58.                 $page = @ceil(($thread['replies'] + 1) / $ppp);
  59. }

  60. $tid = $thread['tid'];
  61. $codecount = 0;
  62. $oldtopics = $_COOKIE['oldtopics'] ? $_COOKIE['oldtopics'] : "\t";
  63. if(!strstr($oldtopics, "\t$tid\t")) {
  64.         $oldtopics .= "$tid\t";
  65.         setcookie('oldtopics', $oldtopics, $timestamp + 900, $cookiepath, $cookiedomain);
  66. }

  67. if($forum['type'] == 'forum') {
  68.         $navigation .= "&raquo; <a href="forumdisplay.php?fid=$fid&page=$fpage"> $forum[name]</a> &raquo; $thread[subject]";
  69.         $navtitle .= ' - '.strip_tags($forum['name']).' - '.$thread['subject'];
  70. } else {
  71.         $query = $db->query("SELECT fid, name, moderator FROM $table_forums WHERE fid='$forum[fup]'");
  72.         $fup = $db->fetch_array($query);
  73.         $navigation .= "&raquo; <a href="forumdisplay.php?fid=$fup[fid]">$fup[name]</a> &raquo; <a href="forumdisplay.php?fid=$fid&page=$fpage"> $forum[name]</a> &raquo; $thread[subject]";
  74.         $navtitle .= ' - '.strip_tags($fup['name']).' - '.strip_tags($forum['name']).' - '.$thread['subject'];
  75. }

  76. $ismoderator = modcheck($discuz_user);

  77. if(!$forum['allowview']) {
  78.         if(!$forum['viewperm'] && !$allowview) {
  79.                 showmessage('group_nopermission', NULL, 'HALTED');
  80.         } elseif($forum['viewperm'] && !strstr($forum['viewperm'], "\t$groupid\t")) {
  81.                 showmessage('forum_nopermission', NULL, 'HALTED');
  82.         }
  83. }

  84. if($thread['creditsrequire'] && $thread['creditsrequire'] > $credit && !$ismoderator && ($thread['authorid'] !=$discuz_uid)) {
  85.         showmessage('thread_nopermission', NULL, 'HALTED');
  86. }

  87. if($forum['password'] && $forum['password'] != $_COOKIE["fidpw$fid"]) {
  88.         header("Location: {$boardurl}forumdisplay.php?fid=$fid&sid=$sid");
  89.         exit();
  90. }

  91. if(!$action && $tid) {

  92.         if($discuz_uid && $newpm) {
  93.                 require DISCUZ_ROOT.'./include/pmprompt.php';
  94.         }

  95.         $highlightstatus = str_replace('+', '', $highlight) ? 1 : 0;
  96.         $karmaoptions = '';
  97.         if($allowkarma && $maxkarmarate) {
  98.                 $offset = ceil($maxkarmarate / 6);
  99.                 for($vote = - $maxkarmarate + $offset; $vote <= $maxkarmarate; $vote += $offset) {
  100.                         $votenum = $vote > 0 ? '+'.$vote : $vote;
  101.                         $karmaoptions .= $vote ? "<option value="$vote">$votenum</option>\n" : NULL;
  102.                 }
  103.         }
  104.         unset($vote, $votenum, $offset);
  105.        
  106.         $pageMax = ceil(($thread['replies']+1) / $ppp);
  107.         $page = intval($page) ? intval($page) : 1;
  108.         $page = $page > $pageMax ? $pageMax : $page;
  109.         $start_limit = ($page - 1) * $ppp;



  110.         $fpage = intval($fpage);
  111.         $multipage = multi($thread['replies'] + 1, $ppp, $page, "viewthread.php?tid=$tid&fpage=$fpage&highlight=".rawurlencode($highlight));

  112.         $thread[subject] = cutstr($thread[subject],77);
  113.         $polloptions = array();
  114.         if($thread['poll']) {
  115.                 $query = $db->query("SELECT pollopts FROM $table_polls WHERE tid='$tid'");
  116.                 $pollopts = unserialize($db->result($query, 0));
  117.                 if (is_array($pollopts) && count($pollopts)){
  118.                         foreach($pollopts['options'] as $option) {
  119.                                 $polloptions[] = array(       
  120.                                         'option'        => dhtmlspecialchars(stripslashes($option[0])),
  121.                                         'votes'                => $option[1],
  122.                                         'width'                => @round($option[1] * 300 / $pollopts['max']) + 2,
  123.                                         'percent'        => @sprintf ("%01.2f", $option[1] * 100 / $pollopts['total'])
  124.                                 );
  125.                         }
  126.                         $allowvote = $allowvote && $discuz_uid && (empty($thread['closed']) || $alloweditpoll) && !in_array($discuz_user, $pollopts['voters']);
  127.                         $optiontype = $pollopts['multiple'] ? 'checkbox' : 'radio';
  128.                 }else{
  129.                         unset ($pollopts);
  130.                 }
  131.         }

  132.         $altbg1 = ALTBG1;
  133.         $altbg2 = ALTBG2;
  134.         $postlist = $attachelist = array();
  135.         $newpostanchor = $topiccount = $have_attachment = 0;
  136.         $postcount = $start_limit;
  137.         $post_phpcodecount = -1;
  138.         $post_user_info_sql = 'fam,
  139. m.username, m.gender, m.groupid, m.adminid, m.regdate, m.invisible, m.lastactivity, m.postnum, m.credit, m.email, m.site, m.icq, m.oicq, m.yahoo, m.msn, m.location, m.avatar, m.avatarwidth, m.avatarheight, m.signature, m.customstatus, m.showemail,m.todaysum, m.audsum, m.groomsum , m.bank, m.money, m.bankmimi, m.bankstatus,m.medals,m.showpet';

  140.         $query = $db->query("
  141.                                         SELECT p.*,b.*, $post_user_info_sql
  142.                                         FROM $table_posts p
  143. LEFT JOIN $tablepre"."mypetdata b ON b.username=p.author
  144.                                         LEFT JOIN $table_members m ON m.uid=p.authorid
  145.                                         WHERE p.tid='$tid' AND p.invisible='0' ORDER BY dateline LIMIT $start_limit, $ppp");

  146.         while($post = $db->fetch_array($query)) {
  147. //家族Begin

  148.               //$query=$db->query("select * from cdb_members where username='$post[author]'");
  149.                //$fmu=@mysql_fetch_array($query);
  150.                $query_mp=$db->query("select * from cdb_fam where fmname='$post[fam]'");
  151.                $fcu=@mysql_fetch_array($query_mp);

  152.                if(!$post['fam'] || $post['fam']=="0")
  153.                {
  154.                 $post[fam]="没有家族";     //没有加入家族要显示的资讯
  155.                }
  156.                  else{
  157.                      if($post[author]==$fcu['username'])
  158.                        {
  159.                          $post['fam']=$post['fam']."-族长";   //家族长要显示的资讯
  160.                        }
  161.                      elseif($post[author]==$fcu['second']||$post[author]==$fcu['third']){
  162.                          $post['fam']=$post['fam']."-长老";   //家族长老要显示的资讯
  163.                        }
  164.                      elseif($post[author]==$fcu['four']||$post[author]==$fcu['five']||$post[author]==$fcu['six']) {
  165.                        $post['fam']=$post['fam']."-堂主";   //家族唐主要显示的资讯
  166.                       }
  167.                      else {
  168.                       $post['fam']=$post['fam']."-成员";     //家族成员要显示的资讯
  169.                      }
  170.                 }

  171.                 //家族End


  172.                 if(!$newpostanchor && $post['dateline'] > $lastvisit) {
  173.                         $post['newpostanchor'] = '<a name="newpost"></a>';
  174.                         $newpostanchor = 1;
  175.                 } else {
  176.                         $post['newpostanchor'] = '';
  177.                 }
  178.                 $topiccount ++;
  179.                 $post['postcount'] = $postcount+1;
  180.                 $post['thisbg'] = ${'altbg'.($postcount++ % 2 + 1)};
  181.                 $post['dateline'] = gmdate("$dateformat $timeformat", $post['dateline'] + $timeoffset * 3600);

  182. // nDesigner:仿4.0加入管理动作显示 Start [Author: 多口仔]

  183.     include language('templates');
  184.     $thread['moderatetime'] = gmdate("$dateformat $timeformat", $thread['threads_moderatetime'] + $timeoffset * 3600);

  185.     if($thread[threads_moderate] == 1) {
  186.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_move]."";
  187.     } elseif ($thread[threads_moderate] == 3 && $thread[closed] == 1) {
  188.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_close]."";
  189.     } elseif ($thread[threads_moderate] == 3 && $thread[closed] == 0) {
  190.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_open]."";
  191.     } elseif ($thread[threads_moderate] == 4 && $thread[displayorder] > 0) {
  192.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_top]."";
  193.     } elseif ($thread[threads_moderate] == 4 && $thread[displayorder] == 0) {
  194.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_top_del]."";
  195.     } elseif ($thread[threads_moderate] == 5 && $thread[digest] > 0) {
  196.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_digest]."";
  197.     } elseif ($thread[threads_moderate] == 5 && $thread[digest] == 0) {
  198.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_digest_del]."";
  199.     } elseif ($thread[threads_moderate] == 6) {
  200.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_highlight]."";
  201.     } elseif ($thread[threads_moderate] == 7) {
  202.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_split]."";
  203.     } elseif ($thread[threads_moderate] == 8) {
  204.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_merge]."";
  205.     } elseif ($thread[threads_moderate] == 9) {
  206.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_bump]."";
  207.     } elseif ($thread[threads_moderate] == 10) {
  208.         $modaction = "".$language['thread_moderate']." <a href=viewpro.php?uid=".$thread[threads_moderatorid]."> ".$thread[threads_moderator]."</a> ".$language['on']." ".$thread[moderatetime]." ".$language[thread_moderate_recount]."";
  209.     }
  210. // nDesigner:仿4.0加入管理动作显示 End [Author: 多口仔]




  211.                 if($post['username']) {
  212.                        
  213.                         if($userstatusby > 0 ){
  214.                                 if($userstatusby == 2 && $post['adminid'] == 0) {
  215.                                         foreach($_DCACHE['ranks'] as $rank) {
  216.                                                 if($post['postnum'] > $rank['postshigher']) {
  217.                                                         $post['authortitle'] = $rank['ranktitle'];
  218.                                                         $post['stars'] = $rank['stars'];
  219.                                                         break;
  220.                                                 }
  221.                                         }
  222.                                 }else{
  223.                                         $post['authortitle'] = $_DCACHE['usergroups'][$post['groupid']]['grouptitle'];
  224.                                         $post['stars'] = $_DCACHE['usergroups'][$post['groupid']]['stars'];
  225.                                 }
  226.                         }

  227.                         $post['regdate'] = gmdate($dateformat, $post['regdate'] + $timeoffset * 3600);
  228.                 $timer=$timestamp + $timeoffset * 3600;
  229.                 $todaypt=mktime(0,0,0,gmdate("m",$timer),gmdate("d",$timer),gmdate("Y",$timer));
  230.                 if($todaypt==$post['thisday']){
  231.                 $addcread=0;
  232.                 $addmoney=0;
  233.                 if($post['todaysum'] > 20 && $post['todaysum'] <=50)
  234.                 {$addcread = 1;
  235.                  $addmoney=3;
  236.                  }
  237.                 elseif($post['todaysum'] >50 && $post['todaysum'] <=80)
  238.                 {$addcread = 2;
  239.                  $addmoney=5;
  240.                  }
  241.                 elseif($post['todaysum'] >80)
  242.                 {$addcread = 3;
  243.                  $addmoney=10;
  244.                  }
  245.                 $addcread1=$addcread+$postcredits;
  246.                 $addmoney1=$addmoney+2;
  247.                 $addmoney2=$addmoney+1;
  248.                 $addcread2=$addcread+$replycredits;
  249.                 $post['todaysum']=$post['todaysum'].",";
  250.                 $post['todayn']='<a name="" title="下一发表的主题将得: '.$addcread1.' 个积分和 '.$addmoney1.' 个金钱">+'.$addcread1.'</a>,';
  251.                 $post['todayr']='<a name="" title="下一回复的主题将得: '.$addcread2.' 个积分和 '.$addmoney2.' 个金钱">+'.$addcread2.'</a>';}
  252.                 else
  253.                 {
  254.                 $post['todaysum']='<font color=blue>暂未发贴</FONT>';
  255.                 }
  256. $post['missday'] = intval(($timestamp-$post[lastactivity])/(3600*24));


  257.                         if($_DCACHE['usergroups'][$post['groupid']]['groupavatar']) {
  258.                                 $post['avatar'] = '<img src="'.$_DCACHE['usergroups'][$post['groupid']]['groupavatar'].'" border="0">';
  259.                         } elseif($_DCACHE['usergroups'][$post['groupid']]['allowavatar'] && $post['avatar']) {
  260.                                 $post['avatar'] = '<img src="'.$post['avatar'].'" width="'.$post['avatarwidth'].'" height="'.$post['avatarheight'].'" border="0">';
  261.                         } else {
  262.                                 $post['avatar'] = '';
  263.                         }
  264.                 } else {
  265.                         if(!$post['authorid']) {
  266.                                 $post['useip'] = substr($post['useip'], 0, strrpos($post['useip'], '.')).'.x';
  267.                         }
  268.                         $post['postnum'] = $post['credit'] = $post['regdate'] = 'N/A';
  269.                 }

  270.                 $post['karma'] = '';
  271.                 if($post['rate'] && $post['ratetimes']) {
  272.                         $rateimg = $post['rate'] > 0 ? 'agree.gif' : 'disagree.gif';
  273.                         for($i = 0; $i < round(abs($post['rate']) / $post['ratetimes']); $i++) {
  274.                                 $post['karma'] .= '<img src="'.IMGDIR.'/'.$rateimg.'" align="right">';
  275.                         }
  276.                 }

  277.     $post['ljl_karma'] = '';
  278.     if($post['rate'] && $post['ratetimes']) {
  279.       $rateimg = $post['rate'] > 0 ? 'agree.gif' : 'disagree.gif';
  280.       for($i = 0; $i < round(abs($post['rate']) / $post['ratetimes']); $i++) {
  281.         $post['ljl_karma'] .= '&nbsp;<img src="'.IMGDIR.'/'.$rateimg.'">';
  282.       }
  283.     }
  284.     if($post['rate']) {
  285.       $post['rate'] >0 ? $ljl_sign = '+' : $ljl_sign = NULL;
  286.       $post['ljl_karma'] = '<tr><td colspan="3">此贴被 <font color=red>'.$ljl_sign.$post['rate'].'</font> 点积分'.$post['ljl_karma'].'</td></tr>';
  287.       $ljlquery = $db->query("SELECT k.*, m.username FROM $table_karmalog k
  288.               LEFT JOIN $table_members m ON k.uid = m.uid
  289.               WHERE pid='$post[pid]' ORDER BY dateline DESC");
  290.       while($lp_karma = $db->fetch_array($ljlquery)) {
  291. if(!$lp_karma['comment']){
  292.                 $lp_karma['comment'] = '男人喜欢一种贴,不需要理由!';
  293.                 }else {
  294.                 $lp_karma['comment'] = $lp_karma['comment'];
  295.                 }
  296.         $lp_karma['score'] >0 ? $ljl_sign = '+' : $ljl_sign = NULL;
  297.        $post['ljl_karma'].='<tr><td>评分者:【<a href=viewpro.php?username='.AddSlashes($lp_karma['username']).'>'.AddSlashes($lp_karma['username']).'</a>】</td><td>分数:<font color=red>'.$ljl_sign.$lp_karma['score'].'</font></td><td>&nbsp;理由: '.$lp_karma['comment'].'</td><td>&nbsp;时间:'.gmdate("$dateformat $timeformat", $lp_karma['dateline'] + ($timeoffset * 3600)).'</td></tr>';
  298.       }
  299.       $post['ljl_karma'] = '<br><br><center><table border="0" cellspacing="0" cellpadding="1"
  300. bgcolor="#698CC3"><tr><td><table border="0" cellspacing="0" cellpadding="4" bgcolor="#FFFFFF">'.$post['ljl_karma'].'</table></td></tr></table></center>';
  301.     }

  302.                 $post['subject'] = $post['subject'] ? $post['subject'] : NULL;
  303. $post['payed'] = 0 ;
  304.                 $post['message'] = postify($post['message'], $post['smileyoff'], $post['bbcodeoff'], $forum['allowsmilies'], $forum['allowhtml'], $forum['allowbbcode'], $forum['allowimgcode']);
  305.                 $post['signature'] = $post['usesig'] && $post['signature'] ? postify($post['signature'], 1, 0, 0, 0, $_DCACHE['usergroups'][$post['groupid']]['allowsigbbcode'], $_DCACHE['usergroups'][$post['groupid']]['allowsigimgcode'],1) : NULL;
  306. //---------------------宠物显示------------------------------
  307. //判断是否有宠物资料,如果有就显示询息
  308. if ($post[mypet]){

  309. //有宠物,将宠物的基本资料读出
  310. //基本显示资料
  311. //mypetname,mypet
  312. $petpic=$post['mypetname'];                //宠物种类(对映图片的目录)
  313. $petname=$post['mypet'];                //宠物名字
  314. $petsx = $post['mypetsx'];          //宠物属性
  315. $petatkplace=$post['mypetatkplace']; //宠物战斗地点

  316. //Level/Exp 计算
  317. //mypetexp
  318. $petnowexp=$post[mypetexp];                                 //宠物目前的 Exp
  319. $petlevel = floor(sqrt(sqrt($petnowexp)));                //将经验值开根号 2 次就是等级了
  320. $petneedexp = pow($petlevel+1,4)-pow($petlevel,4);        //宠物升下一级所需要的 Exp
  321. $petnextlvexp = pow($petlevel+1,4);                        //宠物下一级的 Exp
  322. $petshowlevel = $petlevel;                                //宠物等级

  323. $levelpic=intval($petshowlevel/10);          //级别图片
  324. if ($levelpic>10){$levelpic=11;}         //高于10级用10级图片

  325. //装备资讯(物品编号,物品能力)
  326. $armpotion[]='head';
  327. $armpotion[]='leftear';
  328. $armpotion[]='rightear';
  329. $armpotion[]='left';
  330. $armpotion[]='right';
  331. $armpotion[]='body';
  332. $armpotion[]='foot';


  333. $armmaxhp=0;
  334. $armmaxsp=0;
  335. $armatk=0;
  336. $armdef=0;
  337. $armspd=0;
  338. $armmag=0;

  339. for($i=0;$i<count($armpotion);$i++){
  340.         $armpotiontext=$armpotion[$i];
  341.         $armpotionsqltext="arm".$armpotion[$i];
  342.         $arm[$armpotiontext] = explode(",",$post[$armpotionsqltext]);
  343.         $armpicpath[$armpotiontext]=trim($arm[$armpotiontext][0]);
  344.         $armindex[$armpotiontext]=trim($arm[$armpotiontext][1]);        
  345.         $armplus[$armpotiontext]=substr($post[$armpotionsqltext],strlen($arm[$armpotiontext][0])+strlen($arm[$armpotiontext][1])+2);        
  346.         $armplustext[$armpotiontext]=uf_getitemplustext($armplus[$armpotiontext]);
  347.         
  348.         //将物品的能力值整合
  349.         $armplusdata= explode(",",$armplus[$armpotiontext]);        
  350.         
  351.         $armaddplus[$armpotiontext]="";
  352.         $armdurplus[$armpotiontext]="";
  353.         $armspliter="";
  354.         
  355.         if($armpicpath[$armpotiontext]=="") continue;
  356.         
  357.         //先取出目前耐久与最大耐久值,如果耐久值低于最大耐久值的一半,就会开始降低能力        
  358.         for($j=0;$j<count($armplusdata);$j=$j+2){
  359.                 $itemfuntion=$armplusdata[$j];
  360.                 $itemfuntionvalue=$armplusdata[$j+1];
  361.                 //取出物品的附加能力值,与耐久度
  362.                 if($itemfuntion!="+dur"){
  363.                         $armaddplus[$armpotiontext]="$armaddplus[$armpotiontext]$armspliter$itemfuntion,$itemfuntionvalue";
  364.                         $armspliter=",";
  365.                 }else{
  366.                         $armdurvalue[$armpotiontext]=$itemfuntionvalue;
  367.                 }        
  368.                 if($itemfuntion=="+durmax"){
  369.                         $armmaxdurvalue[$armpotiontext]=$itemfuntionvalue;
  370.                 }               
  371.         }        
  372.         
  373.         //计算对物品能力值的影向值
  374.         $armvalueeff[$armpotiontext]=floor($armdurvalue[$armpotiontext]/($armmaxdurvalue[$armpotiontext]/2)*100);
  375.         if($armvalueeff[$armpotiontext] > 100) {$armvalueeff[$armpotiontext] = 100;}        
  376.         
  377.         for($j=0;$j<count($armplusdata);$j=$j+2){
  378.                 $itemfuntion=$armplusdata[$j];
  379.                 $itemfuntionvalue=$armplusdata[$j+1];
  380.                 //依耐久度调整物品附加能力值
  381.                 $itemfuntionvalue=floor(($itemfuntionvalue*$armvalueeff[$armpotiontext])/100);
  382.                
  383.                 switch($itemfuntion){
  384.                         case '+maxhp':
  385.                                 $armmaxhp+=$itemfuntionvalue;
  386.                                 break;
  387.                         case '-maxhp':
  388.                                 $armmaxhp-=$itemfuntionvalue;
  389.                                 break;                                
  390.                         case '+maxsp':
  391.                                 $armmaxsp+=$itemfuntionvalue;
  392.                                 break;               
  393.                         case '-maxsp':
  394.                                 $armmaxsp-=$itemfuntionvalue;
  395.                                 break;                                                
  396.                         case '+atk':
  397.                                 $armatk+=$itemfuntionvalue;                                
  398.                                 break;               
  399.                         case '-atk':
  400.                                 $armatk-=$itemfuntionvalue;
  401.                                 break;               
  402.                         case '+def':
  403.                                 $armdef+=$itemfuntionvalue;
  404.                                 break;               
  405.                         case '-def':
  406.                                 $armdef-=$itemfuntionvalue;
  407.                                 break;                                                                                                               
  408.                         case '+spd':
  409.                                 $armspd+=$itemfuntionvalue;
  410.                                 break;               
  411.                         case '-spd':
  412.                                 $armspd-=$itemfuntionvalue;
  413.                                 break;               
  414.                         case '+mag':
  415.                                 $armmag+=$itemfuntionvalue;
  416.                                 break;               
  417.                         case '-mag':
  418.                                 $armmag-=$itemfuntionvalue;
  419.                                 break;                                                                                                                                                                                                                                                                                                               
  420.                 }
  421.         }        
  422. }


  423. //宠物基本战斗资料
  424. //mypethp,mypetsp,mypethelp,mypetatkp,mypetdefp,mypetspdp,mypetmagp
  425. $pethp=$post[mypethp];        //宠物现有的 HP
  426. $petsp=$post[mypetsp];        //宠物现有的 SP

  427. //体力
  428. $petmaxhp=20+floor($post['mypethelp']*8+$post['mypetatkp']*2+$post['mypetdefp']*3+$post['mypetspdp']*3+$post['mypetmagp']*1);
  429. $petmaxhp+=$armmaxhp;
  430. //魔力
  431. $petmaxsp=20+floor($post['mypethelp']*1+$post['mypetatkp']*2+$post['mypetdefp']*2+$post['mypetspdp']*2+$post['mypetmagp']*10);
  432. $petmaxsp+=$armmaxsp;
  433. //功击力
  434. $petatk=20+floor($post['mypethelp']*0.1+$post['mypetatkp']*2+$post['mypetdefp']*0.2+$post['mypetspdp']*0.2+$post['mypetmagp']*0.1);
  435. //$petatk=$petatk+$itemvalue1+$itemnum1;
  436. $petatk+=$armatk;
  437. //防御力
  438. $petdef=20+floor($post['mypethelp']*0.1+$post['mypetatkp']*0.2+$post['mypetdefp']*2+$post['mypetspdp']*0.2+$post['mypetmagp']*0.1);
  439. //$petdef=$petdef+$itemvalue2+$itemvalue3+$itemvalue4+$itemvalue5+$itemnum2+$itemnum3+$itemnum4+$itemnum5;
  440. $petdef+=$armdef;
  441. //敏捷
  442. $petspd=20+floor($post['mypethelp']*0.2+$post['mypetatkp']*0.2+$post['mypetdefp']*0.2+$post['mypetspdp']*2+$post['mypetmagp']*0.1);
  443. $petspd+=$armspd;
  444. //精神
  445. $petmag=100+floor($post['mypethelp']*(-0.3)+$post['mypetatkp']*(-0.1)+$post['mypetdefp']*0.2+$post['mypetspdp']*(-0.1)+$post['mypetmagp']*0.8);
  446. $petmag+=$armmag;
  447. //回复
  448. $petrlf=100+floor($post['mypethelp']*0.8+$post['mypetatkp']*(-0.1)+$post['mypetdefp']*(-0.1)+$post['mypetspdp']*0.2+$post['mypetmagp']*(-0.3));

  449. $mypethelp=$post[mypethelp];
  450. $mypetatkp=$post[mypetatkp];
  451. $mypetdefp=$post[mypetdefp];
  452. $mypetspdp=$post[mypetspdp];
  453. $mypetmagp=$post[mypetmagp];

  454. // hp/sp/exp bar
  455. $hpf= floor (100 * ($pethp / $petmaxhp)*0.97) ;
  456. $spf= floor (100 * ($petsp / $petmaxsp)*0.97) ;
  457. $petep = floor((($petnowexp-pow($petlevel,4))/$petneedexp)*100);        //宠物 Exp bar

  458. //用现有的 HP 判断宠物是存活
  459. $mypetdead=$post['mypetdead']; // 0 活着 1 死亡 2 封印

  460. switch($mypetdead){
  461.         case 0 : $petdeadstring = "活着";
  462.                         break;
  463.         case 1 : $petdeadstring = "死亡";
  464.                         break;
  465.         case 2 : $petdeadstring = "封印";
  466.                         break;
  467. }

  468. $mypetsex=$post['mypetsex'];
  469. $mypetpk=$post['openpk'];
  470. $pettime=$post['pktime'];

  471. if ($pethp<1){ $pethp=0; $mypetdead=1; }
  472. else {$mypetdead=0;}

  473. //判断宠物的各项状态
  474. if ($pethp < 1 ){$petdead='死亡';} else{ $petdead='生存';}
  475. if ($mypetsex<2){$petsex='雄';}else{$petsex='雌';}
  476. if ($mypetpk<2) {$petpk='等待挑战';}else{$petpk='拒绝挑战';}
  477. }
  478.    
  479.     if ($post[mypet])
  480.     {
  481.             $post['petname'] = $petname;
  482.             $post['petlevel']= $petlevel;
  483.             $post['petshowlevel']=$petshowlevel;
  484.             $post['levelpic']=$levelpic;
  485.             $post['petpic']=$petpic;
  486.             $post['pethp']=$pethp;
  487.             $post['petmaxhp']=$petmaxhp;
  488.             $post['petsp']=$petsp;
  489.             $post['petmaxsp']=$petmaxsp;
  490.             $post['petdead']=$petdead;
  491.             $post['petpk']=$petpk;
  492.             $post['hpf']=$hpf;
  493.             $post['spf']=$spf;
  494.             $post['petnowexp']=$petnowexp;
  495.             $post['petnextlvexp']=$petnextlvexp;
  496.             $post['$petep']=$petep;
  497.             $post['petnum']= "pet$postcount";
  498.             $post['openpk']=$mypetpk;
  499.             //$showpet=$;
  500.             
  501.     }

  502. //-------------------------宠物显end------------------



  503.                 if(!$have_attachment && $post['aid']) $have_attachment = 1 ;
  504. /////////勋章s///////
  505.                 if($post['medals']){
  506.                         require_once("./forumdata/medals.php");
  507.                         $medalid = strtok($post['medals'],",");
  508.                         while($medalid){
  509.                                 $tempmedal .= "<img src={$medalurls[$medalid]} alt={$medals[$medalid]}> ";
  510.                                 $medalid = strtok(",");}
  511.                         $post['medals'] = $tempmedal.'<br>';
  512.                         unset($tempmedal);
  513.                 }
  514. /////////勋章e///////
  515. $topicquery = $db->query("SELECT tid FROM $table_threads WHERE author='$post[author]'");
  516.                    $post[topicallnum] = $db->num_rows($topicquery);
  517.                    $post[postnum] = $post[postnum] - $post[topicallnum];
  518.                 $postlist[] = $post;
  519.         }
  520.        
  521.         if (empty($postlist)) {
  522.                 showmessage('undefined_action', NULL, 'HALTED');
  523.         }

  524.         if ($have_attachment) {
  525.                 require_once DISCUZ_ROOT.'./include/attachment.php';
  526.                 $query = $db->query("select * from $table_attachments where tid='$tid' ORDER BY aid");
  527.                 while($attach = $db->fetch_array($query)) {
  528.                         $attach[checkid] = substr(md5($attach['filesize']),0,5);
  529.                         $extension = strtolower(fileext($attach['filename']));
  530.                         $attach['attachicon'] = attachtype($extension."\t".$attach['filetype']);
  531. $attach['attachtype'] = attachtype($extension."\t".$attach['filetype']);
  532. $attach['attachext'] = $extension;
  533. $attach['attachsize'] = sizecount($attach['filesize']);
  534.                         if($attachimgpost && in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp'))) {
  535.                                 $attach['attachimg'] = 1;
  536.   } elseif($attachimgpost && $extension == 'torrent') {
  537.         require_once $discuz_root.'./include/BDecode.php';
  538.         require_once $discuz_root.'./include/BEncode.php';
  539.         $attach['attachimg'] = 2;
  540.         $attach['attachsize'] = sizecount($attach['filesize']);
  541.         $fd = fopen($discuz_root.'./'.$attachdir.'/'.$attach['attachment'],"rb");
  542.         $alltorrent = fread($fd,$attach['filesize']);
  543.         $array = BDecode($alltorrent);
  544.                 if ($array) {
  545.                        $attach['hash'] = @sha1(BEncode($array["info"]));
  546.                        $attach['announce']=$array['announce'];
  547.                         if (sizeof($array['info']['files'])<=1) {
  548.                         $attach['btfilename']=$array['info']['name'];
  549.                         }
  550.                         else        {
  551.                         $attach['btfilename']=$array['info']['files']['name'];
  552.                         for ( $i=0 ; $i<sizeof($array['info']['files']);$i++){
  553.                                 for ($j=0;$j<sizeof($array['info']['files'][$i]['path']);$j++){
  554.                                         $attach['btfilename'].="/".$array['info']['files'][$i]['path'][$j];
  555.                                 }
  556.                                 $attach['btfilename'].='
  557.                                 ';
  558.                         }
  559.                 }
  560.                         $attach['btfilename']=postify($attach['btfilename'], 1, 0, 0, 0, 1, 1);
  561.                         unset($array);
  562.                         fclose($fd);
  563.                         //獲取信息結束:)
  564.                 $attach['btfilename'] = preg_replace("/&nbsp;/ies", "", $attach['btfilename']);
  565.                         }
  566.                         } else {
  567.                                 $attach['attachimg'] = 0;
  568.                         }
  569.                        
  570.                         $attach['dateline'] = $attach['dateline']?gmdate("$dateformat $timeformat", $attach['dateline'] + $timeoffset * 3600): '';
  571.                         $attachelist["$attach[pid]"][] = $attach;
  572.                 }
  573.         }
  574. $typearray = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
  575. if($thread['badge']) {
  576.         $string = sprintf('%02d', $thread['badge']);
  577.         $stylestr = sprintf('%03b', $string[0]);
  578.         //$thread['badge'] .= $string[1];        
  579.     } else {
  580.         $thread['badge'] = '';
  581.     }
  582.         $forumselect = $forumjump ? forumselect() : NULL;

  583.         $usesigcheck = $signature ? 'checked' : NULL;
  584.         $allowpost = (!$forum['postperm'] && $allowpost) || ($forum['postperm'] && strstr($forum['postperm'], "\t$groupid\t")) || $forum['allowpost'];
  585.         $allowpostreply = (!$thread['closed'] || $ismoderator) && (!$delayreply || ($delayreply && (($timestamp - $thread[dateline] ) < $delayreply * 86400)) || $ismoderator) && ((!$forum['replyperm'] && $allowpost) || ($forum['replyperm'] && strstr($forum['replyperm'], "\t$groupid\t")) || $forum['allowreply']);


  586.         if($delayviewcount) {
  587.                 $logfile = DISCUZ_ROOT.'./forumdata/viewcount.log';
  588.                 if(substr($timestamp, -2) == '00') {
  589.                         require DISCUZ_ROOT.'./include/misc.php';
  590.                         updateviews();
  591.                 }

  592.                 if(@$fp = fopen($logfile, 'a')) {
  593.                         fwrite($fp, "$tid\n");
  594.                         fclose($fp);
  595.                 }elseif($adminid == 1) {
  596.                         showmessage('view_log_invalid');
  597.                 }
  598.         } else {
  599.                 $db->query("UPDATE LOW_PRIORITY $table_threads SET views=views+1 WHERE tid='$tid'", 'UNBUFFERED');
  600.         }

  601.         include template('viewthread');

  602. } elseif($action == 'printable' && $tid) {

  603.         require DISCUZ_ROOT.'./include/printable.php';

  604. }

  605. ?>
复制代码
回复

使用道具 举报

 楼主| oytktk 发表于 2005-8-25 18:42:50 | 显示全部楼层
你加我的QQ95885988说吧.这里不太方便~~
回复

使用道具 举报

天下最酷 发表于 2005-8-25 21:41:37 | 显示全部楼层
加了你,没反应!
回复

使用道具 举报

天下最酷 发表于 2005-8-25 22:13:13 | 显示全部楼层
谢谢oytktk .问题已解决!
回复

使用道具 举报

wydgm 发表于 2005-8-26 08:14:27 | 显示全部楼层
再一问题。。。。发帖数累计过了一天还是和前一天一起累计~~不会清零
回复

使用道具 举报

 楼主| oytktk 发表于 2005-8-26 08:37:47 | 显示全部楼层
那可能是服务器时间和本地时间之间的冲突...

POST.PHP/viewthread.php

查找所有的:

  1. $timer=$timestamp + $timeoffset * 3600;
  2.         $todaypt=mktime(0,0,0,gmdate("m",$timer),gmdate("d",$timer),gmdate("Y",$timer));
复制代码


改成
  1.         $todaypt=mktime(0,0,0,date("m"),date("d"),date("Y"));
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-7-12 17:33 , Processed in 0.096834 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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