[分享]兩種禁言 (月大的後台only)

提供WOG各方面的技術問題,並提供最新path更新。

版主: 涅魂, 簫哥, 10度C~

stu6707
 
文章: 162
註冊時間: 2008-10-26 1:00 pm

[分享]兩種禁言 (月大的後台only)

文章stu6707 » 2010-12-17 9:33 am

適用月大的後台外掛 & 魂大的聊天室(v1.6)

因為禁言相關的文章都是for ACP的.. ACP載點失連,只能從蕭大分享的連結下載 0.0
不過我個人比較喜歡月大版後台的排版,ACP要自己修改.. @@(懶
這裡分享的都是從
http://www.et99.org/viewtopic.php?t=35720
topic-t39448.html
這兩篇文章修改而來~

暫時禁言寫的不好 0.0 我試過在禁言玩家按鈕下面加入輸入時間的text,不過傳到adminmain.php都是空值....
所以只好多寫出個function..

請問有人能改進嗎? 謝謝~~

下面的分享如有問題,請回報 謝謝~~

2010/12/17
修改小錯誤 :oops:

第一種 - 永久禁言
這種禁言是永久的,除非把禁言玩家解禁,不然他永遠都不能說話....
月大的後台裡已經有這種禁言的部分功能了,只要加點東西就能用了~

在資料庫新增
代碼: 選擇全部
ALTER TABLE `wog_player` ADD `p_chatban` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL,
ADD `p_chatbanby` VARCHAR(11) NOT NULL;


開admin.js

代碼: 選擇全部
end[17]="清除後台操作紀錄";

下加
代碼: 選擇全部
end[18]="禁言該玩家";
end[19]="解除禁言";

代碼: 選擇全部
f.write('<tr><td><input type="button" value="解除停權" onClick="parent.act_click(\'ban_player\',\'unban\')"></td></tr>');
      }

下加
代碼: 選擇全部
f.write('<tr><td><input type="button" value="禁言玩家" onClick="parent.act_click(\'chatban\',\'ban\')"></td></tr>');
f.write('<tr><td><input type="button" value="解除禁言" onClick="parent.act_click(\'chatban\',\'unban\')"></td></tr>');


開adminmain.php
代碼: 選擇全部
case "chat":
      switch($action2)
      {
                略
      }
   break;

下加
代碼: 選擇全部
case "chatban":
      switch($action2)
      {
         case "ban":
            chatban_player();
         break;
         case "unban":
            unchatban_player();
         break;
      }
   break;

找function unchatban_player()
上加
代碼: 選擇全部
function chatban_player() //將玩家禁言
{
   global $DB_site;
   $check=$DB_site->query_first("select p_id,p_userlv,p_chatban from wog_player where p_name='".$_POST["name"]."' ");
   if(!$check)
   {
      alertWindowMsg("無此帳號");
   }
   if($check["p_chatban"]==1)
   {
      alertWindowMsg("此帳號已經被禁言");
   }
   if($check["p_userlv"]>=$_SESSION["ADMIN_LV"])
   {
      alertWindowMsg("你沒有權限禁言此玩家");
   }
   $DB_site->query("update wog_player set p_chatban=1,p_chatbanby='".$_SESSION["ADMINID"]."' where p_id=".$check["p_id"]);
   adminrecord("禁言玩家 [".$_POST["name"]."]");
   showscript("parent.admin_end(0,18,'player','view');");
}

在function unchatban_player()
代碼: 選擇全部
showscript("parent.admin_end(0,20,'player','view');");

改成
代碼: 選擇全部
showscript("parent.admin_end(0,19,'player','view');");


開chat.php
代碼: 選擇全部
//儲存格式   發言玩家ID ### 輸出模式 ### 輸出對象ID ### 輸出內容

上加
代碼: 選擇全部
if($p['p_chatban'] == "1")
         {
            echo '<font color=red><b>系統訊息</b></font>:恭喜~~你已經被遊戲管理員禁言了...^.^<br>';     
            $_error = true;
            $_rearrange=false;
         }else
         {

代碼: 選擇全部
      echo "<script language=javascript>parent.chat_input.document.frm.message.value='';parent.chat_input.document.frm.sendtime.value=".time().";</script>";  // 刪除輸入訊息並寫入說話時間

下加
代碼: 選擇全部
}

儲存關閉所有檔案

第二種 - 暫時禁言
在資料庫新增
代碼: 選擇全部
ALTER TABLE `wog_player` ADD `p_chatban_time` INT(11) UNSIGNED DEFAULT '0' NOT NULL,
ADD `p_chatbanby` VARCHAR(11) NOT NULL;


開admin.js

代碼: 選擇全部
end[17]="清除後台操作紀錄";

下加
代碼: 選擇全部
end[18]="禁言該玩家";
end[19]="解除禁言";

代碼: 選擇全部
f.write('<tr><td><input type="button" value="解除停權" onClick="parent.act_click(\'ban_player\',\'unban\')"></td></tr>');
      }

下加
代碼: 選擇全部
f.write('<tr><td><input type="button" value="禁言玩家" onClick="parent.chatban()"></td></tr>');
      f.write('<tr><td><input type="button" value="解除禁言" onClick="parent.act_click(\'chatban\',\'unban\')"></td></tr>');

代碼: 選擇全部
function adminview(a)
{

}

