火车头discuz6.1 完美采集的php接口文件


Posted in PHP onSeptember 13, 2009

PS:对原文件的修改较大,程序中注释已经很详尽,这里就不多说了。

<?php 
// header('Content-Type:text/html;charset=UTF-8'); 
//if(function_exists("mb_convert_encoding")){ 
// $tmp = checkAndTranslate("使用前请将该文件直接上传至论坛根目录", 0); 
// header('Content-Type:text/html;charset=UTF-8'); 
// print($tmp); 
//}else{ 
// print("NO"); 
//} 
// exit("this.line=".__line__); 
/* 
文件名:locoyonline_for_discuz610.php 
*使用前请将该文件直接上传至论坛根目录 
*本文件为GBK编码; 
*处理后导入数据库的编码为:utf-8; 
*需要替换字符时,需把replace.txt复制到同目录下; 
*/ 
//处理全局变量 
//foreach($_POST as $key => $value){ 
//$$key = $value ; 
//print($key.' = '.$value.'\n'); 
//} 
//var_dump($_POST); 
//exit('end-0'); 
// 需要插入的数据表 
// 1.cdb_threads 
// 2.cdb_rewardlog // ok 悬赏记录表 
// 3.cdb_mythreads 
// 4.cdb_posts 
// 5.cdb_tags _update 
// 6.cdb_threadtags 
// 7.cdb_forums _update 
// 8.cdb_members _update ok 更改悬赏表 
//done end ! 
$user_list = file('./makeuser/username.txt'); 
// 随机发帖的用户名单,必须是已经注册的 
// 关于批量注册用户名可以参考 Discuz 6.0+ 批量注册用户名 
$user_list = array_map("curlAndCopy", $user_list); 
function curlAndCopy($a){ 
return trim($a); 
} 
$replyusers = implode("|",$user_list); 
//处理回复的格式 
function trimAndCurl($str){ 
$str = preg_replace('/\n\s{5,}/','', $str , 1); 
$str = trim($str); 
$str = checkAndTranslate($str); 
return $str; 
} 
function checkAndTranslate($mess, $if_replace =1, $in_char_type='GBK', $out_char_type='UTF-8'){ 
//if replace ? 
if($if_replace){ 
$mess = curlAndReplace($mess); 
} 
//if chinese GBK ? 
if(preg_match('/[\x80-\xff]./', $mess) ){ 
$mess = mb_convert_encoding($mess, $out_char_type, $in_char_type); 
} 
return addslashes($mess) ; 
} 
function curlAndReplace($message){ 
$replace_list = file('./makeuser/replace.txt'); 
foreach($replace_list as $item){ 
$item = preg_replace("/\s+/","||",$item); 
$items = explode("||",$item); 
$tmp = '<!--replace-->'; 
$message = str_replace($items[0],$tmp,$message); 
$message = str_replace($items[1],$items[0],$message); 
$message = str_replace($tmp,$items[1],$message); 
} 
return $message; 
} 
define('CURSCRIPT', 'post'); 
define('NOROBOT', TRUE); 
require_once './include/common.inc.php'; 
require_once DISCUZ_ROOT.'./include/post.func.php'; 
$_DTYPE = $checkoption = $optionlist = array(); 
if($typeid) { 
threadtype_checkoption(); 
} 
require_once DISCUZ_ROOT.'./include/discuzcode.func.php'; 
$navigation = $navtitle = $thread = ''; 
//这里是新添加的代码以,开始 
if ( $lid <> "locoy" ) 
{ 
// die(验证密码错误); 
} 
//这里是添加的代码,结束, 
//rq204,Q285576545,2008.7.29 
$navigation = "» <a href=\"forumdisplay.php?fid=$fid".($extra ? '&'.preg_replace("/^(&)*/", '', $extra) : '')."\">$forum[name]</a> $navigation"; 
$navtitle = $navtitle.strip_tags($forum['name']).' - '; 
if($forum['type'] == 'sub') { 
$query = $db->query("SELECT name, fid FROM {$tablepre}forums WHERE fid='$forum[fup]'"); 
$fup = $db->fetch_array($query); 
$navigation = "» <a href=\"forumdisplay.php?fid=$fup[fid]\">$fup[name]</a> $navigation"; 
$navtitle = $navtitle.strip_tags($fup['name']).' - '; 
} 
$special = empty($special) || !is_numeric($special) || $special < 0 || $special > 6 ? 0 : intval($special); 
$allowpostattach = !empty($forum['allowpostattach']) || (!$forum['postattachperm'] && $allowpostattach) || ($forum['postattachperm'] && forumperm($forum['postattachperm'])); 
$attachextensions = $forum['attachextensions'] ? $forum['attachextensions'] : $attachextensions; 
$enctype = $allowpostattach ? 'enctype="multipart/form-data"' : ''; 
$maxattachsize_kb = $maxattachsize / 1000; 
$postcredits = $forum['postcredits'] ? $forum['postcredits'] : $creditspolicy['post']; 
$replycredits = $forum['replycredits'] ? $forum['replycredits'] : $creditspolicy['reply']; 
$digestcredits = $forum['digestcredits'] ? $forum['digestcredits'] : $creditspolicy['digest']; 
$postattachcredits = $forum['postattachcredits'] ? $forum['postattachcredits'] : $creditspolicy['postattach']; 
$maxprice = isset($extcredits[$creditstrans]) ? $maxprice : 0; 
$extra = rawurlencode($extra); 
$blogcheck = empty($isblog) && empty($addtoblog) ? '' : 'checked="checked"'; 
$notifycheck = empty($emailnotify) ? '' : 'checked="checked"'; 
$stickcheck = empty($sticktopic) ? '' : 'checked="checked"'; 
$digestcheck = empty($addtodigest) ? '' : 'checked="checked"'; 
$subject = isset($subject) ? dhtmlspecialchars(censor(trim($subject))) : ''; 
$message = isset($message) ? censor(trim($message)) : ''; 
$readperm = isset($readperm) ? intval($readperm) : 0; 
$price = isset($price) ? intval($price) : 0; 
$urloffcheck = $usesigcheck = $smileyoffcheck = $codeoffcheck = $htmloncheck = $emailcheck = ''; 
$seccodecheck = ($seccodestatus & 4) && (!$seccodedata['minposts'] || $posts < $seccodedata['minposts']); 
$secqaacheck = $secqaa['status'][2] && (!$secqaa['minposts'] || $posts < $secqaa['minposts']); 
if($iscircle = $supe['status'] && $supe['circlestatus'] && $forum['status'] == 2) { 
unset($forum['threadtypes']); 
} 
$allowpostpoll = $allowpost && $allowpostpoll && ($forum['allowpostspecial'] & 1); 
$allowposttrade = $allowpost && $allowposttrade && ($forum['allowpostspecial'] & 2); 
$allowpostreward = $allowpost && $allowpostreward && ($forum['allowpostspecial'] & 4) && isset($extcredits[$creditstrans]); 
$allowpostactivity = $allowpost && $allowpostactivity && ($forum['allowpostspecial'] & 8); 
$allowpostdebate = $allowpost && $allowpostdebate && ($forum['allowpostspecial'] & 16); 
$allowpostvideo = $allowpost && $allowpostvideo && ($forum['allowpostspecial'] & 32) && $videoopen; 
$allowanonymous = $forum['allowanonymous'] || $allowanonymous ? 1 : 0; 
$editorid = 'posteditor'; 
$editoroptions = str_pad(decbin($editoroptions), 2, 0, STR_PAD_LEFT); 
$editormode = $editormode == 2 ? $editoroptions{0} : $editormode; 
$allowswitcheditor = $editoroptions{1}; 
$advanceeditor = $special ? 0 : 1; 
$previewdisplay = !empty($previewpost) ? '' : 'none'; 
if($action == 'newthread') { 
//复制newthread.inc.php 
$discuz_action = 11; 
if(empty($forum['fid']) || $forum['type'] == 'group') { 
exit('未选择版块或版块不能发帖'); 
} 
$isblog = empty($isblog) ? '' : 'yes'; 
if($subject == '' || $message == '') { 
exit('标题或内容为空'); 
} 
if($post_invalid = checkpost()) { 
exit('标题或内容超过发帖限制'); 
} 
if($allowpostattach && is_array($_FILES['attach'])) { 
foreach($_FILES['attach']['name'] as $attachname) { 
if($attachname != '') { 
checklowerlimit($postattachcredits); 
break; 
} 
} 
} 
$typeid = isset($typeid) && isset($forum['threadtypes']['types'][$typeid]) ? $typeid : 0; 
$iconid = !empty($iconid) && isset($_DCACHE['icons'][$iconid]) ? $iconid : 0; 
$displayorder = $modnewthreads ? -2 : (($forum['ismoderator'] && !empty($sticktopic)) ? 1 : 0); 
$digest = ($forum['ismoderator'] && !empty($addtodigest)) ? 1 : 0; 
$blog = $allowuseblog && $forum['allowshare'] && !empty($addtoblog) ? 1 : 0; 
$readperm = $allowsetreadperm ? $readperm : 0; 
$isanonymous = $isanonymous && $allowanonymous ? 1 : 0; 
$price = intval($price); 
$price = $maxprice && !$special ? ($price <= $maxprice ? $price : $maxprice) : 0; 
//echo $typeid.','.','.',' 
if(!$typeid && $forum['threadtypes']['required'] && !$special) { 
// exit('未填写主题分类'); 
} 
$discuz_user=$_POST['username']; 
$discuz_user = checkAndTranslate($discuz_user, 0); 
$sql_tmp = "SELECT uid,password,secques FROM {$tablepre}members m WHERE m.username like '%$discuz_user%'"; 
$query =$db->query($sql_tmp); 
if ($rs=$db->fetch_row($query)){ 
list($discuz_uid,$discuz_pw, $discuz_secques ) =$rs; 
} 
else 
{ 
// exit('不存在的用户名'.$discuz_user); 
exit('不存在的用户名'.$sql_tmp); 
} 
//var_dump($_POST);exit('<br />this.line='.__line__); 
$messages = explode("|||",$message); 
//是否需要去除对最佳答案的评论 
//$messages = array_merge(array_slice($messages, 0, 2), array_slice($messages, 3)); 
$mc = count($messages); 
$replycount = $mc -1; 
$author = !$isanonymous ? $discuz_user : ''; 
$moderated = $digest || $displayorder > 0 ? 1 : 0; 
$attachment = ($allowpostattach && $attachments = attach_upload()) ? 1 : 0; 
$subscribed = !empty($emailnotify) && $discuz_uid ? 1 : 0; 
$supe_pushstatus = $supe['status'] && $forum['supe_pushsetting']['status'] == 1 && !$modnewthreads ? '1' : '0'; 
$sgidadd1 = $sgidadd2 = ''; 
if($iscircle) { 
$sgidadd1 = ', sgid'; 
$sgidadd2 = ", '$sgid'"; 
} 
/*预处理数据*/ 
//$price = mt_rand(3,10); 
$price = 0; 
$views = mt_rand(30,256); 
$timestamp = mt_rand(strtotime('2008-12-25') ,strtotime('2008-12-29')); 
$tagstatus = 0; 
$tags = ""; 
//已解决: 
//$price = -$price; 
//$closed = 1; 
//未解决: 
$closed = 0; 
$db->query("INSERT INTO {$tablepre}threads (fid, readperm, price, iconid, typeid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, blog,attachment, subscribed, moderated, supe_pushstatus $sgidadd1 ,special ,closed ,views) 
VALUES ('$fid', '$readperm', '$price', '$iconid', '$typeid', '$author', '$discuz_uid', '".checkAndTranslate($subject)."', '$timestamp', '$timestamp', '$author', '$displayorder', '$digest', '$blog', '$attachment', '$subscribed', '$moderated', '$supe_pushstatus' $sgidadd2 ,0 ,$closed ,$views )"); 
$tid = $db->insert_id(); 
// making reward logs ! 
$db->query("INSERT INTO {$tablepre}rewardlog (tid,authorid,netamount,dateline) VALUES ('$tid', '$discuz_uid', '$price', '0')"); 
// updating members logs ! 
//if minus credits ? 
//$db->query("UPDATE {$tablepre}members SET posts=posts+1,credits=credits+$price,lastpost='".$_SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' "); 
$db->query("UPDATE {$tablepre}members SET posts=posts+1,lastpost='".$_SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' "); 
if($subscribed) { 
$db->query("REPLACE INTO {$tablepre}subscriptions (uid, tid, lastpost, lastnotify) 
VALUES ('$discuz_uid', '$tid', '$timestamp', '$timestamp')", 'UNBUFFERED'); 
} 
$db->query("REPLACE INTO {$tablepre}mythreads (uid, tid, dateline, special) VALUES ('$discuz_uid', '$tid', '$timestamp', '0')", 'UNBUFFERED'); 
if($moderated) { 
updatemodlog($tid, ($displayorder > 0 ? 'STK' : 'DIG')); 
updatemodworks(($displayorder > 0 ? 'STK' : 'DIG'), 1); 
} 
if($forum['threadtypes']['special'][$typeid] && $optiondata && is_array($optiondata)) { 
foreach($optiondata as $optionid => $value) { 
$db->query("INSERT INTO {$tablepre}typeoptionvars (typeid, tid, optionid, value, expiration) 
VALUES ('$typeid', '$tid', '$optionid', '$value', '".($typeexpiration ? $timestamp + $typeexpiration : 0)."')"); 
} 
} 
$bbcodeoff = checkbbcodes($message, !empty($bbcodeoff)); 
$smileyoff = checksmilies($message, !empty($smileyoff)); 
$parseurloff = !empty($parseurloff); 
//$htmlon = bindec(($tagstatus && !empty($tagoff) ? 1 : 0).($allowhtml && !empty($htmlon) ? 1 : 0)); 
$htmlon = 1; 
$pinvisible = $modnewthreads ? -2 : 0; 
$db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment) 
VALUES ('$fid', '$tid', '1', '$discuz_user', '$discuz_uid', '$subject', '$timestamp', '".checkAndTranslate($messages[0])."', '$onlineip', '$pinvisible', '$isanonymous', '$usesig', '$htmlon', '$bbcodeoff', '$smileyoff', '$parseurloff', '$attachment')"); 
$pid = $db->insert_id(); 
if($tagstatus && $tags != '') { 
$tags = str_replace(array(chr(0xa1).chr(0xa1), chr(0xa1).chr(0x40), chr(0xe3).chr(0x80).chr(0x80)), ' ', $tags); 
$tagarray = array_unique(explode(' ', censor($tags))); 
$tagcount = 0; 
foreach($tagarray as $tagname) { 
$tagname = trim($tagname); 
if(preg_match('/^([\x7f-\xff_-]|\w){3,20}$/', $tagname)) { 
$query = $db->query("SELECT closed FROM {$tablepre}tags WHERE tagname='".checkAndTranslate($tagname, 0)."'"); 
if($db->num_rows($query)) { 
if(!$tagstatus = $db->result($query, 0)) { 
$db->query("UPDATE {$tablepre}tags SET total=total+1 WHERE tagname='".checkAndTranslate($tagname, 0)."'", 'UNBUFFERED'); 
} 
} else { 
$db->query("INSERT INTO {$tablepre}tags (tagname, closed, total) 
VALUES ('".checkAndTranslate($tagname, 0)."', 0, 1)", 'UNBUFFERED'); 
$tagstatus = 0; 
} 
if(!$tagstatus) { 
$db->query("INSERT {$tablepre}threadtags (tagname, tid) VALUES ('".checkAndTranslate($tagname, 0)."', $tid)", 'UNBUFFERED'); 
} 
$tagcount++; 
if($tagcount > 4) { 
unset($tagarray); 
break; 
} 
} 
} 
} 
$tradeaid = 0; 
if($attachment) { 
$searcharray = $pregarray = $replacearray = array(); 
foreach($attachments as $key => $attach) { 
$db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, description, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote) 
VALUES ('$tid', '$pid', '$timestamp', '$attach[perm]', '$attach[price]', '$attach[name]', '$attach[description]', '$attach[type]', '$attach[size]', '$attach[attachment]', '0', '$attach[isimage]', '$attach[uid]', '$attach[thumb]', '$attach[remote]')"); 
$searcharray[] = '[local]'.$localid[$key].'[/local]'; 
$pregarray[] = '/\[localimg=(\d{1,3}),(\d{1,3})\]'.$localid[$key].'\[\/localimg\]/is'; 
$replacearray[] = '[attach]'.$db->insert_id().'[/attach]'; 
} 
$message = str_replace($searcharray, $replacearray, preg_replace($pregarray, $replacearray, $message)); 
$db->query("UPDATE {$tablepre}posts SET message='".checkAndTranslate($message, 0)."' WHERE pid='$pid'"); 
updatecredits($discuz_uid, $postattachcredits, count($attachments)); 
} 
if($iscircle && $sgid) { 
supe_dbconnect(); 
$query = $supe['db']->query("UPDATE {$supe[tablepre]}groups SET lastpost='$timestamp' WHERE gid='$sgid'", 'SILENT'); 
} 
if($modnewthreads) { 
$db->query("UPDATE {$tablepre}forums SET todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); 
} else { 
if($digest) { 
foreach($digestcredits as $id => $addcredits) { 
$postcredits[$id] = (isset($postcredits[$id]) ? $postcredits[$id] : 0) + $addcredits; 
} 
} 
updatepostcredits('+', $discuz_uid, $postcredits); 
$subject = str_replace("\t", ' ', $subject); 
$lastpost = "$tid\t".checkAndTranslate($subject)."\t$timestamp\t$author"; 
$db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); 
if($forum['type'] == 'sub') { 
$db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$forum[fup]'", 'UNBUFFERED'); 
} 
} 
echo("成功发表主题|".$tid); 
} 
if($replycount) 
{ 
//开始发布回复 
$discuz_action = 12; 
require_once DISCUZ_ROOT.'./include/forum.func.php'; 
print_r($replyuser); 
$replyusers = explode("|",$replyusers); 
$reusercount = count($replyusers); 
for($re=1;$re<=$replycount;$re++) 
{ 
$index = mt_rand(1,$reusercount-1); 
while( in_array( $index ,$post_arr ) || $replyusers[$index] ==$_POST['username'] ){ 
$index = mt_rand(1,$reusercount-1); 
} 
$post_arr[] = $index; 
$discuz_user = $replyusers[$index]; 
$discuz_user = checkAndTranslate($discuz_user, 0); 
$query =$db->query("SELECT uid,password,secques FROM {$tablepre}members m WHERE m.username like '%$discuz_user%'"); 
if ($rs=$db->fetch_row($query)){ 
list($discuz_uid,$discuz_pw, $discuz_secques ) =$rs; 
} 
else 
{ 
echo('不存在的用户名'.$discuz_user); 
continue; 
} 
$attachnum = 0; 
if($allowpostattach && !empty($_FILES['attach']) && is_array($_FILES['attach'])) { 
foreach($_FILES['attach']['name'] as $attachname) { 
if($attachname != '') { 
$attachnum ++; 
} 
} 
$attachnum && checklowerlimit($postattachcredits, $attachnum); 
} else { 
$_FILES = array(); 
} 
$attachments = $attachnum ? attach_upload() : array(); 
$attachment = empty($attachments) ? 0 : 1; 
$subscribed = $thread['subscribed'] && $timestamp - $thread['lastpost'] < 7776000; 
$newsubscribed = !empty($emailnotify) && $discuz_uid; 
if($subscribed && !$modnewreplies) { 
$db->query("UPDATE {$tablepre}subscriptions SET lastpost='$timestamp' WHERE tid='$tid' AND uid<>'$discuz_uid'", 'UNBUFFERED'); 
} 
if($newsubscribed) { 
$db->query("REPLACE INTO {$tablepre}subscriptions (uid, tid, lastpost, lastnotify) 
VALUES ('$discuz_uid', '$tid', '".($modnewreplies ? $thread['lastpost'] : $timestamp)."', '$timestamp')", 'UNBUFFERED'); 
} 
$bbcodeoff = checkbbcodes($message, !empty($bbcodeoff)); 
$smileyoff = checksmilies($message, !empty($smileyoff)); 
$parseurloff = !empty($parseurloff); 
// $htmlon = $allowhtml && !empty($htmlon) ? 1 : 0; 
$htmlon = 1; 
$usesig = !empty($usesig) ? 1 : 0; 
$isanonymous = $allowanonymous && !empty($isanonymous)? 1 : 0; 
//$discuz_user = checkAndTranslate($discuz_user, 0); 
$author = empty($isanonymous) ? $discuz_user : ''; 
$pinvisible = $modnewreplies ? -2 : 0; 
$rand_time = mt_rand(150,3600); 
$timestamp = $timestamp + $rand_time; 
$db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment) 
VALUES ('$fid', '$tid', '0', '$discuz_user', '$discuz_uid', '', '$timestamp', '".trimAndCurl($messages[$re])."', '$onlineip', '$pinvisible', '$isanonymous', '$usesig', '$htmlon', '$bbcodeoff', '$smileyoff', '$parseurloff', '$attachment')"); 
$pid = $db->insert_id(); 
// updating reward logs 
$db->query("UPDATE {$tablepre}rewardlog SET answererid='$discuz_uid',dateline='$timestamp' WHERE tid='$tid'"); 
// updating members logs ! 
if($re == 1){ 
//添加积分问题 
$db->query("UPDATE {$tablepre}members SET posts=posts+1,credits=credits+$price,lastpost='".$_SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' "); 
}else{ 
$db->query("UPDATE {$tablepre}members SET posts=posts+1,lastpost='".$_SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' "); 
} 
$db->query("REPLACE INTO {$tablepre}myposts (uid, tid, pid, position, dateline, special) VALUES ('$discuz_uid', '$tid', '$pid', '".($thread['replies'] + 1)."', '$timestamp', '0')", 'UNBUFFERED'); 
$tradeaid = 0; 
if($attachment) { 
$searcharray = $pregarray = $replacearray = array(); 
foreach($attachments as $key => $attach) { 
$db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, description, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote) 
VALUES ('$tid', '$pid', '$timestamp', '$attach[perm]', '$attach[price]', '$attach[name]', '$attach[description]', '$attach[type]', '$attach[size]', '$attach[attachment]', '0', '$attach[isimage]', '$attach[uid]', '$attach[thumb]', '$attach[remote]')"); 
$searcharray[] = '[local]'.$localid[$key].'[/local]'; 
$pregarray[] = '/\[localimg=(\d{1,3}),(\d{1,3})\]'.$localid[$key].'\[\/localimg\]/is'; 
$insertid = $db->insert_id(); 
$replacearray[] = '[attach]'.$insertid.'[/attach]'; 
} 
if(!empty($trade) && $thread['special'] == 2 && !empty($_FILES['tradeattach']['tmp_name'][0])) { 
$tradeaid = $insertid; 
} 
$message = str_replace($searcharray, $replacearray, preg_replace($pregarray, $replacearray, $message)); 
$db->query("UPDATE {$tablepre}posts SET message='".checkAndTranslate($message)."' WHERE pid='$pid'"); 
updatecredits($discuz_uid, $postattachcredits, count($attachments)); 
} 
if($modnewreplies) { 
$db->query("UPDATE {$tablepre}forums SET todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); 
if($newsubscribed) { 
$db->query("UPDATE {$tablepre}threads SET subscribed='1' WHERE tid='$tid'", 'UNBUFFERED'); 
} 
} else { 
$db->query("UPDATE {$tablepre}threads SET lastposter='$author', lastpost='$timestamp', replies=replies+1 ".($attachment ? ', attachment=\'1\'' : '').", subscribed='".($subscribed || $newsubscribed ? 1 : 0)."' WHERE tid='$tid'", 'UNBUFFERED'); 
updatepostcredits('+', $discuz_uid, $replycredits); 
$lastpost = "$thread[tid]\t".checkAndTranslate($thread['subject'])."\t$timestamp\t$author"; 
$db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost', posts=posts+1, todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); 
if($forum['type'] == 'sub') { 
$db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$forum[fup]'", 'UNBUFFERED'); 
} 
} 
echo "成功回复"; 
} 
} 
//exit('Run end.this.line='.__line__);
PHP 相关文章推荐
PHP使用者状态管理功能的应用
Oct 09 PHP
php使用base64加密解密图片示例分享
Jan 20 PHP
php教程之phpize使用方法
Feb 12 PHP
php 伪造ip以及url来路信息方法汇总
Nov 25 PHP
php抽象类使用要点与注意事项分析
Feb 09 PHP
php使用memcoder将视频转成mp4格式的方法
Mar 12 PHP
THINKPHP支持YAML配置文件的设置方法
Mar 17 PHP
PHP中的traits简单使用实例
May 13 PHP
php版银联支付接口开发简明教程
Oct 14 PHP
php微信公众平台示例代码分析(二)
Dec 06 PHP
ThinkPHP 整合Bootstrap Ajax分页样式
Dec 23 PHP
Yii输入正确验证码却验证失败的解决方法
Jun 06 PHP
PHP 分页类(模仿google)-面试题目解答
Sep 13 #PHP
frename PHP 灵活文件命名函数 frename
Sep 09 #PHP
PHPLog php 程序调试追踪工具
Sep 09 #PHP
php 从数据库提取二进制图片的处理代码
Sep 09 #PHP
封装一个PDO数据库操作类代码
Sep 09 #PHP
PHP 数组遍历顺序理解
Sep 09 #PHP
PHP 裁剪图片成固定大小代码方法
Sep 09 #PHP
You might like
由php的call_user_func传reference引发的思考
2010/07/23 PHP
php数组函数序列之array_values() 获取数组元素值的函数与方法
2011/10/30 PHP
PHP中空字符串介绍0、null、empty和false之间的关系
2012/09/25 PHP
使用php实现快钱支付功能(涉及到接口)
2013/07/01 PHP
PHP set_error_handler()函数使用详解(示例)
2013/11/12 PHP
PHP实现登录验证码校验功能
2018/05/17 PHP
FCK调用方法..
2006/12/21 Javascript
javascript 面向对象编程 万物皆对象
2009/09/17 Javascript
简单的代码实现jquery定时器
2014/01/03 Javascript
javascript弹出带文字信息的提示框效果
2016/07/19 Javascript
微信小程序 自己制作小组件实例详解
2016/12/22 Javascript
nodejs连接mysql数据库简单封装示例-mysql模块
2017/04/10 NodeJs
vue2 中如何实现动态表单增删改查实例
2017/06/09 Javascript
如何重置vue打印变量的显示方式
2017/12/06 Javascript
解决vue-cli脚手架打包后vendor文件过大的问题
2018/09/27 Javascript
jQuery插件实现非常实用的tab栏切换功能【案例】
2019/02/18 jQuery
详解webpack 最简打包结果分析
2019/02/20 Javascript
Vue.js如何使用Socket.IO的示例代码
2019/09/05 Javascript
原生JS与CSS实现软件卸载对话框功能
2019/12/05 Javascript
原生js实现文件上传、下载、封装等实例方法
2020/01/05 Javascript
js实现移动端吸顶效果
2020/01/08 Javascript
[38:23]2014 DOTA2国际邀请赛中国区预选赛 5 23 CIS VS LGD第一场
2014/05/24 DOTA
[01:02:07]Liquid vs Newbee 2019国际邀请赛小组赛 BO2 第一场 8.15
2019/08/16 DOTA
windows 下python+numpy安装实用教程
2017/12/23 Python
python创建文件备份的脚本
2018/09/11 Python
pycharm设置鼠标悬停查看方法设置
2019/07/29 Python
python程序中的线程操作 concurrent模块使用详解
2019/09/23 Python
关于Numpy中的行向量和列向量详解
2019/11/30 Python
Python 序列化和反序列化库 MarshMallow 的用法实例代码
2020/02/25 Python
汽车运用工程毕业生自荐信
2013/10/29 职场文书
大三学生入党思想汇报
2014/01/02 职场文书
写自荐信的注意事项
2014/03/09 职场文书
大一新生军训新闻稿
2015/07/17 职场文书
小学教师教育随笔
2015/08/14 职场文书
vue完美实现el-table列宽自适应
2021/05/08 Vue.js
关于mysql中string和number的转换问题
2022/06/14 MySQL