#!/usr/bin/perl use CGI qw/:standard/; $active=0; $data_path = "/edv/www.intranetica.com/annons"; $ad_path = "/edv/www.intranetica.com/annons/img"; $ad_url = "/annons/img"; $list = "$data_path/annons.txt"; $link = "$data_path/link.txt"; $msgs = "$data_path/msgs.txt"; $log = "/log/wwwlog/intranetica-adclick.log"; # # __________________________________________________________________ #dag och tid fvr loggen local ($sec, $min,$hour,$mday, $mon,$year, $wday,$dontcare) = localtime (); $year = ($year >= 70) ? $year+1900 : $year+2000 ; $mon++; $month= substr("0$mon",-2,2); $mday= substr("0$mday",-2,2); $hour= substr("0$hour",-2,2); $min= substr("0$min",-2,2); $datum = "$year-$month-$mday"; $tid = "$hour:$min"; if (! param()) { print redirect("http://www.intranetica.com/"); exit; } #Hämta parameter $adid = param('id'); #Kolla i listan efter URL open(LIST,"$list"); while ($inline = ) { if ($inline =~ /^#/ ) { #comment } else { @ad = split(/\|/,$inline); if ($ad[0] eq $adid ) { $location = $ad[2]; last; } } } close(LIST); $ref = referer(); $remote = remote_addr(); open(LOG,">>$log"); print LOG "$adid|$ref|$remote|$datum|$tid|$location|\n"; close(LOG); $location="http://www.intranetica.com/" if (! $location); print redirect($location); print "Click " . a({-href=>$location},"here") . "to continue.";