home *** CD-ROM | disk | FTP | other *** search
/ ftp.sunet.sepub/pictures / 2014.11.ftp.sunet.se-pictures.tar / ftp.sunet.se / pub / pictures / ACiD-artpacks / www / mirrors / acheron / cgi-bin / stats.cgi < prev    next >
Text File  |  1999-02-28  |  12KB  |  321 lines

  1. #!/usr/bin/perl
  2.  
  3. # declare variables
  4. $current_ip = "nothing";
  5.  
  6. ## december banners
  7. $artpacks_acid1_dec1998_counter = 0;
  8. $acheron_acid1_dec1998_counter = 0;
  9. $hirez_acid1_dec1998_counter = 0;
  10.  
  11. ## jan 1999 banners
  12. $artpacks_acid1_jan_counter = 0;
  13. $acheron_acid1_jan_counter = 0;
  14. $hirez_acid1_jan_counter = 0;
  15. $acheron_hirez1_jan_counter = 0;
  16. $acheron_element_jan_counter = 0;
  17. $hirez_element_jan_counter = 0;
  18. $acheron_element2_jan_counter = 0;
  19. $hirez_element2_jan_counter = 0;
  20.  
  21. ## feb 1999 banners
  22. $acheron_hirez1_feb_counter = 0;
  23. $acheron_element_feb_counter = 0;
  24. $hirez_element_feb_counter = 0;
  25. $acheron_element2_feb_counter = 0;
  26. $hirez_element2_feb_counter = 0;
  27. $acheron_vtag_feb_counter = 0;
  28.  
  29. ## mar 1999 banners
  30. $acheron_hirez1_mar_counter = 0;
  31. $acheron_element_mar_counter = 0;
  32. $hirez_element_mar_counter = 0;
  33. $acheron_element2_mar_counter = 0;
  34. $hirez_element2_mar_counter = 0;
  35. $acheron_vtag_mar_counter = 0;
  36.  
  37. ## today counters
  38. $acid_today = 0;
  39. $hirez_today = 0;
  40. $element_today = 0;
  41. $element2_today = 0;
  42. $vtag_today = 0;
  43.  
  44. ## impression counters
  45. $total_jan_hirez_impressions = 0;
  46. $total_jan_element_impressions = 0;
  47. $total_jan_element2_impressions = 0;
  48. $total_jan_vtag_impressions = 0;
  49.  
  50. $total_feb_hirez_impressions = 0;
  51. $total_feb_element_impressions = 0;
  52. $total_feb_element2_impressions = 0;
  53. $total_feb_vtag_impressions = 0;
  54.  
  55. $total_mar_hirez_impressions = 0;
  56. $total_mar_element_impressions = 0;
  57. $total_mar_element2_impressions = 0;
  58. $total_mar_vtag_impressions = 0;
  59.  
  60. $filename = "logfile.txt";
  61.  
  62. # call initial functions
  63. &Analyse_file;
  64.  
  65. #########################################################################
  66.  
  67. sub Analyse_file {
  68.  
  69. open (LOGFILE, "<$filename") || die "Could not open or find $filename\n";
  70.  
  71.     foreach $line (<LOGFILE>) {
  72.     ($banner, $pipe, $day_name, $month, $day_no, $time, $year, $pipe2, $ip, $pipe3, $host) = split(' ', $line);
  73.  
  74.     $todays_dat = "" .gmtime(time). "";
  75.     ($mday_name, $mmonth, $mday_no, $mtime, $myear) = split(' ', $todays_dat);
  76.  
  77.     $todays_date = "$mday_no $mmonth $myear"; 
  78.  
  79. ## today's banner click-throughs ####
  80.     if (("$mday_no $mmonth $myear" eq "$day_no $month $year") && ($current_ip ne $ip)) {
  81.  
  82.     if ($banner eq "acidgear") { $acid_today++; }
  83.     if ($banner eq "hirez") { $hirez_today++; }
  84.     if ($banner eq "element") { $element_today++; }
  85.     if ($banner eq "element2") { $element2_today++; }
  86.     if ($banner eq "vtag") { $vtag_today++; }
  87.     } 
  88.  
  89.    
  90. ## jan 1999 ####
  91.     if ($banner eq "acidgear" && $month eq "Jan" && $current_ip ne $ip) {
  92.  
  93.         $acid1_jan_counter++;
  94.         if ($host eq "artpacks.acid.org") {$artpacks_acid1_jan_counter++;}
  95.         if ($host eq "www.acheron.org") {$acheron_acid1_jan_counter++;}
  96.         if ($host eq "www.hirez.org") {$hirez_acid1_jan_counter++;}
  97.  
  98.      }
  99.  
  100.     if ($banner eq "hirez" && $month eq "Jan" && $current_ip ne $ip) {
  101.  
  102.         $hirez1_jan_counter++;
  103.         if ($host eq "www.acheron.org") {$acheron_hirez1_jan_counter++;}
  104.  
  105.      }
  106.  
  107.     if ($banner eq "element" && $month eq "Jan" && $current_ip ne $ip) {
  108.  
  109.         $element_jan_counter++;
  110.         if ($host eq "www.acheron.org") {$acheron_element_jan_counter++;}
  111.         if ($host eq "www.hirez.org") {$hirez_element_jan_counter++;}
  112.  
  113.      }
  114.  
  115.     if ($banner eq "element2" && $month eq "Jan" && $current_ip ne $ip) {
  116.  
  117.         $element2_jan_counter++;
  118.         if ($host eq "www.acheron.org") {$acheron_element2_jan_counter++;}
  119.         if ($host eq "www.hirez.org") {$hirez_element2_jan_counter++;}
  120.  
  121.      }
  122.  
  123. ## february
  124.     if ($banner eq "hirez" && $month eq "Feb" && $current_ip ne $ip) {
  125.         $hirez1_feb_counter++;
  126.         if ($host eq "www.acheron.org") {$acheron_hirez1_feb_counter++;}
  127.  
  128.      }
  129.  
  130.     if ($banner eq "vtag" && $month eq "Feb" && $current_ip ne $ip) {
  131.         $vtag_feb_counter++;
  132.         if ($host eq "www.acheron.org") {$acheron_vtag_feb_counter++;}
  133.  
  134.      }
  135.  
  136.     if ($banner eq "element" && $month eq "Feb" && $current_ip ne $ip) {
  137.         $element_feb_counter++;
  138.         if ($host eq "www.acheron.org") {$acheron_element_feb_counter++;}
  139.         if ($host eq "www.hirez.org") {$hirez_element_feb_counter++;}
  140.  
  141.      }
  142.  
  143.     if ($banner eq "element2" && $month eq "Feb" && $current_ip ne $ip) {
  144.         $element2_feb_counter++;
  145.         if ($host eq "www.acheron.org") {$acheron_element2_feb_counter++;}
  146.         if ($host eq "www.hirez.org") {$hirez_element2_feb_counter++;}
  147.  
  148.      }
  149.  
  150. ## march
  151.     if ($banner eq "hirez" && $month eq "Mar" && $current_ip ne $ip) {
  152.         $hirez1_mar_counter++;
  153.         if ($host eq "www.acheron.org") {$acheron_hirez1_mar_counter++;}
  154.  
  155.      }
  156.  
  157.     if ($banner eq "vtag" && $month eq "Mar" && $current_ip ne $ip) {
  158.         $vtag_mar_counter++;
  159.         if ($host eq "www.acheron.org") {$acheron_vtag_mar_counter++;}
  160.  
  161.      }
  162.  
  163.     if ($banner eq "element" && $month eq "Mar" && $current_ip ne $ip) {
  164.         $element_mar_counter++;
  165.         if ($host eq "www.acheron.org") {$acheron_element_mar_counter++;}
  166.         if ($host eq "www.hirez.org") {$hirez_element_mar_counter++;}
  167.  
  168.      }
  169.  
  170.     if ($banner eq "element2" && $month eq "Mar" && $current_ip ne $ip) {
  171.         $element2_mar_counter++;
  172.         if ($host eq "www.acheron.org") {$acheron_element2_mar_counter++;}
  173.         if ($host eq "www.hirez.org") {$hirez_element2_mar_counter++;}
  174.  
  175.      }
  176.      $current_ip = $ip;
  177.  
  178.  
  179. close LOGFILE;
  180.  
  181. ## analyse exposures
  182. open (EXPFILE, "<exposures.txt") || die "Could not open or find $filename\n";
  183.  
  184.     foreach $line (<EXPFILE>) {
  185.     ($banner, $pipe, $day_name, $month, $day_no, $time, $year, $pipe2, $ip, $pipe3, $host) = split(' ', $line);
  186.  
  187.     if ($month eq "Jan") {
  188.  
  189.         if ($banner eq "hirez") {$total_jan_hirez_impressions++;}
  190.         if ($banner eq "element") {$total_jan_element_impressions++;}
  191.         if ($banner eq "element2") {$total_jan_element2_impressions++;}
  192.         if ($banner eq "vtag") {$total_jan_vtag_impressions++;}
  193.  
  194.     }
  195.  
  196.     if ($month eq "Feb") {
  197.  
  198.         if ($banner eq "hirez") {$total_feb_hirez_impressions++;}
  199.         if ($banner eq "element") {$total_feb_element_impressions++;}
  200.         if ($banner eq "element2") {$total_feb_element2_impressions++;}
  201.         if ($banner eq "vtag") {$total_feb_vtag_impressions++;}
  202.  
  203.     }
  204.  
  205.     if ($month eq "Mar") {
  206.  
  207.         if ($banner eq "hirez") {$total_mar_hirez_impressions++;}
  208.         if ($banner eq "element") {$total_mar_element_impressions++;}
  209.         if ($banner eq "element2") {$total_mar_element2_impressions++;}
  210.         if ($banner eq "vtag") {$total_mar_vtag_impressions++;}
  211.  
  212.     }
  213. }
  214.  
  215. close EXPFILE;
  216.  
  217. print &Header;
  218. print &Top("test");
  219. $output = "STDOUT";
  220. print $output "<font size=4><b>Banner Statistics as of $todays_date</b></font><br>\n";
  221. print $output "Number of semi-unique click-throughs for all hosted banners<p>\n";
  222.  
  223. ## today
  224. print $output "<font size=3><b>Today:</font> <font size=2>($todays_date)</font></b><p>\n";
  225. print $output "<table width=300 cellpadding=0 cellspacing=0>\n";
  226. print $output "<tr><td>Hirez.org:</td><td>$hirez_today</td></tr>\n";
  227. print $output "<tr><td>Element Design:</td><td>$element_today</td></tr>\n";
  228. print $output "<tr><td>Element Design #2:</td><td>$element2_today</td></tr>\n";
  229. print $output "<tr><td>VTAG:</td><td>$vtag_today</td></tr></table><p>\n";
  230.  
  231. ## mar 99
  232. print $output "<p>\n";
  233. print $output "<font size=3><b>March:</B></font><p>\n";
  234. print $output "<p><B>Hirez.org: $hirez1_mar_counter clicks</b> ($total_mar_hirez_impressions impressions)<br>\n";
  235. print $output "<img src=/images/ads/hirez.gif width=468 height=60 alt=Viewing banner><br>\n";
  236. print $output "<font size=1>(acheron.org: $acheron_hirez1_mar_counter)</font>\n";
  237. print $output "<p><B>Element Design: $element_mar_counter clicks</B> ($total_mar_element_impressions impressions)<br>\n";
  238. print $output "<img src=/images/ads/element.gif width=468 height=60 alt=Viewing banner><br>\n";
  239. print $output "<font size=1>(acheron.org: $acheron_element_mar_counter) (hirez.org: $hirez_element_mar_counter)</font>\n";
  240. print $output "<p><B>Element Design #2: $element2_mar_counter clicks</B> ($total_mar_element2_impressions impressions)<br>\n";
  241. print $output "<img src=/images/ads/element2.gif width=468 height=60 alt=Viewing banner><br>\n";
  242. print $output "<font size=1>(acheron.org: $acheron_element2_mar_counter) (hirez.org: $hirez_element2_mar_counter)</font>\n";
  243. print $output "<p><B>VTAG: $vtag_mar_counter clicks</B> ($total_mar_vtag_impressions impressions)<br>\n";
  244. print $output "<img src=/images/ads/vtagban.gif width=468 height=60 alt=Viewing banner><br>\n";
  245. print $output "<font size=1>(acheron.org: $acheron_vtag_mar_counter)</font>\n";
  246.  
  247. ## feb 99
  248. print $output "<p>\n";
  249. print $output "<font size=3><b>February:</B></font><p>\n";
  250. print $output "<p><B>Hirez.org: 14 clicks</b> (1331 impressions)<br>\n";
  251. print $output "<img src=/images/ads/hirez.gif width=468 height=60 alt=Viewing banner><br>\n";
  252. print $output "<font size=1>(acheron.org: 14)</font>\n";
  253. print $output "<p><B>Element Design: 17 clicks</B> (7544 impressions)<br>\n";
  254. print $output "<img src=/images/ads/element.gif width=468 height=60 alt=Viewing banner><br>\n";
  255. print $output "<font size=1>(acheron.org: 11) (hirez.org: 6)</font>\n";
  256. print $output "<p><B>Element Design #2: 11 clicks</B> (4867 impressions)<br>\n";
  257. print $output "<img src=/images/ads/element2.gif width=468 height=60 alt=Viewing banner><br>\n";
  258. print $output "<font size=1>(acheron.org: 5) (hirez.org: 6)</font>\n";
  259. print $output "<p><B>VTAG: 24 clicks</B> (1420 impressions)<br>\n";
  260. print $output "<img src=/images/ads/vtagban.gif width=468 height=60 alt=Viewing banner><br>\n";
  261. print $output "<font size=1>(acheron.org: 24)</font>\n";
  262.  
  263. ## january 99
  264. print $output "<p>\n";
  265. print $output "<font size=3><b>January 1999:</b></font><p>\n";
  266. print $output "<B>Acid gear: 244 clicks</B> (n/a impressions)<br>\n";
  267. print $output "<img src=/images/ads/acidban.gif width=468 height=60 alt=Viewing banner><br>\n";
  268. print $output "<font size=1>(acheron.org: 58) (hirez.org: 35) (artpacks: 151)</font>\n";
  269. print $output "<p><B>Hirez.org: 27 clicks</B> (40 impressions)<br>\n";
  270. print $output "<img src=/images/ads/hirez.gif width=468 height=60 alt=Viewing banner><br>\n";
  271. print $output "<font size=1>(acheron.org: 27)</font>\n";
  272. print $output "<p><B>Element Design: 14 clicks</B> (193 impressions)<br>\n";
  273. print $output "<img src=/images/ads/element.gif width=468 height=60 alt=Viewing banner><br>\n";
  274. print $output "<font size=1>(acheron.org: 8) (hirez.org: 6)</font>\n";
  275. print $output "<p><B>Element Design #2: 2 clicks</B> (166 impressions)<br>\n";
  276. print $output "<img src=/images/ads/element2.gif width=468 height=60 alt=Viewing banner><br>\n";
  277. print $output "<font size=1>(acheron.org: 2) (hirez.org: 0)</font>\n";
  278.  
  279. ## december 98
  280. print $output "<p><font size=3><b>December 1998:</b></font><p>\n";
  281. print $output "Acid gear: 24<br>\n";
  282. print $output "<img src=/images/ads/acidban.gif width=468 height=60 alt=Viewing banner><br>\n";
  283. print $output "<font size=1>(acheron.org: $acheron_acid1_dec1998_counter) (hirez.org: $hirez_acid1_dec1998_counter) (artpacks: $artpacks_acid1_dec1998_counter)</font>\n";
  284. print &Bottom;
  285.  
  286. }
  287.  
  288. #########################################################################
  289.  
  290. #_____Module Returns the Output Document Type______#
  291. sub Header
  292. {
  293.         return "Content-type: text/html\n\n";
  294. }   
  295.  
  296. #_____Module Returns the Output Document Head_______#
  297. sub Top
  298. {
  299.         my ($title) = @_;
  300.         return <<"ENDPRINT";
  301. <HTML>
  302. <HEAD>
  303. <TITLE>acheron.org // admin / banner statistics</TITLE>
  304. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  305. </HEAD>
  306.  
  307. <BODY link="#FFCC00" vlink="#FF9900" alink="#FFFFFF" text="#cccccc" BGCOLOR="#000000">
  308. <div align="center">
  309.               <table border="0" width="640" align="center" cellspacing="0" cellpadding="0">
  310.                 <tr> 
  311.                   <td width="640"> 
  312.                     <p><font size="2" face="Arial, Helvetica, sans-serif">
  313. ENDPRINT
  314. }
  315.  
  316. #_____Module Returns the Output Document Bottom______#
  317. sub Bottom
  318. {
  319.         return "</td></tr></table></div></BODY></HTML>\n";
  320. }