• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Ban IP of user for a time

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
15 posts • Page 1 of 1

Postby andro » Tue Jul 13, 2010 1:58 pm

This make possible to ban user IP for example 60 minuts after thet time he can cheat (sorry for my bad English)
Make backup of your chat before start editing source code.

Ban IP time usage
/baniptime {nickname} {ip} {time minutes} [ {reason} ]

ex. /baniptime user3 60.100.112.15 60

Unban:
/unbaniptime {ip} or /unbaniptime all

Finde in pfc/src/proxies/auth.class.php
Code: Select all
      if ($banlist == NULL) $banlist = array(); else $banlist = unserialize($banlist);
      $nickid = $u->nickid;
      if (in_array($nickid,$banlist))
      {
        // the user is banished, show a message and don't forward the /join command
        $msg = _pfc("Can't join %s because you are banished", $param);
        $xml_reponse->script("pfc.handleResponse('".$this->proxyname."', 'ban', '".addslashes($msg)."');");
        return false;
      }

Replace width
Code: Select all
      if ($banlist == NULL) $banlist = array(); else $banlist = unserialize($banlist);
      $nickid = $u->nickid;
      if (in_array($nickid,$banlist))
      {
        // the user is banished, show a message and don't forward the /join command
        $msg = _pfc("Can't join %s because you are banished", $param);
        $xml_reponse->script("pfc.handleResponse('".$this->proxyname."', 'ban', '".addslashes($msg)."');");
        return false;
      }

     // ban ip time list
     $baniplist = $container->getChanMeta('baniptime', 'baniplist_nickid');
     if ($baniplist == NULL) $baniplist = array(); else $baniplist = unserialize($baniplist);
     $ip=@$_SERVER['REMOTE_ADDR'];
     //$nickid = $u->nickid;
     //echo 'alert("IP ban")';
      foreach ($baniplist as $tempone) {       
      if($tempone[1] == $ip && $tempone[2] > date('c')){
      // the user is banished, show a message and don't forward the /join command      
      $wr = "Can't join because your ip is blocked ".$ip." to time: ". $tempone[2] ;
        $msg = _pfc($wr, $param);
        $xml_reponse->script("pfc.handleResponse('".$this->proxyname."', 'ban', '".addslashes($wr)."');");
        return false;      
       }
     }

Make file pfc/src/commands/baniptime.class.php

Code: Select all
<?php

require_once(dirname(__FILE__)."/../pfccommand.class.php");

class pfcCommand_baniptime extends pfcCommand
{
  var $usage = "/baniptime {nickname} {ip} [ {reason} ]";
 
