Tutorials

IRC Stats Tutorial

Einloggen
Benutzername:
Passwort:

Passwort vergessen?
Kostenlos
Anmelden
anzeigen
IRC Stats


2961 - Sniper - 22.01.2006 18:23 Uhr - Version: 1 - - verlinken als BB-Code


IRC Stats

Mit diesem Script könnt Ihr die akktuelle Idler Zahl aus eurem Irc Channel auf eurer Website ausstellen.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php

function chanpeak($chan) {
   if (!
$fp fsockopen("irc.quakenet.org",6667)) return "no connect";
   
fputs($fp,"NICK a".substr(md5(uniqid(rand(),1)),0,8)."
USER botle 00:botle rox
"
);
   while (!
feof($fp)) {
     
$data trim(fgets($fp,1024));
     if (
substr($data,0,1) == ":") {
       
$dSplit explode(" ",substr($data,1));
       if (!
ereg("!",$dSplit[0]))
         switch (
$dSplit[1]) {
           case 
"322"$chanpeak $dSplit[4]; if ($dSplit[3] == $chan)
fputs($fp,"QUIT
"
); break;
           case 
"001"fputs($fp,"LIST ".$chan."
"
); break;
         }
     } elseif (
substr($data,0,4) == "PING"fputs($fp,"PONG".substr($data,5)."
"
);
   }
   
fclose($fp);
   return 
$chanpeak;
}

  
// Hier channel eintragen, der abgefragt werden soll
  
$chan "#dreamcodes";

  
$fp fopen("chanpeak.dat","r");
  if (
$fp) {
    unset(
$return);
    while (!
feof($fp))
      
$return.= fgets($fp,4096);
    
fclose($fp);
    list(
$timestamp,$chanpeak) = explode(",",trim($return));
    if ((
time()-$timestamp)>600) {
      
$chanpeak chanpeak($chan);
      
$fp fopen("chanpeak.dat","w");
      if (
$fp)
        
fputs($fp,time().",".$chanpeak);
      
fclose($fp);
    }
    echo 
$chanpeak;
  } else {
    echo 
"n/a";
  }
?>


Mitglieder-Kommentare


#1 von Faxon2k
Überarbeite dein Script nochmal, hast wohl einen fehler drin

Parse error: syntax error, unexpected ';' in /usr/export/www/hosting/friendclub/irc.php on line 38

Nur registrierte Mitglieder könnten einen Kommentar schreiben.

Melde dich doch ganz einfach an, es ist kostenlos. :-)