|
|
 |
 |
 |
 |
<? /////////////////////////////////////////////////////////////////// // This program is free software; you can redistribute it and/or // // modify it under the terms of the GNU General Public License // // Author: Stephane Driussi Version date:2003/10/21 // // // // This program show an historic of connexions to the local // // teamspeak server. // ///////////////////////////////////////////////////////////////////
echo "<table border=1 cellspacing=0 cellpadding=2> <tr><td>Date</td><td>Action</td><td>IP</td><td>Surnom</td><td>Login</td><td>Logout date</td></tr>\n";
function addArray(&$array, $key, $val) { $temparray = array($key => $val); $array = $array + $temparray; }
$cnt = 1; $droits = 100; // set $droits to 300 if you want to show login name $disco=array(); $log = file("/usr/local/tss2_rc2/server.log"); $nblog = count($log); for ($i = $nblog-1; $i > 0; $i--) { $data = chop($log[$i]); if (ereg("connected",$data)) { $champ = split(",", str_replace(array(",ALL,Info,AccessLog, SID: 1 client"," [IP: ",", Nick: ",", LoginName: ",". [Nick: ","]"),",",$data)); // print_r($champ); // echo "<br>\n"; if (count($champ) == 4) addArray($disco, $champ[2], $champ[0]); else { // date de l'evennement echo "<tr><td>$champ[0]</td><td>"; if ($champ[1] == " disconnected") { // erreur de login echo "$champ[1]</td><td>$champ[3]</td><td>$champ[4]</td><td>"; if ($droits > 200) echo "$champ[5]"; else echo "*******"; echo "</td><td>$champ[2]"; } else { if (array_key_exists($champ[3], $disco)) { echo "disconnected</td><td>$champ[2]</td><td>$champ[3]</td><td>"; if ($droits > 200) echo "$champ[4]"; else echo "*******"; echo "</td><td>"; $date = $disco[$champ[3]]; echo "$date"; unset ($disco[$champ[3]]); } else { echo "$champ[1]</td><td>$champ[2]</td><td>$champ[3]</td><td>"; if ($droits > 200) echo "$champ[4]"; else echo "*******"; echo "</td><td><font color=#009900>still connected</font>"; } } echo "</td></tr>\n"; if ($cnt++ == 10) break; } } } echo "</table>\n"; ?>
|
 |
 |
 |
 |
|