  function run(&$xml_reponse, $p)
  {
    $clientid    = $p["clientid"];
    $param       = $p["param"];
    $params      = $p["params"];
    $sender      = $p["sender"];
    $recipient   = $p["recipient"];
    $recipientid = $p["recipientid"];
   
    $c =& pfcGlobalConfig::Instance();
    $u =& pfcUserConfig::Instance();

    $nick   = isset($params[0]) ? $params[0] : '';
    $ip = isset($params[1]) ? $params[1] : '';
   $timeban = isset($params[2]) ? $params[2] : '';
   $reason = isset($params[3]) ? $params[3] : '';
   
    if ($reason == '') $reason = _pfc("no reason");

    // to allow unquotted reason
    if (count($params) > 2)
      for ($x=2;$x<count($params);$x++)
        $reason.=" ".$params[$x];
   
    $channame = $u->channels[$recipientid]["name"];
   
    if ($nick == '')
    {
      // error
      $cmdp = $p;
      $cmdp["param"] = "Missing parameter: nick";
      $cmdp["param"] .= " (".$this->usage.")";
      $cmd =& pfcCommand::Factory("error");
      $cmd->run($xml_reponse, $cmdp);
      return;
    }
   
   if (ip == '')
    {
      // error
      $cmdp = $p;
      $cmdp["param"] = "Missing parameter: ip";
      $cmdp["param"] .= " (".$this->usage.")";
      $cmd =& pfcCommand::Factory("error");
      $cmd->run($xml_reponse, $cmdp);
      return;
    }

    $ct =& pfcContainer::Instance();
    $nickidtoban = $ct->getNickId($nick);
   
    // notify all the channel
    $cmdp = $p;
    $cmdp["param"] = $nick." ip banished from ".$channame." by ". $sender;
    $cmdp["flag"]  = 1;
    $cmd =& pfcCommand::Factory("notice");
    $cmd->run($xml_reponse, $cmdp);
   
    // kick the user (maybe in the future, it will be dissociate in a /kickban command)
    $cmdp = $p;
    $cmdp["params"]   = array();
    $cmdp["params"][] = $nick; // nickname to kick
    $cmdp["params"][] = $reason; // reason
    $cmd =& pfcCommand::Factory("kick");
    $cmd->run($xml_reponse, $cmdp);

    // update the recipient banlist
    $baniplist = $ct->getChanMeta('baniptime', 'baniplist_nickid');
       if ($baniplist == NULL)
      $baniplist = array();
    else
       $baniplist = unserialize($baniplist);
      
   // searching a removeing old bans
     $updated = false;
     $newban = array();
     foreach ($baniplist as $tempone) {
       if($tempone[2] > date('c'))
         $newban[]=$tempone;
     }   
     $baniplist = $newban;
   
   
   $baniplist[] = array($nickidtoban, $ip, date('c', mktime(date("H"),date("i")+$timeban,date("s"),date("m"),date("d"),date("Y"))));
   // append the nickid to the banlist
   $msg="Nick: ".$nickidtoban ." widt ip: ". $ip."is banishet for time: ". date('c', mktime(date("H"),date("i")+$timeban,date("s"),date("m"),date("d"),date("Y")));
   $xml_reponse->script("pfc.handleResponse('banlist', 'ok', '".addslashes($msg)."');");
   $ct->setChanMeta('baniptime', 'baniplist_nickid', serialize($baniplist));
  }
}

?>

Make file pfc/src/commands/baniptimelist.class.php
Code: Select all
<?php

require_once(dirname(__FILE__)."/../pfccommand.class.php");

/**
 * This command list the banished users on the given channel
 *
 * @author Stephane Gully <stephane.gully@gmail.com>
 */
class pfcCommand_baniptimelist extends pfcCommand
{
  var $desc = "This command list the banished users on the given channel";
 
  function run(&$xml_reponse, $p)
  {
    $c =& pfcGlobalConfig::Instance();
    $u =& pfcUserConfig::Instance();
   
    $ct =& pfcContainer::Instance();
    $baniplist = $ct->getChanMeta('baniptime', 'baniplist_nickid');
       
    if ($baniplist == NULL) $baniplist = array(); else $baniplist = unserialize($baniplist);
    $msg  = "";
    $msg .= "<p>"."The time ip banished user list is:"."</p>";
    if (count($baniplist)>0)
    {
     $msg .= "<ul>";
     foreach ($baniplist as $tempone) {
//      foreach ($tempone as $key=>$temptwo) {
//        echo $key.":".$temptwo."n";
//      }
//      echo "</br>";
      $n = $ct->getNickname($tempone[0]);
      $msg .= "<li style="margin-left:50px">".$n." width ip: ".$tempone[1]." to time: ".$tempone[2]. " now is: ".date("c")."</li>";
     }
     $msg .= "</ul>";
    }
    else
    {
      $msg .= "<p>("._pfc("Empty").")</p>";
    }
    $msg .= "<p>"._pfc("'/unbanip {ip}' will unban the user identified by {nickname}")."</p>";
    $msg .= "<p>"._pfc("'/unbanip all'  will unban all the users on this channel")."</p>";
     
    $xml_reponse->script("pfc.handleResponse('banlist', 'ok', '".addslashes($msg)."');");
  }
}

