[分享]暫時禁言

WOG設定安裝教學

版主: 涅魂, 簫哥

怪人
 
文章: 60
註冊時間: 2007-03-02 9:45 pm

[分享]暫時禁言

文章怪人 » 2007-06-12 5:59 pm

請先到http://www.2233.idv.tw/viewtopic.php?t=35720加入禁言功能
本篇適合用於ACP for 3.0 管理台 和 (3.0)聊天室 Ver 1.5 beta

在資料庫新增
代碼: 選擇全部
ALTER TABLE `wog_player` ADD `p_chatban_time` INT( 11 ) UNSIGNED DEFAULT '0' NOT NULL ;


開啟acpmain.php
代碼: 選擇全部
case "暫時封閉":
print_header();
temp_lock();
print_footer();
break;


覆蓋為
代碼: 選擇全部
case "暫時封閉":
print_header();
temp_lock();
print_footer();
break;

case "暫時禁言":
print_header();
temp_chatban();
print_footer();
break;



代碼: 選擇全部
function temp_lock()
{
check_ulv();
global $DB_site;
$lock_time = $_POST["lock_time"] *60;
$DB_site->query("update wog_player set p_lock_time=".(time() + $lock_time)." where p_name  ='".$_POST["target_name"]."'");
echo ("<br><b><font color='Red'>".$_POST["target_name"]." 已被封鎖 ".$_POST["lock_time"]."分鐘。</font></b>");


下加上
代碼: 選擇全部
function temp_chatban()
{
check_ulv();
global $DB_site;
$chatban_time = $_POST["chatban_time"] *60;
$DB_site->query("update wog_player set p_chatban_time=".(time() + $chatban_time)." where p_name  ='".$_POST["target_name"]."'");
echo ("<br><b><font color='Red'>".$_POST["target_name"]." 已被禁言 ".$_POST["chatban_time"]."分鐘。</font></b>");


開啟acpleft.php


代碼: 選擇全部
                <?}?>
      <tr>
         <td align="left">
         <p><font size="1" face="新細明體">
         <input class="text" type="submit" value="登出" name="actions"></font>
                        </td>

上加上
代碼: 選擇全部
                <tr>
         <td align="left">
         <p><input class="text" type="submit" value="暫時禁言" name="actions"> <input class="text" type="text" size="2" value="3" name="chatban_time"><font size="2">分鐘</font></td>
      </tr>


開啟chat.php


代碼: 選擇全部
if($p['p_chatban'] == "1")

改為
代碼: 選擇全部
if ($p[p_chatban_time] !=0 and $p[p_chatban_time] > time())



代碼: 選擇全部
$p =  $DB_site->query_first('SELECT p_name,p_userlv,p_chatban FROM wog_player WHERE p_id = '.$p['p_id']);

改為
代碼: 選擇全部
$p =  $DB_site->query_first('SELECT p_name,p_userlv,p_chatban,p_chatban_time FROM wog_player WHERE p_id = '.$p['p_id']);



代碼: 選擇全部
$p =  $DB_site->query_first('SELECT p_name,p_userlv,p_chatban,p_id FROM wog_player WHERE p_id = '.$p['p_id']);


覆蓋為

代碼: 選擇全部
$p =  $DB_site->query_first('SELECT p_name,p_userlv,p_chatban,p_id,p_chatban_time FROM wog_player WHERE p_id = '.$p['p_id']);



開啟
acpmain.php

搜尋

代碼: 選擇全部
if ($check["p_chatban"] !=1)

覆蓋為

代碼: 選擇全部
if ($check["p_chatban_time"] !=1)


搜尋

代碼: 選擇全部
$DB_site->query("update wog_player set p_chatban='0' where p_name  ='".$_POST["target_name"]."' ");


覆蓋為

代碼: 選擇全部
$DB_site->query("update wog_player set p_chatban_time='0' where p_name  ='".$_POST["target_name"]."' ");


搜尋
代碼: 選擇全部
$check=$DB_site->query_first("select p_name, p_chatban, p_userlv, p_chatbanby from wog_player where p_name ='".$_POST["target_name"]."'");


覆蓋為
代碼: 選擇全部
$check=$DB_site->query_first("select p_name, p_chatban, p_userlv, p_chatbanby,p_chatban_time from wog_player where p_name ='".$_POST["target_name"]."'");


搜尋
代碼: 選擇全部
                $DB_site->query("update wog_player set p_chatban='0' where p_name  ='".$_POST["target_name"]."' ");


覆蓋為
代碼: 選擇全部
                $DB_site->query("update wog_player set p_chatban_time='0' where p_name  ='".$_POST["target_name"]."' ");



最後由 怪人 於 2007-06-27 4:25 pm 編輯,總共編輯了 25 次。

怪人
 
文章: 60
註冊時間: 2007-03-02 9:45 pm

文章怪人 » 2007-06-12 6:07 pm

將暫時禁言加入聊天紀錄
代碼: 選擇全部
[color=red]開啟acpmain.php[/color]



echo ("<br><b><font color='Red'>".$_POST["target_name"]." 已被禁言 ".$_POST["chatban_time"]."分鐘。</font></b>");

下加上

   $s='###1###0###<b><font color="Red">***'.$_SESSION['ADMINID'].' 於('.date("H:i").')將使用者帳號:('.$_POST['target_name'].') 禁言。***</font></b>';
         $fp = fopen("chat_log.txt",'a+');
         while(!is_writeable("chat_log.txt")){}
         fputs($fp,$s."\r\n");
         fclose($fp);
         unset($s);
         unset($fp);

[quote="涅魂"]<u>積分 +1</u>

分享修改

at 2007-06-12 06:32 pm[/point]




涅魂
 
文章: 4463
註冊時間: 2004-01-04 11:17 am
來自: Taiwan
性別: 男生

文章涅魂 » 2007-06-12 7:02 pm

喔喔,好久不見的分享

雖然是修復之前的功能,但從您的修改紀錄來看您可以知道您非常用心呢^^

謝謝您的分享囉 :wink:


圖檔

怪人
 
文章: 60
註冊時間: 2007-03-02 9:45 pm

文章怪人 » 2007-06-12 7:59 pm

因為我也很喜歡WOG啊^^

我在聊天室加上禁言的時間
但一直都是顯示程式碼
請問應該怎麼修改?




涅魂
 
文章: 4463
註冊時間: 2004-01-04 11:17 am
來自: Taiwan
性別: 男生

文章涅魂 » 2007-06-12 8:49 pm

在這部分的後面加上else的敘述
代碼: 選擇全部
if ($p[p_chatban_time] !=0 and $p[p_chatban_time] > time())

而else的內容則參照其他顯示錯誤的部分來修改即可^^


圖檔

呀成
 
文章: 525
註冊時間: 2006-01-11 2:20 pm
來自: 香港天水圍

文章呀成 » 2007-06-13 8:47 pm

為什麼我加入顯示暫時禁言(後台)

//檢視禁言使用者
代碼: 選擇全部
function view_chatban_player()
{
global $DB_site;
$player = $DB_site->query("Select * from wog_player where p_chatban='1'");
echo "<BR>顯示永久禁言玩家";
viewplayer_sub($player);
$player = $DB_site->query("Select * from wog_player where p_chatban_time > $timecut");
echo "<BR>顯示暫時禁言玩家";
viewplayer_sub($player);
}


一按檢視禁言玩家就…
There seems to have been a slight problem with the database.
Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.

Database error in WOG : Invalid SQL: Select * from wog_player where p_chatban_time > mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 mysql error number: 1064 Date: Wednesday 13th of June 2007 08:46:34 PM Script:




涅魂
 
文章: 4463
註冊時間: 2004-01-04 11:17 am
來自: Taiwan
性別: 男生

文章涅魂 » 2007-06-14 12:47 am

代碼: 選擇全部
Select * from wog_player where p_chatban_time >

從SQL的結果可得知p_chatban_time的邏輯範圍有問題,他是大於什麼呢?

這可能是您的程式中變數名稱的錯誤,檢查看看吧^^


圖檔

頭像
齋月
 
文章: 557
註冊時間: 2006-02-27 7:54 am

文章齋月 » 2007-06-14 7:05 am

涅魂 寫:喔喔,好久不見的分享

雖然是修復之前的功能,但從您的修改紀錄來看您可以知道您非常用心呢^^

謝謝您的分享囉 :wink:



沒錯沒錯... 真的是久違的第一篇 :D

繼續搶救課業 :face8:



呀成
 
文章: 525
註冊時間: 2006-01-11 2:20 pm
來自: 香港天水圍

文章呀成 » 2007-06-14 7:08 am

已經發現問題出錯原因

已經好了



怪人
 
文章: 60
註冊時間: 2007-03-02 9:45 pm

文章怪人 » 2007-06-20 7:32 pm

開啟chat.php
搜尋
代碼: 選擇全部
$p =  $DB_site->query_first('SELECT p_name,p_userlv,p_chatban,p_id FROM wog_player WHERE p_id = '.$p['p_id']);


覆蓋為

代碼: 選擇全部
$p =  $DB_site->query_first('SELECT p_name,p_userlv,p_chatban,p_id,p_chatban_time FROM wog_player WHERE p_id = '.$p['p_id']);



開啟
acpmain.php

搜尋

代碼: 選擇全部
if ($check["p_chatban"] !=1)

覆蓋為

代碼: 選擇全部
if ($check["p_chatban_time"] !=1)


搜尋

代碼: 選擇全部
$DB_site->query("update wog_player set p_chatban='0' where p_name  ='".$_POST["target_name"]."' ");


覆蓋為

代碼: 選擇全部
$DB_site->query("update wog_player set p_chatban_time='0' where p_name  ='".$_POST["target_name"]."' ");


搜尋
代碼: 選擇全部
$check=$DB_site->query_first("select p_name, p_chatban, p_userlv, p_chatbanby from wog_player where p_name ='".$_POST["target_name"]."'");


覆蓋為

代碼: 選擇全部
$check=$DB_site->query_first("select p_name, p_chatban, p_userlv, p_chatbanby,p_chatban_time from wog_player where p_name ='".$_POST["target_name"]."'");





回到 精華區

誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 3 位訪客