trompet.nl - dé toonaangevende trompet site van nederland
  > hartelijk welkom op deze site  
  
 

 

 

 

 

 

 


> Laatste Trompet.nl nieuws:

> Actuele onderwerpen Trompet.nl forum:





#!/usr/bin/perl ############ This is the only thing required # chmod 644 $rand_file = "/home/httpd/vhosts/trompet.nl/cgi-bin/random/randex.txt"; ############ Advanced Options ; Ignore the following if you are not interested # chmod 666 $rand_data = "."; # chmod 666 $rand_ip = "/home/httpd/vhosts/trompet.nl/cgi-bin/random/iplog.txt"; # number of ip to store in iplog.txt $number_ip = 20; ######################################################## # # That's it, setup ends. # ######################################################## if ((-w $rand_data) && (-w $rand_ip) && $number_ip > 0) { $advanced = 1; } open(RANDEX, $rand_file) or die("Cannot open $rand_file"); @lines = ; close(RANDEX); @codes = split(/\[\%\%BREAK\%\%\]/, join("", @lines)); srand(time); $index = int(rand($#codes+1)); if (($advanced) && $#codes > 0) { ################## # Check IP open(IP, $rand_ip); @lines = ; close(IP); foreach $line (@lines) { ($ip, $id) = split(/\|\|/, $line); if ($ip eq $ENV{'REMOTE_ADDR'}) { $lastid = $id; do { $index = int(rand($#codes+1)); } while ($index == $lastid); } } open(IP, ">$rand_ip"); print IP "$ENV{'REMOTE_ADDR'}||$index\n"; $count = 1; foreach $line (@lines) { ($ip, $id) = split(/\|\|/, $line); if ($ip ne $ENV{'REMOTE_ADDR'} && $count<$number_ip) { print IP $line; $count++; } } close(IP); ################## # Count hits open(READ, $rand_data); @lines = ; close(READ); $flag = 0; open(WRITE, ">$rand_data"); foreach $line (@lines) { if ($line =~ /^html$index\|/g) { chomp($line); ($filename, $hits) = split(/\|/, $line); $hits++; print WRITE "html$index|$hits\n"; $flag = 1; } else { print WRITE $line; } } if ($flag == 0) { print WRITE "html$index|1\n"; } close(WRITE); } print "Content-type: text/html\n\n"; print $codes[$index];

  geschiedenis
  mondstukken
  interviews
  forum
  docenten
  vraag & aanbod
  links database
mailing-list
  contact

  www.trombones.nl
 


© 2002-2012 Trompet.nl, Alle Rechten Voorbehouden.