?>

Make file pfc/src/commands/unbaniptime.class.php
Code: Select all
<?php
require_once(dirname(__FILE__)."/../pfccommand.class.php");
class pfcCommand_unbaniptime extends pfcCommand
{
  var $usage = "/unbaniptime {ip} or /unbaniptime all";
 
  function run(&$xml_reponse, $p)
  {
    $clientid    = $p["clientid"];
    $param       = $p["param"];
    $params      = $p["params"];
    $sender      = $p["sender"];
    $recipient   = $p["recipient"];
    $recipientid = $p["recipientid"];
   
    $c =& pfcGlobalConfig::Instance();
    $u =& pfcUserConfig::Instance();
    $ct =& pfcContainer::Instance();
    $ip = isset($params[0]) ? $params[0] : '';
     
    if ($ip == "")
    {
      // error
      $cmdp = $p;
      $cmdp["param"] = "Missing parameter: ip";
      $cmdp["param"] .= " (".$this->usage.")";
      $cmd =& pfcCommand::Factory("error");
      $cmd->run($xml_reponse, $cmdp);
      return;
    }
   
    $updated = false;
    $msg = "<p>"."Nobody has been unbanipished"."</p>";
   
    // update the recipient banlist
    $baniplist = $ct->getChanMeta('baniptime', 'baniplist_nickid');
    if ($baniplist == NULL)
      $baniplist = array();
    else
      $baniplist = unserialize($baniplist);
    $nb = count($baniplist);
   $allnickid=array();
   $newban = array();
   foreach ($baniplist as $tempone) {
      
       if($tempone[1] != $ip)
         $newban[]=$tempone;
      else{
         $updated = true;
         $msg = "<p>NOo</p>";
      }
   }
    if ($updated){ 
        $ct->setChanMeta('baniptime', 'baniplist_nickid', serialize($newban));
      $msg = "<p>".$ip." has been unbanipished"."</p>";
    }
    else if ($ip == "all") // @todo move the "/unbanip all" command in another command /unbanipall
    {
      $baniplist = array();
        $ct->setChanMeta('baniptime', 'baniplist_nickid', serialize($baniplist));
      $updated = true;
      $msg = "<p>".$nb." users have been unbanipished"."</p>";
    }
      $xml_reponse->script("pfc.handleResponse('unban', 'ok', '".$msg."');");
  }
}
?>

EDIT 2010 07 13

Finde in pfc/src/proxies/auth.class.php
Code: Select all
    // protect admin commands
    $admincmd = array("kick", "ban", "bantime", "banip", "unbantime", "unbanip", "unban", "op", "deop", "debug", "rehash");
    if ( in_array($this->name, $admincmd) )

Replace width
Code: Select all
    // protect admin commands
    $admincmd = array("kick", "ban", "bantime", "banip", "unbantime", "unbanip", "unban", "op", "deop", "debug", "rehash", "bantimelist", "baniplist", "banlist", "bantimelist", "baniptime", "unbaniptime", "baniptimelist");
    if ( in_array($this->name, $admincmd) )

When you find a fail write comment.
Last edited by andro on Wed Jul 14, 2010 1:23 pm, edited 1 time in total.
andro
New member
 
Posts: 5
Joined: Tue Mar 09, 2010 2:12 pm
Top

Postby carlis » Tue Jul 13, 2010 4:03 pm

Very good Andro, thank you very much!!! :-)

Im testing your code and it seems to be good. But I am afraid you have not considered the user type can execute this command. That is, I see currently anybody (non admin) can execute /baniptime, /baniptimelist and /unbaniptime. Could you fix this issue, please?

Thank you very much for your effort and time :-)

Greetings from Spain.
Last edited by carlis on Tue Jul 13, 2010 4:05 pm, edited 1 time in total.
carlis
New member
 
Posts: 6
Joined: Thu Jul 08, 2010 6:22 pm
Top

