MuCMS PHP Cross Reference Content Management Systems

Source: /testbed.php - 60 lines - 4786 bytes - Text - Print

   1  <?php
   2  
   3  
   4  $TopIPArray = array ( array ('FileName'=>'', 'Day' => '', 'From' => '', 'IP' => '', 'Host'=> '','Query' => '', 'Browser'=> '', 'Port' => '', 'URI' => '' , 'Count' => 0));
   5  $TopIPArray[] = array ('FileName'=> '/mucms/theme1.php' , 'Day' => 1197054951, 'From' => '', 'IP' => '10.0.0.2', 'Host'=> '','Query' => '', 'Browser'=> 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20070914 Mandriva/2.0.0.8-1mdv2008.0 (2008.0) Firefox/2.0.0.8', 'Port' => 54895, 'URI' => '/mucms/theme1.php');
   6  $TopIPArray[] = array ('FileName'=> '/mucms/theme1.php' , 'Day' => 1197054928, 'From' => '', 'IP' => '10.0.0.2', 'Host'=> '','Query' => '', 'Browser'=> 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20070914 Mandriva/2.0.0.8-1mdv2008.0 (2008.0) Firefox/2.0.0.8', 'Port' => 54895, 'URI' => '/mucms/theme1.php');        
   7  $TopIPArray[] = array ('FileName'=> '/mucms/theme2.php' , 'Day' => 1197054348, 'From' => '', 'IP' => '10.0.0.4', 'Host'=> '','Query' => '', 'Browser'=> 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20070914 Mandriva/2.0.0.8-1mdv2008.0 (2008.0) Firefox/2.0.0.8', 'Port' => 54895, 'URI' => '/mucms/theme2.php');        
   8  $TopIPArray[] = array ('FileName'=> '/mucms/theme3.php' , 'Day' => 1196054848, 'From' => '', 'IP' => '10.0.0.4', 'Host'=> '','Query' => '', 'Browser'=> 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20070914 Mandriva/2.0.0.8-1mdv2008.0 (2008.0) Firefox/2.0.0.8', 'Port' => 54895, 'URI' => '/mucms/theme3.php');        
   9  $TopIPArray[] = array ('FileName'=> '/mucms/theme1.php' , 'Day' => 1197054908, 'From' => '', 'IP' => '10.0.0.9', 'Host'=> '','Query' => '', 'Browser'=> 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20070914 Mandriva/2.0.0.8-1mdv2008.0 (2008.0) Firefox/2.0.0.8', 'Port' => 54895, 'URI' => '/mucms/theme1.php');        
  10  $TopIPArray[] = array ('FileName'=> '/mucms/theme4.php' , 'Day' => 1197054941, 'From' => '', 'IP' => '10.0.0.2', 'Host'=> '','Query' => '', 'Browser'=> 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20070914 Mandriva/2.0.0.8-1mdv2008.0 (2008.0) Firefox/2.0.0.8', 'Port' => 54895, 'URI' => '/mucms/theme4.php');        
  11  $TopIPArray[] = array ('FileName'=> '/mucms/theme1.php' , 'Day' => 1197054948, 'From' => '', 'IP' => '10.0.0.1', 'Host'=> '','Query' => '', 'Browser'=> 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20070914 Mandriva/2.0.0.8-1mdv2008.0 (2008.0) Firefox/2.0.0.8', 'Port' => 54895, 'URI' => '/mucms/theme1.php');        
  12  $TopIPArray[] = array ('FileName'=> '/mucms/theme2.php' , 'Day' => 1197054748, 'From' => '', 'IP' => '10.0.0.2', 'Host'=> '','Query' => '', 'Browser'=> 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20070914 Mandriva/2.0.0.8-1mdv2008.0 (2008.0) Firefox/2.0.0.8', 'Port' => 54895, 'URI' => '/mucms/theme2.php');        
  13  $TopIPArray[] = array ('FileName'=> '/mucms/theme1.php' , 'Day' => 1197054938, 'From' => '', 'IP' => '10.0.0.3', 'Host'=> '','Query' => '', 'Browser'=> 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20070914 Mandriva/2.0.0.8-1mdv2008.0 (2008.0) Firefox/2.0.0.8', 'Port' => 54895, 'URI' => '/mucms/theme1.php');        
  14  $TopIPArray[] = array ('FileName'=> '/mucms/theme1.php' , 'Day' => 1197054933, 'From' => '', 'IP' => '10.0.0.7', 'Host'=> '','Query' => '', 'Browser'=> 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20070914 Mandriva/2.0.0.8-1mdv2008.0 (2008.0) Firefox/2.0.0.8', 'Port' => 54895, 'URI' => '/mucms/theme1.php');                
  15  
  16  $ActualHitCount = 10;
  17  
  18  $ShortTermTime = ( 7 * 24 * 60 * 60);
  19  $TotalHitsFromStart = $ActualHitCount;
  20      
  21  // Date to check with date("Ymd")
  22  $SortTermTarget = time() - $ShortTermTime;
  23  
  24  // Variable to hold 7 Day totals
  25  $ShortTermHits = 0;
  26  
  27  // Oldest Record = find the oldest entry
  28  $OldestRecordFound = time();
  29  
  30  for ($j = 0; $j<$ActualHitCount;$j++) {
  31      // Find Short Term Time Hits
  32      if (($TopIPArray[$j]['Day'] >= $SortTermTarget) && ($TopIPArray[$j]['Day'] != '')) {
  33          $ShortTermHits++;
  34      }
  35      
  36      // if day found = less than oldest day set to new oldest day
  37      if (($TopIPArray[$j]['Day'] < $OldestRecordFound) && ($TopIPArray[$j]['Day'] != '')) {
  38          $OldestRecordFound = $TopIPArray[$j]['Day'];
  39      }
  40      
  41  }
  42  
  43  // Total number of days up
  44  $UpDays = round(((time() -$OldestRecordFound) / (60 * 60 * 24)),2);
  45  
  46  // Average hits per day from begining
  47  $AverageFromStartup = round(($ActualHitCount / $UpDays),2);
  48  
  49  // Days in specfied time
  50  $DaysInSpecTime = round (($ShortTermTime / (60 * 60 * 24)),2);
  51  
  52  // Average in specified time
  53  $AverageInSpecifiedTime = round(($ShortTermHits / $DaysInSpecTime),2);
  54  
  55  echo "Short Term: " . $ShortTermHits . "<br />";
  56  echo "Oldest record: " . $OldestRecordFound . "<br />";
  57  echo "UP Days: " . $UpDays . "<br />";
  58  echo "Average From Startup: " . $AverageFromStartup . "<br />";
  59  echo "Average From Spec Time: " . $AverageInSpecifiedTime . "<br />";
  60  ?>

title

Description

title

Description

title

Description

title

title

Body