Externer GTChat Traffic Counter

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

      Externer GTChat Traffic Counter

      Nachfolgendes Addon ermöglicht es den Traffic deines GTChats extern auszugeben,
      dabei werden immer 30 Tage berücksichtigt.

      PHP-Quellcode

      1. <?php
      2. // GTChat Traffic Zähler
      3. // Version 0.5b
      4. // Original by TobiTaba
      5. // Erweitert mit Monats und Trafficzähler 07/08/2007 durch Sven Schmidt "condor" (info@gtchat-developer.de)
      6. // Alle Rechte unterliegen www.gtchat-developer.de & TobiTaba
      7. ob_start();
      8. ?>
      9. <html>
      10. <head>
      11. <title>Chat - Traffic &Uuml;bersicht</title>
      12. </head>
      13. <center>
      14. <table style="width:100%; border:0px;" cellspacing="0" cellpadding="2">
      15. <tr>
      16. <td style="width:50%;" valign="top"><span style="font-weight:bold;">Datum</span></td>
      17. <td style="width:50%;" valign="top"><span style="font-weight:bold;">Traffic</span></td>
      18. </tr>
      19. <?
      20. $file = 'cgi-bin/Variables/traffic.log';
      21. $byte = 'Byte';
      22. $month = 0; // Monatszähler
      23. $traffic = 0; // Trafficzähler
      24. if(is_file($file)){
      25. $hash = fopen($file,'r');
      26. while(!feof($hash)) {
      27. $zeile = fgets($hash);
      28. $array = explode('|',$zeile);
      29. $datum = date("d.m.Y", + $array[0]);
      30. if($array[1] > 1024) {
      31. $array[1] = round ($array[1] / 1024 / 1024,2);
      32. $byte = 'MB';
      33. $month ++;
      34. $traffic = $traffic + $array[1];
      35. }
      36. // Datum darf nicht Unix Zeit entsprechen, der Monat darf noch nicht vorbei sein.
      37. if($datum != "01.01.1970" && $month <= 31){
      38. ?>
      39. <tr>
      40. <td style="width:50%;" valign="top"><?=$datum;?></td>
      41. <td style="width:50%;" valign="top"><?=$array[1];?>&nbsp;<?=$byte;?></td>
      42. </tr>
      43. <?
      44. }
      45. }
      46. // Nach einem Monat, Gesamtverbrauch anzeigen.
      47. if($month == 31){
      48. echo '<tr>';
      49. echo '<td valign="top" style="text-align:center;" colspan="2">Sie haben diesen Monat '. $traffic .' '. $byte .' Traffic verbraucht.</td>';
      50. echo '</tr>';
      51. }
      52. fclose($hash);
      53. ?>
      54. </table>
      55. </center>
      56. <div style="text-align:center;"><input type="submit" onClick="print();" value="Drucken" /></div>
      57. <? } ?>
      58. </body>
      59. </html>
      60. <? ob_end_flush(); ?>


      Zum Eintrag in der Datenbank