Postby carlis » Tue Jul 13, 2010 4:26 pm

I see your example does not work, instead if I connected as admin. May be I should to specify the time in /baniptime ?
carlis
New member
 
Posts: 6
Joined: Thu Jul 08, 2010 6:22 pm
Top

Postby andro » Wed Jul 14, 2010 1:27 pm

to carlis: Yes I have corrected it in auth.class.php.
/baniptime {nickname} {ip} {time minutes} [ {reason} ]
In javascript pfc.sendRequest('/baniptime '+nick+' '+ ip +" 60");

Greetings from Slovakia :-)
Last edited by andro on Wed Jul 14, 2010 1:28 pm, edited 1 time in total.
andro
New member
 
Posts: 5
Joined: Tue Mar 09, 2010 2:12 pm
Top

Postby TheSeaKing » Fri Aug 20, 2010 7:46 am

Thanks, it works. :D I sorted out a very annoying user thanks to you. ^^

Just a small bug need to be sorted out though. There are two reasons when banning someone.
Example: SOMENAME was banish by TheSeaKing for REASON TIME REASON.

I want to to be: SOMENAME was banish by TheSeaKing for REASON for TIME minutes.
Last edited by TheSeaKing on Fri Aug 20, 2010 7:47 am, edited 1 time in total.
TheSeaKing
Member
 
Posts: 21
Joined: Sat Nov 22, 2008 6:40 am
Top

Postby re*s.t.a.r.s.*2 » Mon Aug 23, 2010 5:56 pm

Dude, thank you so much for this contribution, it rocks... remember this is for phpfreechat 1.3
not tested in previous versions...
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby Myth024 » Sat Jun 09, 2012 4:52 pm

The script works perfectly. I was wondering if there was a way to modify the code so if you /baniptime nick then it will automatically ban that nick with it's IP address for a specific time without having to manually enter in the IP or the time. I'm attempting to integrate it into a menu that pops up when you click on a nick in the nick list. So far what I have works fine with the kick and ban commands but because /baniptime requires multiple parameters, I'm having trouble getting the ip passed correctly to the function. The section of code in my pfcclient.js file is as follows.
Code: Select all
 //the ban option
      lblBnRuSr = this.res.getLabel('Are you sure you want to ban this user?');
      var p = document.createElement('p');
      p.setAttribute('class',     'pfc_nickwhois_pv');
      p.setAttribute('className', 'pfc_nickwhois_pv'); // for IE6
      var a = document.createElement('a');
      a.setAttribute('href', '');
      a.pfc_nickid = nickid;
      a.pfc_parent = div;
      a.onclick = function(evt){
        if(confirm(lblBnRuSr)){
            var nick = pfc.getUserMeta(this.pfc_nickid,'nick');
       var nick = pfc.getUserMeta(this.pfc_nickid,'ip');
      pfc.sendRequest('/baniptime '+nick+' '+ ip +" 60");
            this.pfc_parent.style.display = 'none';
            return false;
        }

The output in the chat seems to indicate that the /baniptime executed, but the command doesn't actually execute correctly.
If I manually use /baniptime and input the nick and ip address by hand the command executes correctly.
Last edited by Myth024 on Sat Jun 09, 2012 4:53 pm, edited 1 time in total.
Myth024
Member
 
Posts: 19
Joined: Sun Jun 03, 2012 3:35 am
Top

Postby re*s.t.a.r.s.*2 » Sat Jun 09, 2012 5:43 pm

Hi,

where ip is being set? you set nick with with ip instead a nickname, and still placed ip in the command line which if not set is going to be undefined..

regards
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby Myth024 » Sat Jun 09, 2012 6:22 pm

Oops lol.. I was messing around with the command to try and get it to work correctly and when I pasted the code I forgot to change it back to what I had.
There was a post in the forums on how to add kick and ban options to the menu when you click on a nick in the nick list. I successfully integrated it and the standard kick and ban commands work fine. Now I'm trying to add the /baniptime command to the list. I followed the instructions and if I use the command manually, it works fine. I'm posting the code I'm using right now and it successfully issues the command with an ip address instead of the nick. However because the /baniptime command requires two parameters the standard process for /ban and /kick doesn't work. I haven't yet figured out what command or parameter actually gets the ip of a person otherwise I might be able to figure this out. Thanks for your help and I'll be sure to post whatever eventually works.
Code: Select all
//the banIP option
      lblBnRuSr = this.res.getLabel('Are you sure you want to IP-ban this user?');
      var p = document.createElement('p');
      p.setAttribute('class',     'pfc_nickwhois_pv');
      p.setAttribute('className', 'pfc_nickwhois_pv'); // for IE6
      var a = document.createElement('a');
      a.setAttribute('href', '');
      a.pfc_nickid = nickid;
      a.pfc_parent = div;
      a.onclick = function(evt){
        if(confirm(lblBnRuSr)){
            var nick = pfc.getUserMeta(this.pfc_nickid,'ip');
         pfc.sendRequest('/baniptime "'+nick+'"');
            this.pfc_parent.style.display = 'none';
            return false;
        }
      }
      var img = document.createElement('img');
      img.setAttribute('src', this.res.getFileUrl('images/openpv.gif'));
      img.alt = this.res.getLabel('BanIP');
      a.appendChild(img);
      a.appendChild(document.createTextNode(this.res.getLabel('BanIP')));
      p.appendChild(a);
      div.appendChild(p);

    }
    this.nickwhoisbox.set(nickid, div);

