[ Index ]
 

Code source de PHP NUKE 7.9

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Statistics/ -> index.php (source)

   1  <?php
   2  
   3  /************************************************************************/

   4  /* PHP-NUKE: Web Portal System                                          */

   5  /* ===========================                                          */

   6  /*                                                                      */

   7  /* Copyright (c) 2005 by Francisco Burzi                                */

   8  /* http://phpnuke.org                                                   */

   9  /*                                                                      */

  10  /* Based on NukeStats Module Version 1.0                                */

  11  /* Copyright ©2002 by Harry Mangindaan (sens@indosat.net) and           */

  12  /*                    Sudirman (sudirman@akademika.net)                 */

  13  /* http://www.nuketest.com                                              */

  14  /*                                                                      */

  15  /* This program is free software. You can redistribute it and/or modify */

  16  /* it under the terms of the GNU General Public License as published by */

  17  /* the Free Software Foundation; either version 2 of the License.       */

  18  /************************************************************************/

  19  
  20  if (!defined('MODULE_FILE')) {
  21      die ("You can't access this file directly...");
  22  }
  23  require_once ("mainfile.php");
  24  $module_name = basename(dirname(__FILE__));
  25  get_lang($module_name);
  26  $pagetitle = "- "._STATS."";
  27  if (isset($year)) {
  28      $year = intval($year);
  29  }
  30  $ThemeSel = get_theme();
  31  
  32  $now = date("d-m-Y");
  33  $dot = explode ("-",$now);
  34  $nowdate = $dot[0];
  35  $nowmonth = $dot[1];
  36  $nowyear = $dot[2];
  37  
  38  function Stats_Main() {
  39      global $prefix, $db, $startdate, $sitename, $ThemeSel, $user_prefix, $Version_Num, $module_name, $textcolor2;
  40      include ("header.php");
  41      $result = $db->sql_query("SELECT type, var, count from ".$prefix."_counter order by type desc");
  42      while ($row = $db->sql_fetchrow($result)) {
  43          $type = stripslashes(check_html($row['type'], "nohtml"));
  44          $var = stripslashes(check_html($row['var'], "nohtml"));
  45          $count = intval($row['count']);
  46          if(($type == "total") && ($var == "hits")) {
  47              $total = $count;
  48          } elseif($type == "browser") {
  49              if($var == "FireFox") {
  50                  $firefox[] = $count;
  51                  $firefox[] = substr(100 * $count / $total, 0, 5);
  52              } elseif($var == "Netscape") {
  53                  $netscape[] = $count;
  54                  $netscape[] = substr(100 * $count / $total, 0, 5);
  55              } elseif($var == "MSIE") {
  56                  $msie[] = $count;
  57                  $msie[] =  substr(100 * $count / $total, 0, 5);
  58              } elseif($var == "Konqueror") {
  59                  $konqueror[] = $count;
  60                  $konqueror[] =  substr(100 * $count / $total, 0, 5);
  61              } elseif($var == "Opera") {
  62                  $opera[] = $count;
  63                  $opera[] =  substr(100 * $count / $total, 0, 5);
  64              } elseif($var == "Lynx") {
  65                  $lynx[] = $count;
  66                  $lynx[] =  substr(100 * $count / $total, 0, 5);
  67              } elseif($var == "Bot") {
  68                  $bot[] = $count;
  69                  $bot[] =  substr(100 * $count / $total, 0, 5);
  70              } elseif(($type == "browser") && ($var == "Other")) {
  71                  $b_other[] = $count;
  72                  $b_other[] =  substr(100 * $count / $total, 0, 5);
  73              }
  74          } elseif($type == "os") {
  75              if($var == "Windows") {
  76                  $windows[] = $count;
  77                  $windows[] =  substr(100 * $count / $total, 0, 5);
  78              } elseif($var == "Mac") {
  79                  $mac[] = $count;
  80                  $mac[] =  substr(100 * $count / $total, 0, 5);
  81              } elseif($var == "Linux") {
  82                  $linux[] = $count;
  83                  $linux[] =  substr(100 * $count / $total, 0, 5);
  84              } elseif($var == "FreeBSD") {
  85                  $freebsd[] = $count;
  86                  $freebsd[] =  substr(100 * $count / $total, 0, 5);
  87              } elseif($var == "SunOS") {
  88                  $sunos[] = $count;
  89                  $sunos[] =  substr(100 * $count / $total, 0, 5);
  90              } elseif($var == "IRIX") {
  91                  $irix[] = $count;
  92                  $irix[] =  substr(100 * $count / $total, 0, 5);
  93              } elseif($var == "BeOS") {
  94                  $beos[] = $count;
  95                  $beos[] =  substr(100 * $count / $total, 0, 5);
  96              } elseif($var == "OS/2") {
  97                  $os2[] = $count;
  98                  $os2[] =  substr(100 * $count / $total, 0, 5);
  99              } elseif($var == "AIX") {
 100                  $aix[] = $count;
 101                  $aix[] =  substr(100 * $count / $total, 0, 5);
 102              } elseif(($type == "os") && ($var == "Other")) {
 103                  $os_other[] = $count;
 104                  $os_other[] =  substr(100 * $count / $total, 0, 5);
 105              }
 106          }
 107      }
 108      title("$sitename "._STATS."");
 109      OpenTable();
 110      OpenTable();
 111      echo "<center><font class=\"option\"><b>$sitename "._STATS."</b></font><br><br>"._WERECEIVED." <b>$total</b> "._PAGESVIEWS." $startdate<br><br>"
 112      ."[ <a href=\"modules.php?name=$module_name&op=Stats\">"._VIEWDETAILED."</a> ]</center>";
 113      CloseTable();
 114      echo "<br><br>";
 115      $l_size = getimagesize("themes/$ThemeSel/images/leftbar.gif");
 116      $m_size = getimagesize("themes/$ThemeSel/images/mainbar.gif");
 117      $r_size = getimagesize("themes/$ThemeSel/images/rightbar.gif");
 118      OpenTable2();
 119      echo "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" align=\"center\"><tr><td colspan=\"2\">\n";
 120      echo "<center><font color=\"$textcolor2\"><b>"._BROWSERS."</b></font></center><br></td></tr>\n";
 121      echo "<tr><td><img src=\"modules/$module_name/images/explorer.gif\" border=\"0\" alt=\"\">&nbsp;MSIE: </td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Internet Explorer\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"Internet Explorer\" height=\"$m_size[1]\" width=", $msie[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Internet Explorer\"> $msie[1] % ($msie[0])</td></tr>\n";
 122      echo "<tr><td><img src=\"modules/$module_name/images/firefox.gif\" border=\"0\" alt=\"\">&nbsp;FireFox: </td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"FireFox\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"FireFox\" height=\"$m_size[1]\" width=", $firefox[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"FireFox\"> $firefox[1] % ($firefox[0])</td></tr>\n";
 123      echo "<tr><td><img src=\"modules/$module_name/images/netscape.gif\" border=\"0\" alt=\"\">&nbsp;Netscape: </td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Netscape\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"Netscape\" height=\"$m_size[1]\" width=", $netscape[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Netscape\"> $netscape[1] % ($netscape[0])</td></tr>\n";
 124      echo "<tr><td><img src=\"modules/$module_name/images/opera.gif\" border=\"0\" alt=\"\">&nbsp;Opera: </td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Opera\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"Opera\" height=\"$m_size[1]\" width=", $opera[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Opera\"> $opera[1] % ($opera[0])</td></tr>\n";
 125      echo "<tr><td><img src=\"modules/$module_name/images/konqueror.gif\" border=\"0\" alt=\"\">&nbsp;Konqueror: </td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Konqueror\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"Konqueror (KDE)\" height=\"$m_size[1]\" width=", $konqueror[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Konqueror\"> $konqueror[1] % ($konqueror[0])</td></tr>\n";
 126      echo "<tr><td><img src=\"modules/$module_name/images/lynx.gif\" border=\"0\" alt=\"\">&nbsp;Lynx: </td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Lynx\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"Lynx\" height=\"$m_size[1]\" width=", $lynx[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Lynx\"> $lynx[1] % ($lynx[0])</td></tr>\n";
 127      echo "<tr><td><img src=\"modules/$module_name/images/altavista.gif\" border=\"0\" alt=\"\">&nbsp;"._SEARCHENGINES.": </td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Robots - Spiders - Buscadores\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"Robots - Spiders - Buscadores\" height=\"$m_size[1]\" width=", $bot[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\""._BOTS."\"> $bot[1] % ($bot[0])</td></tr>\n";
 128      echo "<tr><td><img src=\"modules/$module_name/images/question.gif\" border=\"0\" alt=\"\">&nbsp;"._UNKNOWN.": </td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Otros - Desconocidos\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"Otros - Desconocidos\" height=\"$m_size[1]\" width=", $b_other[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\""._OTHER."\"> $b_other[1] % ($b_other[0])\n";
 129      echo "</td></tr></table>";
 130      CloseTable2();
 131      echo "<br><br>\n";
 132      OpenTable2();
 133      echo "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" align=\"center\"><tr><td colspan=\"2\">\n";
 134      echo "<center><font color=\"$textcolor2\"><b>"._OPERATINGSYS."</b></font></center><br></td></tr>\n";
 135      echo "<tr><td><img src=\"modules/$module_name/images/windows.gif\" border=\"0\" alt=\"\">&nbsp;Windows:</td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Windows\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"Windows\" height=\"$m_size[1]\" width=", $windows[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Windows\"> $windows[1] % ($windows[0])</td></tr>\n";
 136      echo "<tr><td><img src=\"modules/$module_name/images/linux.gif\" border=\"0\" alt=\"\">&nbsp;Linux:</td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Linux\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"Linux\" height=\"$m_size[1]\" width=", $linux[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Linux\"> $linux[1] % ($linux[0])</td></tr>\n";
 137      echo "<tr><td><img src=\"modules/$module_name/images/mac.gif\" border=\"0\" alt=\"\">&nbsp;Mac/PPC:</td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Mac/PPC\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"Mac - PPC\" height=\"$m_size[1]\" width=", $mac[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Mac/PPC\"> $mac[1] % ($mac[0])</td></tr>\n";
 138      echo "<tr><td><img src=\"modules/$module_name/images/bsd.gif\" border=\"0\" alt=\"\">&nbsp;FreeBSD:</td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"FreeBSD\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"FreeBSD\" height=\"$m_size[1]\" width=", $freebsd[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"FreeBSD\"> $freebsd[1] % ($freebsd[0])</td></tr>\n";
 139      echo "<tr><td><img src=\"modules/$module_name/images/sun.gif\" border=\"0\" alt=\"\">&nbsp;SunOS:</td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"SunOS\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"SunOS\" height=\"$m_size[1]\" width=", $sunos[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"SunOS\"> $sunos[1] % ($sunos[0])</td></tr>\n";
 140      echo "<tr><td><img src=\"modules/$module_name/images/irix.gif\" border=\"0\" alt=\"\">&nbsp;IRIX:</td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"SGI Irix\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"SGI Irix\" height=\"$m_size[1]\" width=", $irix[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"SGI Irix\"> $irix[1] % ($irix[0])</td></tr>\n";
 141      echo "<tr><td><img src=\"modules/$module_name/images/be.gif\" border=\"0\" alt=\"\">&nbsp;BeOS:</td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"BeOS\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"BeOS\" height=\"$m_size[1]\" width=", $beos[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"BeOS\"> $beos[1] % ($beos[0])</td></tr>\n";
 142      echo "<tr><td><img src=\"modules/$module_name/images/os2.gif\" border=\"0\" alt=\"\">&nbsp;OS/2:</td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"OS/2\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"OS/2\" height=\"$m_size[1]\" width=", $os2[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"OS/2\"> $os2[1] % ($os2[0])</td></tr>\n";
 143      echo "<tr><td><img src=\"modules/$module_name/images/aix.gif\" border=\"0\" alt=\"\">&nbsp;AIX:</td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"AIX\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" Alt=\"AIX\" height=\"$m_size[1]\" width=", $aix[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"AIX\"> $aix[1] % ($aix[0])</td></tr>\n";
 144      echo "<tr><td><img src=\"modules/$module_name/images/question.gif\" border=\"0\" alt=\"\">&nbsp;"._UNKNOWN.":</td><td><img src=\"themes/$ThemeSel/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Otros - Desconocidos\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" ALt=\"Otros - Desconocidos\" height=\"$m_size[1]\" width=", $os_other[1] * 2, "><img src=\"themes/$ThemeSel/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\""._OTHER."\"> $os_other[1] % ($os_other[0])\n";
 145      echo "</td></tr></table>\n";
 146      CloseTable2();
 147      echo "<br><br>\n";
 148  
 149      $unum = $db->sql_numrows($db->sql_query("select user_id from ".$user_prefix."_users"));
 150      $anum = $db->sql_numrows($db->sql_query("select * from ".$prefix."_authors"));
 151      $snum = $db->sql_numrows($db->sql_query("select sid from ".$prefix."_stories"));
 152      $cnum = $db->sql_numrows($db->sql_query("select tid from ".$prefix."_comments"));
 153      $subnum = $db->sql_numrows($db->sql_query("select * from ".$prefix."_queue"));
 154      if (is_active("Topics")) {
 155          $tnum = $db->sql_numrows($db->sql_query("select * from ".$prefix."_topics"));
 156      }
 157      if (is_active("Web_Links")) {
 158          $links = $db->sql_numrows($db->sql_query("select * from ".$prefix."_links_links"));
 159          $cat = $db->sql_numrows($db->sql_query("select * from ".$prefix."_links_categories"));
 160      }
 161      OpenTable2();
 162      echo "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" align=\"center\"><tr><td colspan=\"2\">\n";
 163      echo "<center><font color=\"$textcolor2\"><b>"._MISCSTATS."</b></font></center><br></td></tr>\n";
 164      echo "<tr><td><img src=\"modules/$module_name/images/users.gif\" border=\"0\" alt=\"\">&nbsp;"._REGUSERS."</td><td><b>$unum</b></td></tr>\n";
 165      echo "<tr><td><img src=\"modules/$module_name/images/authors.gif\" border=\"0\" alt=\"\">&nbsp;"._ACTIVEAUTHORS."</td><td><b>$anum</b></td></tr>\n";
 166      echo "<tr><td><img src=\"modules/$module_name/images/news.gif\" border=\"0\" alt=\"\">&nbsp;"._STORIESPUBLISHED."</td><td><b>$snum</b></td></tr>\n";
 167      if (is_active("Topics")) {
 168          echo "<tr><td><img src=\"modules/$module_name/images/topics.gif\" border=\"0\" alt=\"\">&nbsp;"._SACTIVETOPICS."</td><td><b>$tnum</b></td></tr>\n";
 169      }
 170      echo "<tr><td><img src=\"modules/$module_name/images/comments.gif\" border=\"0\" alt=\"\">&nbsp;"._COMMENTSPOSTED."</td><td><b>$cnum</b></td></tr>\n";
 171      if (is_active("Web_Links")) {
 172          echo "<tr><td><img src=\"modules/$module_name/images/topics.gif\" border=\"0\" alt=\"\">&nbsp;"._LINKSINLINKS."</td><td><b>$links</b></td></tr>\n";
 173          echo "<tr><td><img src=\"modules/$module_name/images/sections.gif\" border=\"0\" alt=\"\">&nbsp;"._LINKSCAT."</td><td><b>$cat</b></td></tr>\n";
 174      }
 175      echo "</table>\n";
 176      CloseTable2();
 177      CloseTable();
 178      include ("footer.php");
 179  }
 180  
 181  function Stats($total) {
 182      global $hlpfile,$nowyear,$nowmonth,$nowdate,$nowhour, $sitename, $startdate, $prefix, $db, $now, $module_name;
 183      $row = $db->sql_query("SELECT count from ".$prefix."_counter order by type desc");
 184      list($total) = $db->sql_fetchrow($row);
 185      include  ("header.php");
 186      title("$sitename "._STATS."");
 187      $total++;
 188      OpenTable();
 189      OpenTable();
 190      echo "<center><font class=\"option\"><b>$sitename "._STATS."</b></font><br><br>"._WERECEIVED." <b>$total</b> "._PAGESVIEWS." $startdate<br>"._TODAYIS.": $now[0]/$now[1]/$now[2]<br><br>";
 191      $row2 = $db->sql_fetchrow($db->sql_query("SELECT year, month, hits from ".$prefix."_stats_month order by hits DESC limit 0,1"));
 192      $year = intval($row2['year']);
 193      $month = intval($row2['month']);
 194      $hits = intval($row2['hits']);
 195      if ($month == 1) {$month = _JANUARY;} elseif ($month == 2) {$month = _FEBRUARY;} elseif ($month == 3) {$month = _MARCH;} elseif ($month == 4) {$month = _APRIL;} elseif ($month == 5) {$month = _MAY;} elseif ($month == 6) {$month = _JUNE;} elseif ($month == 7) {$month = _JULY;} elseif ($month == 8) {$month = _AUGUST;} elseif ($month == 9) {$month = _SEPTEMBER;} elseif ($month == 10) {$month = _OCTOBER;} elseif ($month == 11) {$month = _NOVEMBER;} elseif ($month == 12) {$month = _DECEMBER;}
 196      echo ""._MOSTMONTH.": $month $year ($hits "._HITS.")<br>";
 197      $row3 = $db->sql_fetchrow($db->sql_query("SELECT year, month, date, hits from ".$prefix."_stats_date order by hits DESC limit 0,1"));
 198      $year = intval($row3['year']);
 199      $month = intval($row3['month']);
 200      $date = intval($row3['date']);
 201      $hits = intval($row3['hits']);
 202      if ($month == 1) {$month = _JANUARY;} elseif ($month == 2) {$month = _FEBRUARY;} elseif ($month == 3) {$month = _MARCH;} elseif ($month == 4) {$month = _APRIL;} elseif ($month == 5) {$month = _MAY;} elseif ($month == 6) {$month = _JUNE;} elseif ($month == 7) {$month = _JULY;} elseif ($month == 8) {$month = _AUGUST;} elseif ($month == 9) {$month = _SEPTEMBER;} elseif ($month == 10) {$month = _OCTOBER;} elseif ($month == 11) {$month = _NOVEMBER;} elseif ($month == 12) {$month = _DECEMBER;}
 203      echo ""._MOSTDAY.": $date $month $year ($hits "._HITS.")<br>";
 204      $row4 = $db->sql_fetchrow($db->sql_query("SELECT year, month, date, hour, hits from ".$prefix."_stats_hour order by hits DESC limit 0,1"));
 205      $year = intval($row4['year']);
 206      $month = intval($row4['month']);
 207      $date = intval($row4['date']);
 208      $hour = intval($row4['hour']);
 209      $hits = intval($row4['hits']);
 210      if ($month == 1) {$month = _JANUARY;} elseif ($month == 2) {$month = _FEBRUARY;} elseif ($month == 3) {$month = _MARCH;} elseif ($month == 4) {$month = _APRIL;} elseif ($month == 5) {$month = _MAY;} elseif ($month == 6) {$month = _JUNE;} elseif ($month == 7) {$month = _JULY;} elseif ($month == 8) {$month = _AUGUST;} elseif ($month == 9) {$month = _SEPTEMBER;} elseif ($month == 10) {$month = _OCTOBER;} elseif ($month == 11) {$month = _NOVEMBER;} elseif ($month == 12) {$month = _DECEMBER;}
 211      if ($hour < 10) {
 212          $hour = "0$hour:00 - 0$hour:59";
 213      } else {
 214          $hour = "$hour:00 - $hour:59";
 215      }
 216      echo ""._MOSTHOUR.": $hour "._ON." $month $date, $year ($hits "._HITS.")<br><br>"
 217      ."[ <a href=\"modules.php?name=$module_name\">"._RETURNBASICSTATS."</a> ]</center>";
 218  
 219      CloseTable();
 220      echo "<br><br>";
 221      showYearStats($nowyear);
 222      echo "<BR><BR>";
 223      showMonthStats($nowyear,$nowmonth);
 224      echo "<BR><BR>";
 225      showDailyStats($nowyear,$nowmonth,$nowdate);
 226      echo "<BR><BR>";
 227      showHourlyStats($nowyear,$nowmonth,$nowdate);
 228      echo "<br><br><center>"._GOBACK."</center><br><br>";
 229      CloseTable();
 230      include  ("footer.php");
 231  }
 232  
 233  function YearlyStats($year){
 234      global $hlpfile,$nowyear,$nowmonth,$nowdate, $sitename, $module_name;
 235      include  ("header.php");
 236      title("$sitename "._STATS."");
 237      opentable();
 238      $year = intval($year);
 239      $nowmonth = intval($nowmonth);
 240      showMonthStats($year,$nowmonth);
 241      echo "<BR>";
 242      echo "<center>[ <a href=\"modules.php?name=$module_name\">"._BACKTOMAIN."</a> | <a href=\"modules.php?name=$module_name&amp;op=Stats\">"._BACKTODETSTATS."</a> ]</center>";
 243      closetable();
 244      include  ("footer.php");
 245  }
 246  
 247  function MonthlyStats($year,$month){
 248      global $sitename, $module_name, $nowdate;
 249      include  ("header.php");
 250      title("$sitename "._STATS."");
 251      opentable();
 252      $year = intval($year);
 253      $month = intval($month);
 254      $nowdate = intval($nowdate);
 255      showDailyStats($year,$month,$nowdate);
 256      echo "<BR>";
 257      echo "<center>[ <a href=\"modules.php?name=$module_name\">"._BACKTOMAIN."</a> | <a href=\"modules.php?name=$module_name&amp;op=Stats\">"._BACKTODETSTATS."</a> ]</center>";
 258      closetable();
 259      include  ("footer.php");
 260  }
 261  
 262  function DailyStats($year,$month,$date){
 263      global $sitename, $module_name;
 264      include  ("header.php");
 265      title("$sitename "._STATS."");
 266      opentable();
 267      $year = intval($year);
 268      $month = intval($month);
 269      $date = intval($date);
 270      showHourlyStats($year,$month,$date);
 271      echo "<BR>";
 272      echo "<center>[ <a href=\"modules.php?name=$module_name\">"._BACKTOMAIN."</a> | <a href=\"modules.php?name=$module_name&amp;op=Stats\">"._BACKTODETSTATS."</a> ]</center>";
 273      closetable();
 274      include  ("footer.php");
 275  }
 276  
 277  
 278  function showYearStats($nowyear){
 279      global $db,$prefix,$bgcolor1,$bgcolor2, $ThemeSel, $module_name;
 280      $l_size = getimagesize("themes/$ThemeSel/images/leftbar.gif");
 281      $m_size = getimagesize("themes/$ThemeSel/images/mainbar.gif");
 282      $r_size = getimagesize("themes/$ThemeSel/images/rightbar.gif");
 283      $resulttotal = $db->sql_query("SELECT sum(hits) as TotalHitsYear from ".$prefix."_stats_year");
 284      list($TotalHitsYear) = $db->sql_fetchrow($resulttotal);
 285      $db->sql_freeresult($resulttotal);
 286      $result = $db->sql_query("select year,hits from ".$prefix."_stats_year order by year");
 287      echo "<center><b>"._YEARLYSTATS."</b></center><br>";
 288      echo "<table align=\"center\" bgcolor=\"#000000\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\">";
 289      echo "<tr><td width=\"25%\" bgcolor=\"$bgcolor2\">"._YEAR."</td><td bgcolor=\"$bgcolor2\">"._SPAGESVIEWS."</td></tr>";
 290      while($row = $db->sql_fetchrow($result)) {
 291          $year = intval($row['year']);
 292          $hits = intval($row['hits']);
 293          echo "<tr bgcolor=\"$bgcolor1\"><td>";
 294          if ($year != $nowyear) {
 295              echo "<a href=\"modules.php?name=$module_name&amp;op=YearlyStats&amp;year=$year\">$year</a>";
 296          } else {
 297              echo "$year";
 298          }
 299          echo "</td><td>";
 300          $WidthIMG = round(100 * $hits/$TotalHitsYear,0);
 301          echo "<img src=\"themes/$ThemeSel/images/leftbar.gif\" Alt=\"\" width=\"$l_size[0]\" height=\"$l_size[1]\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" height=\"$m_size[1]\" width=",$WidthIMG * 2," Alt=\"\">"
 302          ."<img src=\"themes/$ThemeSel/images/rightbar.gif\" Alt=\"\" width=\"$r_size[0]\" height=\"$r_size[1]\"> ($hits)</td></tr>";
 303      }
 304      $db->sql_freeresult($result);
 305      echo "</table>";
 306  }
 307  
 308  function showMonthStats($nowyear,$nowmonth){
 309      global $prefix,$bgcolor1,$bgcolor2,$db, $ThemeSel, $module_name;
 310      $l_size = getimagesize("themes/$ThemeSel/images/leftbar.gif");
 311      $m_size = getimagesize("themes/$ThemeSel/images/mainbar.gif");
 312      $r_size = getimagesize("themes/$ThemeSel/images/rightbar.gif");
 313      $resultmonth = $db->sql_query("SELECT sum(hits) as TotalHitsMonth from ".$prefix."_stats_month where year='$nowyear'");
 314      list($TotalHitsMonth) = $db->sql_fetchrow($resultmonth);
 315      $db->sql_freeresult($resultmonth);
 316      $result = $db->sql_query("select month,hits from ".$prefix."_stats_month where year='$nowyear'");
 317      echo "<center><b>"._MONTLYSTATS." $nowyear</b></center><br>";
 318      echo "<table align=\"center\" bgcolor=\"#000000\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\">";
 319      echo "<tr><td width=\"25%\" bgcolor=\"$bgcolor2\">"._UMONTH."</td><td bgcolor=\"$bgcolor2\">"._SPAGESVIEWS."</td></tr>";
 320      while($row = $db->sql_fetchrow($result)) {
 321          $month = intval($row['month']);
 322          $hits = intval($row['hits']);
 323          echo "<tr bgcolor=\"$bgcolor1\"><td>";
 324          if ($month != $nowmonth) {
 325              echo "<a href=\"modules.php?name=$module_name&amp;op=MonthlyStats&amp;year=$nowyear&amp;month=$month\" class=\"hover_orange\">";
 326              getmonth($month);
 327              echo "</a>";
 328          } else {
 329              getmonth($month);
 330          }
 331          echo "</td><td>";
 332          $WidthIMG = round(100 * $hits/$TotalHitsMonth,0);
 333          echo "<img src=\"themes/$ThemeSel/images/leftbar.gif\" Alt=\"\" width=\"$l_size[0]\" height=\"$l_size[1]\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" height=\"$m_size[1]\" width=",$WidthIMG * 2," Alt=\"\">";
 334          echo "<img src=\"themes/$ThemeSel/images/rightbar.gif\" Alt=\"\" width=\"$r_size[0]\" height=\"$r_size[1]\"> ($hits)</td></tr>";
 335          echo "</td></tr>";
 336      }
 337      $db->sql_freeresult($result);
 338      echo "</table>";
 339  }
 340  
 341  function showDailyStats($year,$month,$nowdate){
 342      global $prefix,$bgcolor1,$bgcolor2,$db, $ThemeSel, $module_name;
 343      $l_size = getimagesize("themes/$ThemeSel/images/leftbar.gif");
 344      $m_size = getimagesize("themes/$ThemeSel/images/mainbar.gif");
 345      $r_size = getimagesize("themes/$ThemeSel/images/rightbar.gif");
 346      $resulttotal = $db->sql_query("SELECT sum(hits) as TotalHitsDate from ".$prefix."_stats_date where year='$year' and month='$month'");
 347      list($TotalHitsDate) = $db->sql_fetchrow($resulttotal);
 348      $db->sql_freeresult($resulttotal);
 349      $result = $db->sql_query("select year,month,date,hits from ".$prefix."_stats_date where year='$year' and month='$month' order by date");
 350      $total = $db->sql_numrows($result);
 351      echo "<center><b>"._DAILYSTATS." ";
 352      getmonth($month);
 353      echo ", $year</b></center><br>";
 354      echo "<table align=\"center\" bgcolor=\"#000000\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\">";
 355      echo "<tr><td width=\"25%\" bgcolor=\"$bgcolor2\">"._DATE."</td><td bgcolor=\"$bgcolor2\">"._SPAGESVIEWS."</td></tr>";
 356      while($row = $db->sql_fetchrow($result)) {
 357          $year = intval($row['year']);
 358          $month = intval($row['month']);
 359          $date = intval($row['date']);
 360          $hits = intval($row['hits']);
 361          echo "<tr bgcolor=\"$bgcolor1\"><td>";
 362          if ($date != $nowdate) {
 363              echo "<a href=\"modules.php?name=$module_name&amp;op=DailyStats&amp;year=$year&amp;month=$month&amp;date=$date\" class=\"hover_orange\">";
 364              echo $date;
 365              echo "</a>";
 366          } else {
 367              echo $date;
 368          }
 369          echo "</td><td>";
 370          if ($hits == 0) {
 371              $WidthIMG = 0;
 372              $d_percent = 0;
 373          } else {
 374              $WidthIMG = round(100 * $hits/$TotalHitsDate,0);
 375              $d_percent = substr(100 * $hits / $TotalHitsDate, 0, 5);
 376          }
 377          echo "<img src=\"themes/$ThemeSel/images/leftbar.gif\" Alt=\"\" width=\"$l_size[0]\" height=\"$l_size[1]\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" height=\"$m_size[1]\" width=",$WidthIMG * 2," Alt=\"\">"
 378          ."<img src=\"themes/$ThemeSel/images/rightbar.gif\" Alt=\"\" width=\"$r_size[0]\" height=\"$r_size[1]\"> $d_percent% ($hits)</td></tr>"
 379          ."</td></tr>";
 380      }
 381      $db->sql_freeresult($result);
 382      echo "</table>";
 383  }
 384  
 385  function showHourlyStats($year,$month,$date){
 386      global $prefix,$bgcolor1,$bgcolor2,$db, $ThemeSel;
 387      $l_size = getimagesize("themes/$ThemeSel/images/leftbar.gif");
 388      $m_size = getimagesize("themes/$ThemeSel/images/mainbar.gif");
 389      $r_size = getimagesize("themes/$ThemeSel/images/rightbar.gif");
 390      $resulttotal = $db->sql_query("SELECT sum(hits) as TotalHitsHour from ".$prefix."_stats_hour where year='$year' and month='$month' and date='$date'");
 391      list($TotalHitsHour) = $db->sql_fetchrow($resulttotal);
 392      $db->sql_freeresult($resulttotal);
 393      $nowdate = date("d-m-Y");
 394      $nowdate_arr = explode("-",$nowdate);
 395      echo "<center><b>"._HOURLYSTATS." ";
 396      echo getmonth($month)." ".$date.", " .$year."</b></center><br>";
 397      echo "<table align=\"center\" bgcolor=\"#000000\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\">";
 398      echo "<tr><td width=\"25%\" bgcolor=\"$bgcolor2\">"._HOUR."</td><td bgcolor=\"$bgcolor2\" width=\"70%\">"._SPAGESVIEWS."</td></tr>";
 399      for ($k = 0;$k<=23;$k++) {
 400          $result = $db->sql_query("select hour,hits from ".$prefix."_stats_hour where year='$year' and month='$month' and date='$date' and hour='$k'");
 401          if ($db->sql_numrows($result) == 0){
 402              $hits=0;
 403          } else {
 404              $row = $db->sql_fetchrow($result);
 405              $hour = intval($row['hour']);
 406              $hits = intval($row['hits']);
 407          }
 408          echo "<tr><td bgcolor=\"$bgcolor1\">";
 409          if ($k < 10) {
 410              $a = "0$k";
 411          } else {
 412              $a = $k;
 413          }
 414          echo "$a:00 - $a:59";
 415          $a = "";
 416          echo "</td><td bgcolor=\"$bgcolor1\">";
 417          if ($hits == 0) {
 418              $WidthIMG = 0;
 419              $d_percent = 0;
 420          } else {
 421              $WidthIMG = round(100 * $hits/$TotalHitsHour,0);
 422              $d_percent = substr(100 * $hits / $TotalHitsHour, 0, 5);
 423          }
 424          echo "<img src=\"themes/$ThemeSel/images/leftbar.gif\" Alt=\"\" width=\"$l_size[0]\" height=\"$l_size[1]\"><img src=\"themes/$ThemeSel/images/mainbar.gif\" height=\"$m_size[1]\" width=",$WidthIMG * 2," Alt=\"\">"
 425          ."<img src=\"themes/$ThemeSel/images/rightbar.gif\" Alt=\"\" width=\"$r_size[0]\" height=\"$r_size[1]\"> $d_percent% ($hits)</td></tr>"
 426          ."</td></tr>";
 427      }
 428      $db->sql_freeresult($result);
 429      echo "</table>";
 430  }
 431  
 432  function getmonth($month){
 433      if ($month == 1) echo ""._JANUARY."";
 434      if ($month == 2) echo ""._FEBRUARY."";
 435      if ($month == 3) echo ""._MARCH."";
 436      if ($month == 4) echo ""._APRIL."";
 437      if ($month == 5) echo ""._MAY."";
 438      if ($month == 6) echo ""._JUNE."";
 439      if ($month == 7) echo ""._JULY."";
 440      if ($month == 8) echo ""._AUGUST."";
 441      if ($month == 9) echo ""._SEPTEMBER."";
 442      if ($month == 10) echo ""._OCTOBER."";
 443      if ($month == 11) echo ""._NOVEMBER."";
 444      if ($month == 12) echo ""._DECEMBER."";
 445  }
 446  
 447  switch($op) {
 448  
 449      default:
 450      Stats_Main();
 451      break;
 452  
 453      case "Stats":
 454      Stats($total);
 455      break;
 456  
 457      case "YearlyStats":
 458      YearlyStats($year);
 459      break;
 460  
 461      case "MonthlyStats":
 462      MonthlyStats($year,$month);
 463      break;
 464  
 465      case "DailyStats":
 466      DailyStats($year,$month,$date);
 467      break;
 468  
 469  }
 470  
 471  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7