[ PHPXref.com ] [ Generated: Sun Jul 20 18:24:42 2008 ] [ Jupiter CMS 1.1.5 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/modules/ -> hq.php (source)

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

   4   Jupiter Content System @ Highstrike.net

   5   Copyright (C) 2005 Cosmin Flavius (highstrike@gmail.com)

   6  

   7   This program is free software; you can redistribute it and/or

   8   modify it under the terms of the GNU General Public License

   9   as published by the Free Software Foundation; either version 2

  10   of the License, or (at your option) any later version.

  11  

  12   More Info About The Licence At http://www.gnu.org/copyleft/gpl.html

  13  ****************************************************************************/
  14  
  15  //-----------------------------------------------------------------

  16  //  Filter Acces Rightes

  17  //-----------------------------------------------------------------

  18  
  19  if(isset($is_guest))
  20      header("location: $PHP_SELF?i=2");
  21  
  22  //-----------------------------------------------------------------

  23  //  Get Logged in User's Info

  24  //-----------------------------------------------------------------

  25  
  26  $user_info = $db->getLine("SELECT forumposts, lastvisit FROM users WHERE id = '{$_SESSION['id']}' AND username = '{$_SESSION['username']}'");
  27  
  28  //-----------------------------------------------------------------

  29  //  Count Bans

  30  //-----------------------------------------------------------------

  31  
  32  $TotalBansCount = $db->getInfo_countRows("bans");
  33  
  34  //-----------------------------------------------------------------

  35  //  Count Forum Topics and Posts

  36  //-----------------------------------------------------------------

  37  
  38  $TotalTopicsCount = $db->getInfo_countRows("forum_topics","type != 3");
  39  $TotalPostsCount = $db->getInfo_countRows("forum_replies");
  40  
  41  //-----------------------------------------------------------------

  42  //  Calculate the hit averages

  43  //-----------------------------------------------------------------

  44  
  45  $days_uptime = intval(abs((((($misc['site_opened'] - time())/60)/60)/24)));
  46  
  47  $daily_average = @round(($misc['total_hits']/$days_uptime), 0);
  48  $weekly_average = @round(($misc['total_hits']/($days_uptime/7)), 0);
  49  $monthly_average = @round(($misc['total_hits']/($days_uptime/30)), 0);
  50  
  51  //-----------------------------------------------------------------

  52  //  UNIX load

  53  //-----------------------------------------------------------------

  54  
  55  if (@file_exists('/proc/loadavg'))
  56  {
  57      $fh = @fopen('/proc/loadavg', 'r');
  58      $load_averages = @fread($fh, 64);
  59      @fclose($fh);
  60  
  61      $load_averages = @explode(' ', $load_averages);
  62      $server_load = $load_averages[0].' '.$load_averages[1].' '.$load_averages[2];
  63  }
  64  else
  65      $server_load = $language['HQ server desc8'];
  66  
  67  //-----------------------------------------------------------------

  68  //  PHP Accelerator

  69  //-----------------------------------------------------------------

  70  
  71  if (function_exists('mmcache')) $php_accelerator = '<a href="http://turck-mmcache.sourceforge.net/" target="_blank">Turck MMCache</a>';
  72  else if (isset($_PHPA)) $php_accelerator = '<a href="http://www.php-accelerator.co.uk/" target="_blank">ionCube PHP Accelerator</a>';
  73  else $php_accelerator = 'N/A';
  74  
  75  //-----------------------------------------------------------------

  76  //  Database system version

  77  //-----------------------------------------------------------------

  78  
  79  $result = $db->query('SELECT version()');
  80  $db_version = @mysql_result($result, 0);
  81  
  82  //-----------------------------------------------------------------

  83  //  Collect some info about MySQL

  84  //-----------------------------------------------------------------

  85  
  86  $result = $db->query("SHOW TABLE STATUS FROM `$database_name`");
  87  $num_tables = @mysql_num_rows($result);
  88  
  89  $total_records = NULL;
  90  $total_size = NULL;
  91  while ($num_tables--)
  92  {
  93      $status = @mysql_fetch_row($result);
  94      $total_records += $status[4];
  95      $total_size += $status[6] + $status[8];
  96  }
  97  
  98  $total_size = $total_size / 1024;
  99  
 100  if ($total_size > 1024) $total_size = round($total_size / 1024, 2).' MB';
 101  else $total_size = round($total_size, 2).' KB';
 102  
 103  //-----------------------------------------------------------------

 104  //  Check site for update

 105  //-----------------------------------------------------------------

 106  
 107  if(isset($is_webmaster)) // Slows site down, so it's avalable only for the webmaster
 108  {
 109      $fp = @fopen('http://www.highstrike.net/update.php', 'r');
 110      $update = trim(@fread($fp, 16));
 111      @fclose($fp);
 112  
 113      //-----------------------------------------------------------------

 114      //  Variables for differit messages

 115      //-----------------------------------------------------------------

 116  
 117      if($fp)
 118      {
 119          if (!ini_get('allow_url_fopen')) $status = '<span class="alert">'.$language['HQ update desc6'].'</span>';
 120          elseif($update > $script_version) $status = '<span class="alert">'.$language['HQ update desc3'].'</span>';
 121          elseif($script_version > $update) $status = '<span class="alert">'.$language['HQ update desc4'].'</span>';
 122          elseif($script_version == $update) $status = '<span class="ok">'.$language['HQ update desc5'].'</span>';
 123      }
 124      else $status = '<span class="alert">'.$language['HQ update desc7'].'</span>';
 125  }
 126  
 127  //-----------------------------------------------------------------

 128  //  Count PM

 129  //-----------------------------------------------------------------

 130  
 131  $new_pm_count = $db->getInfo_countRows("pm","r_user_id = '{$_SESSION['id']}' AND r_user_user = '{$_SESSION['username']}' AND r_date = 'unread' AND r_delete = 1");
 132  
 133  //-----------------------------------------------------------------

 134  //  Display information

 135  //-----------------------------------------------------------------

 136  
 137  ?>
 138  <table class="main" cellspacing="1" cellpadding="4">
 139  <tr class="head"><td class="head" colspan="2"><?= $language['HQ user title'] ?></td></tr>
 140  <tr><td class="con1"><?= "{$language['HQ user desc']} <span class='ok'>{$_SESSION['username']}</span>" ?></td></tr>
 141  <tr><td class="con1"><?= "{$language['HQ user desc2']} <span class='bold'>".find_authorization($_SESSION['authorization'])."</span>" ?></td></tr>
 142  <tr><td class="con1"><?= "{$language['HQ user desc3']} $new_pm_count {$language['HQ user desc6']}" ?></td></tr>
 143  <tr><td class="con1"><?= "{$language['HQ user desc4']} {$user_info['forumposts']}" ?></td></tr>
 144  <tr><td class="con1"><?= "{$language['HQ user desc5']} "; if(!last_visit($user_info['lastvisit'])) echo "0 {$language['Time Definition Seconds']} {$language['HQ user desc7']}"; else echo last_visit($user_info['lastvisit']) ?></td></tr>
 145  </table>
 146  <? if(isset($is_moderator) || isset($is_administrator) || isset($is_webmaster)){ ?>
 147  <br>
 148  <table class="main" cellspacing="1" cellpadding="4">
 149  <tr class="head"><td class="head"><?= $language['HQ site title'] ?></td></tr>
 150  <tr><td class="con1"><?= "{$language['HQ site desc']} $TotalTopicsCount" ?></td></tr>
 151  <tr><td class="con1"><?= "{$language['HQ site desc2']} $TotalPostsCount" ?></td></tr>
 152  <tr><td class="con1"><?= "{$language['HQ site desc3']} $TotalBansCount" ?></td></tr>
 153  <tr><td class="con1"><?= "{$language['HQ site desc4']} $TotalOnlineCount" ?></td></tr>
 154  <tr><td class="con1"><?= "{$language['HQ site desc5']} {$misc['total_hits']}" ?></td></tr>
 155  <tr><td class="con1"><?= "{$language['HQ site desc6']} {$misc['unique_hits']}" ?></td></tr>
 156  <tr><td class="con1"><?= "{$language['HQ site desc7']} ".($daily_average ? $daily_average : $language['HQ site desc10']) ?></td></tr>
 157  <tr><td class="con1"><?= "{$language['HQ site desc8']} ".($weekly_average ? $weekly_average : $language['HQ site desc10']) ?></td></tr>
 158  <tr><td class="con1"><?= "{$language['HQ site desc9']} ".($monthly_average ? $monthly_average : $language['HQ site desc10']) ?></td></tr>
 159  <tr><td class="con1"><?= "{$language['HQ site desc11']} {$misc['totalonline']}" ?></td></tr>
 160  </table>
 161  <? } if(isset($is_administrator) || isset($is_webmaster)) { ?>
 162  <br>
 163  <table class="main" cellspacing="1" cellpadding="4">
 164  <tr class="head"><td class="head"><?= $language['HQ server title'] ?></td></tr>
 165  <tr><td class="con1"><?= "{$language['HQ server desc']} $server_load ($TotalOnlineCount users online)" ?></td></tr>
 166  <tr><td class="con1"><?= "{$language['HQ server desc2']} PHP_OS" ?></td></tr>
 167  <tr><td class="con1"><?= "{$language['HQ server desc3']} ".phpversion() ?></td></tr>
 168  <tr><td class="con1"><?= "{$language['HQ server desc4']} $php_accelerator" ?></td></tr>
 169  <tr><td class="con1"><?= "{$language['HQ server desc5']} $db_version" ?></td></tr>
 170  <tr><td class="con1"><?= "{$language['HQ server desc6']} $total_records" ?></td></tr>
 171  <tr><td class="con1"><?= "{$language['HQ server desc7']} $total_size" ?></td></tr>
 172  </table>
 173  <? } if(isset($is_webmaster)) { ?>
 174  <br>
 175  <table class="main" cellspacing="1" cellpadding="4">
 176  <col width="50%"><col width="50%">
 177  <tr class="head"><td colspan="2" class="head"><?= $language['HQ update title'] ?></td></tr>
 178  <tr>
 179  <td class="con1" align="left"><?= "{$language['HQ update desc']} $update / {$language['HQ update desc2']} $script_version" ?></td>
 180  <td class="con1" align="right"><?= $status ?></td>
 181  </tr>
 182  </table>
 183  <? } ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]