This current code will actually add the users IP to a ban list, but they don't get kicked from the room and ultimately the command itself fails.
However, if I can figure out how the system gets an IP from a user, or how to call the IP directly I might be able to actually re-write the command itself.
Myth024
Member
 
Posts: 19
Joined: Sun Jun 03, 2012 3:35 am
Top

Postby re*s.t.a.r.s.*2 » Sat Jun 09, 2012 7:54 pm

hi,


can you check what alert('/baniptime "'+nick+'"')

gives you? the script wouldn't work if nickid is undefined and you get something different instead of an ip..
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby Myth024 » Sun Jun 10, 2012 5:01 pm

you talking about something like
Code: Select all
this.nickname = pfc_nickname;
    this.nickid   = pfc_nickid;

Also, I'm thinking that maybe I should see about moving my set of posts into another thread or something lol. Before this gets out of hand under this contribution unless you think it could be valuable here. Thanks for your help I really do appreciate it. :)
Myth024
Member
 
Posts: 19
Joined: Sun Jun 03, 2012 3:35 am
Top

Postby re*s.t.a.r.s.*2 » Sun Jun 10, 2012 5:34 pm

hi,

yes I was referring about this line var nick = pfc.getUserMeta(this.pfc_nickid,'ip'); , if not available it will be undefined that's why I asked you
what the window.alert('/baniptime "'+nick+'"') gives you?

and if you want you can keep here, since we got a long way already.

regards.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby Myth024 » Sun Jun 10, 2012 8:07 pm

