|
while($post = $sdb->fetch_array($query)) {
$user = array();
$on = $passstr = $ons = null;
if($post['first']==1 && strpos($post['message'],'[pass=')!==false && $on === null){
preg_match('/\[pass=(.*)\](.*)\[\/pass\]/isU',$post['message'],$passstr);
preg_match('/\[user\](.*)\[\/user\]/isU',$post['message'],$user);
unset($user[0]);
if(isset($user[1])){
$user = explode(',',$user[1]);
}else {
$user = array();
}
count($passstr)!==3 && $ons = 1;
//讓遊客永遠為假.
isset($discuz_uid)===false && $ons = 3;
if($ons === null && in_array($discuz_uid,$user)===false && isset($passs)){
$passs === $passstr[2] && $ons = 2;
if($ons === 2){
$user[] =$discuz_uid;
$user = implode(',',$user);
$post['message'] = strtr($post['message'],array('[/pass]'=>"[/pass][user]{$user}[/user]"));
$db->query("UPDATE `{$tablepre}posts` SET `message` = '{$post['message']}' WHERE `pid` = '{$post['pid']}'");
}else {
showmessage('你的答案錯誤,請重新輸入',dreferer());
}
}elseif (in_array($discuz_uid,$user)===false || $ons === 3) {
$post['htmlon'] = 1;
$post['message'] = '<br /><br /><br />
<form action="viewthread.php?tid='.$tid.'" enctype="application/x-www-form-urlencoded" method="post">
<ul style="border:1px solid #FC3; background-color:#F3F9E6;padding:8px;">
<li style="list-style:none; color:red">信息密碼: '.$passstr[1].'</li>
<li style="list-style:none;"><input name="passs" type="text" value="請輸入信息答案" onclick="this.value=\'\';this.onclick=\'\'" /><input type="submit" value="提交答案" /></li>
<li style="list-style:none;color:#06F; font-size:12px;">提示: 只有輸入用戶所設置的信息答案,才可查看用戶的主題內容</li>
</ul></form>';
}
//最後將部分內容清除:
$post['message'] = preg_replace(array('/\[pass=.*\].*\[\/pass\]/isU','/\[user\].*\[\/user\]/isU'),'',$post['message']);
}
歡迎光臨 SCLUB免費論壇申請-使用者論壇 (http://258club.com/discuz/) | Powered by Discuz! 7.2 |