下加
代碼: 選擇全部
function chatban()
{
   var f=parent.main.document;
   print_header();
   f.write(table);
   f.write('<form action="adminmain.php" method="POST" target="code">');
   f.write('<tr><td>請輸入玩家名稱:<input type="text" size="6" name="chatban_name"></td></tr>');
   f.write('<tr><td>禁言時間:<input type="text" size="6" name="chatban_time">分鐘</td></tr>');
   f.write('<tr><td><input type="submit" value="禁言玩家"></td></tr>');
   f.write('<input type="hidden" name="sid" value="'+sid+'">');
   f.write('<input type="hidden" name="action1" value="chatban">');
   f.write('<input type="hidden" name="action2" value="ban">');
   f.write('</form>');
   f.write(closet);
   print_footer();
}


開adminmain.php
代碼: 選擇全部
case "chat":
      switch($action2)
      {
                略
      }
   break;

下加
代碼: 選擇全部
case "chatban":
      switch($action2)
      {
         case "ban":
            chatban_player();
         break;
         case "unban":
            unchatban_player();
         break;
      }
   break;

找function unchatban_player() //將玩家解除禁言
上加
代碼: 選擇全部
function chatban_player() //將玩家禁言
{
   global $DB_site;
   $check=$DB_site->query_first("select p_id,p_userlv,p_chatban_time from wog_player where p_name='".$_POST["chatban_name"]."' ");
   if(!$check)
   {
      alertWindowMsg("無此帳號");
   }
   if($check["p_chatban_time"]>time())
   {
      alertWindowMsg("此帳號已經被禁言");
   }
   if($check["p_userlv"]>=$_SESSION["ADMIN_LV"])
   {
      alertWindowMsg("你沒有權限禁言此玩家");
   }
   $chatban_time=$_POST["chatban_time"]*60;
   $DB_site->query("update wog_player set p_chatban_time=".(time()+$chatban_time).",p_chatbanby='".$_SESSION["ADMINID"]."' where p_id=".$check["p_id"]);
   adminrecord("禁言玩家 [".$_POST['chatban_name']."]".$_POST["chatban_time"]."分鐘");
   showscript("parent.admin_end(0,18,'player','view');");
}

在function unchatban_player() //將玩家解除禁言
代碼: 選擇全部
$check=$DB_site->query_first("select p_id,p_lock,p_chatban,p_chatbanby from wog_player where p_name='".$_POST["name"]."' ");

改成
代碼: 選擇全部
$check=$DB_site->query_first("select p_id,p_lock,p_chatban_time,p_chatbanby from wog_player where p_name='".$_POST["name"]."' ");

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

改成
代碼: 選擇全部
if($check["p_chatban_time"]<=time() || $check["p_chatban_time"]==0)

代碼: 選擇全部
$DB_site->query("update wog_player set p_chatban=0,p_chatbanby='' where p_id=".$check["p_id"]);

改成
代碼: 選擇全部
$DB_site->query("update wog_player set p_chatban_time=0,p_chatbanby='' where p_id=".$check["p_id"]);

代碼: 選擇全部
showscript("parent.admin_end(0,20,'player','view');");

改成
代碼: 選擇全部
showscript("parent.admin_end(0,19,'player','view');");


開chat.php
代碼: 選擇全部
//儲存格式   發言玩家ID ### 輸出模式 ### 輸出對象ID ### 輸出內容

上加
代碼: 選擇全部
if ($p[p_chatban_time] !='0' && $p[p_chatban_time] > time())
      {
         echo '<font color=red><b>系統訊息</b></font>:恭喜~~你已經被遊戲管理員禁言了...^.^<br>';     
         $_error = true;
         $_rearrange=false;
      }else
      {

代碼: 選擇全部
echo "<script language=javascript>parent.chat_input.document.frm.message.value='';parent.chat_input.document.frm.sendtime.value=".time().";</script>";  // 刪除輸入訊息並寫入說話時間

下加
代碼: 選擇全部
}

儲存關閉所有檔案



頭像
10度C~
 
文章: 493
註冊時間: 2005-12-22 10:25 pm

Re: [分享]兩種禁言 (月大的後台only)

文章10度C~ » 2010-12-19 6:46 pm

stu6707 寫:適用月大的後台外掛 & 魂大的聊天室(v1.6)

因為禁言相關的文章都是for ACP的.. ACP載點失連,只能從蕭大分享的連結下載 0.0
不過我個人比較喜歡月大版後台的排版,ACP要自己修改.. @@(懶
這裡分享的都是從
http://www.et99.org/viewtopic.php?t=35720
topic-t39448.html
這兩篇文章修改而來~

暫時禁言寫的不好 0.0 我試過在禁言玩家按鈕下面加入輸入時間的text,不過傳到adminmain.php都是空值....
所以只好多寫出個function..

請問有人能改進嗎? 謝謝~~

呵呵~因為ACP是我最後更新的,後來因為全面改用新的後台,所以之前的就沒再去更新了
可以給你個建議~
如果要做暫時禁言可以把時間的變數做在資料庫內
就有點像是人物鎖定那樣的做法


我的圖檔歡迎大家來玩玩<~此圖還在~表示我WOG還在= =
雖然沒有別人的好~但是還是希望可以多多推廣.....
有目標了:圖X系統 20%

stu6707
 
文章: 162
註冊時間: 2008-10-26 1:00 pm

Re: [分享]兩種禁言 (月大的後台only)

文章stu6707 » 2010-12-21 9:43 am

可是我在左邊menu那裡加入輸入時間的text,傳到adminmain.php都是空值 0.0
所以只能在admin.js加入新functino來輸入數字..




回到 Online FF Battle-WOG官方聯盟推廣處

誰在線上

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