[ Index ]

PHP Cross Reference of Nuke-Evolution v2.0.5

title

Body

[close]

/includes/ -> counter.php (source)

   1  <?php
   2  /*=======================================================================
   3   Nuke-Evolution Basic: Enhanced PHP-Nuke Web Portal System
   4   =======================================================================*/
   5  
   6  /************************************************************************
   7     Nuke-Evolution: Advanced Content Management System
   8     ============================================
   9     Copyright (c) 2005 by The Nuke-Evolution Team
  10  
  11     Filename      : counter.php
  12     Author        : Quake (www.nuke-evolution.com)
  13     Version       : 2.0.0
  14     Date          : 5/10/2005 (dd-mm-yyyy)
  15  
  16     Notes         : Counter for Stats module. Tracks with thanks to the Identify Class
  17                     Also tracks search bots.
  18  ************************************************************************/
  19  
  20  if(defined('COUNTER')) {
  21      return;
  22  }
  23  define('COUNTER', 1);
  24  
  25  if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
  26      exit('Access Denied');
  27  }
  28  
  29  global $prefix, $db, $browser, $agent;
  30  
  31  if($agent['engine'] == 'bot') {
  32      $browser = 'Bot';
  33  } elseif(!empty($agent['ua'])) {
  34      $browser = $agent['ua'];
  35  } else {
  36      $browser = 'Other';
  37  }
  38  
  39  if (!empty($agent['os'])) {
  40      $os = $agent['os'];
  41  } else {
  42      $os = 'Other';
  43  }
  44  
  45  $now = explode('-',date('d-m-Y-H'));
  46  $result = $db->sql_query('UPDATE '.$prefix."_counter SET count=count+1 WHERE (var='$browser' AND type='browser') OR (var='$os' AND type='os') OR (type='total' AND var='hits')");
  47  $db->sql_freeresult($result);
  48  if (!$db->sql_query('UPDATE '.$prefix."_stats_hour SET hits=hits+1 WHERE (year='$now[2]') AND (month='$now[1]') AND (date='$now[0]') AND (hour='$now[3]')") || !$db->sql_affectedrows()) {
  49      $db->sql_query('INSERT INTO '.$prefix."_stats_hour VALUES ('$now[2]','$now[1]','$now[0]','$now[3]','1')");
  50  }
  51  $db->sql_freeresult($result);
  52  ?>


Generated: Wed Jun 6 11:38:01 2007 Cross-referenced by PHPXref 0.7