Well, the alert is basically just an box with ok or cancel. I also realized that (this.pfc_nickid,'ip') area basically didn't work, so I changed it back to (this.pfc_nickid)
I tried changing the code.
Code: Select all
var nick = pfc.getUserMeta(this.pfc_nickid, 'nick');
var ip = pfc.getUserMeta(this.pfc_nickid,'ip');
pfc.sendRequest('/baniptime "'+nick+'""'+ip+'");

I actually got to the point where clicking on my "button" executed the command with the correct parameters where they were supposed to be, but for some reason, all it did was print that a nick at ip as banned for no reason but didn't actually ban the person or kick them from the room. Keep in mind that the /baniptime command works if I manually input the command as /baniptime nick ip (where nick is the nickname and Ip is the ip address). However there was another post on how to integrate commands into a menu that pops up when you click the nick in the list of nick names in a room on the right of the chat page. I was able to put in the default ban and kick commands and they work correctly. I'm thinking what I might have to do is re-write the command so that if I type /baniptime nick then the command will automatically pull the ip address from the nick meta information and pass it to the command function. Ultimately it would probably be even better to have the default ban command also add the ip address of the person banned instead of a nick and do all banning based on IP instead of nick.


I came to the conclusion that the original command requires you to input the IP address manually as part of the command and it wasn't designed to pass user meta information. So I'm going back to the original command functions and looking at a complete re-write. In the meantime, I integrated it into an sql database using your login options and found that it generally works better.

Here is a link to the post I used for integrating the menu.
http://www.phpfreechat.net/forum/viewtopic.php?id=1589
Last edited by Myth024 on Sun Jun 10, 2012 8:09 pm, edited 1 time in total.
Myth024
Member
 
Posts: 19
Joined: Sun Jun 03, 2012 3:35 am
Top

Re: Ban IP of user for a time

Postby Afiq » Tue Jan 01, 2013 7:28 am

Hello Greeting From Malaysia..
I just found how to put ip as *Myth024*
I just put variable at:

Code: Select all
 updateNickWhoisBox: function(nickid)
  {
    var className = (!is_ie7 && !is_ie6) ? 'class' : 'className';
   


Replace with:
Code: Select all
  updateNickWhoisBox: function(nickid)
  {
    var className = (!is_ie7 && !is_ie6) ? 'class' : 'className';
    var j = 0;


and code:

Code: Select all
var td1 = document.createElement('td');
          td1.setAttribute(className, 'pfc_nickwhois_c1');
          var td2 = document.createElement('td');
          td2.setAttribute(className, 'pfc_nickwhois_c2');
          td1.innerHTML = k;
          td2.innerHTML = v;


replace with:

Code: Select all
var td1 = document.createElement('td');
          td1.setAttribute(className, 'pfc_nickwhois_c1');
          var td2 = document.createElement('td');
          td2.setAttribute(className, 'pfc_nickwhois_c2');
          td1.innerHTML = k;
          td2.innerHTML = v;
        j=v;


and code:

Code: Select all
}
    this.nickwhoisbox.set(nickid, div);


replace with:

Code: Select all
//the banIP option
      lblBnRuSri = this.res.getLabel('Are you sure you want to IP-ban this user?');
      var p = document.createElement('p');
      p.setAttribute('class',     'pfc_nickwhois_pv');
      p.setAttribute('className', 'pfc_nickwhois_pv'); // for IE6
      var a = document.createElement('a');
      a.setAttribute('href', '');
      a.pfc_nickid = nickid;
      a.pfc_parent = div;
      a.onclick = function(evt){
        if(confirm(lblBnRuSri)){
var nick = pfc.getUserMeta(this.pfc_nickid, 'nick');

pfc.sendRequest('/baniptime "'+nick+'" "'+j+'" "60"');
            this.pfc_parent.style.display = 'none';
            return false;
        }
      }
      var img = document.createElement('img');
      img.setAttribute('src', this.res.getFileUrl('images/openpv.gif'));
      img.alt = this.res.getLabel('Baniptime');
      a.appendChild(img);
      a.appendChild(document.createTextNode(this.res.getLabel('Baniptime')));
      p.appendChild(a);
      div.appendChild(p);

    }
    this.nickwhoisbox.set(nickid, div);


i think after identified as admin, user must refresh first... and it works for me :D
Afiq
New member
 
Posts: 2
Joined: Tue Jan 01, 2013 6:09 am
Top

Re: Ban IP of user for a time

Postby Afiq » Tue Jan 01, 2013 3:26 pm

Here another kick and ban and Baniptime ask user to put reason and time
Code: Select all
 //the kick option
      lblKckRuSr = this.res.getLabel('Are you sure you want to kick this user?');
      var p = document.createElement('p');
      p.setAttribute('class',     'pfc_nickwhois_pv');
      p.setAttribute('className', 'pfc_nickwhois_pv'); // for IE6
      var a = document.createElement('a');
      a.setAttribute('href', '');
      a.pfc_nickid = nickid;
      a.pfc_parent = div;
      a.onclick = function(evt){
        if(confirm(lblKckRuSr)){
            var nick = pfc.getUserMeta(this.pfc_nickid,'nick');
         var reasonK=window.prompt("Reason?");
   var z;
   if (reasonK!=null) {
        z=reasonK;
       
     }
    else{
       z="";
    }
            pfc.sendRequest('/kick "'+nick+'" "'+z+'"');
            this.pfc_parent.style.display = 'none';
            return false;
        }
      }
      var img = document.createElement('img');
      img.setAttribute('src', this.res.getFileUrl('images/openpv.gif'));
      img.alt = this.res.getLabel('Kick');
      a.appendChild(img);
      a.appendChild(document.createTextNode(this.res.getLabel('Kick')));
      p.appendChild(a);
      div.appendChild(p);
     
      //the ban option
      lblBnRuSr = this.res.getLabel('Are you sure you want to ban this user?');
      var p = document.createElement('p');
      p.setAttribute('class',     'pfc_nickwhois_pv');
      p.setAttribute('className', 'pfc_nickwhois_pv'); // for IE6
      var a = document.createElement('a');
      a.setAttribute('href', '');
      a.pfc_nickid = nickid;
      a.pfc_parent = div;
      a.onclick = function(evt){
        if(confirm(lblBnRuSr)){
    var nick = pfc.getUserMeta(this.pfc_nickid,'nick');
   var reasonB=window.prompt("Reason?");
   var x;
   if (reasonB!=null) {
        x=reasonB;
       
     }
    else{
       x="";
    }
            pfc.sendRequest('/ban "'+nick+'" "'+x+'"');
            this.pfc_parent.style.display = 'none';
            return false;
        }
      }
      var img = document.createElement('img');
      img.setAttribute('src', this.res.getFileUrl('images/openpv.gif'));
      img.alt = this.res.getLabel('Ban');
      a.appendChild(img);
      a.appendChild(document.createTextNode(this.res.getLabel('Ban')));
      p.appendChild(a);
      div.appendChild(p);

//the banIP option
      lblBnRuSri = this.res.getLabel('Are you sure you want to IP-ban this user?');
      var p = document.createElement('p');
      p.setAttribute('class',     'pfc_nickwhois_pv');
      p.setAttribute('className', 'pfc_nickwhois_pv'); // for IE6
      var a = document.createElement('a');
      a.setAttribute('href', '');
      a.pfc_nickid = nickid;
      a.pfc_parent = div;
      a.onclick = function(evt){
        if(confirm(lblBnRuSri)){
var nick = pfc.getUserMeta(this.pfc_nickid, 'nick');
var timeBip=window.prompt("Time(Minutes): Example = 60");
var c;
   if (timeBip!=null) {
        c=timeBip;
       
     }
    else{
       c=60;
    }
pfc.sendRequest('/baniptime "'+nick+'" "'+j+'" "'+c+'""');
            this.pfc_parent.style.display = 'none';
            return false;
        }
      }
      var img = document.createElement('img');
      img.setAttribute('src', this.res.getFileUrl('images/openpv.gif'));
      img.alt = this.res.getLabel('Baniptime');
      a.appendChild(img);
      a.appendChild(document.createTextNode(this.res.getLabel('Baniptime')));
      p.appendChild(a);
      div.appendChild(p);

    }
    this.nickwhoisbox.set(nickid, div);
Afiq
New member
 
Posts: 2
Joined: Tue Jan 01, 2013 6:09 am
Top


Post a reply
15 posts • Page 1 of 1

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 22 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub