#!/usr/bin/perl # # # ############################################### # # # ########### ### Setup # ########### $pathtodatadir = "/home/hostingu/public_html/inc"; $referer = "inccom"; $maindir = "/home/hostingu/public_html/inc"; $tpllocation = "$maindir/tpls"; ############################################## ### Tells script to use perl module htmltmpl # ############################################## use HTMLTMPL; # # # ############################################### # # # # # # ############################################### # # # ################# ### Script Body # ################# open(FILE, "$pathtodatadir/$referer.num"); $numfile=; close(FILE); $numfile++; open(FILE, ">$pathtodatadir/$referer.num"); print FILE "$numfile"; close(FILE); &Get_Date; $raddr = $ENV{'REMOTE_ADDR'}; $rhost = $ENV{'REMOTE_HOST'}; $hreferer = $ENV{'HTTP_REFERER'}; open(FILE, ">>$pathtodatadir/$referer.log"); print FILE "$date, "; if ($raddr) {print FILE "$raddr, ";} else {print FILE "No IP Detected, ";} if ($rhost) {print FILE "$rhost, ";} else {print FILE "No Host Name Detected, ";} if ($hreferer) {print FILE "$hreferer\n";} else {print FILE "No Referer Detected\n";} close(FILE); &Print_Contact_Page; exit; # # # ############################################### # # # ############################################### ### Prints the "is domain name involved? page # ############################################### sub Print_Contact_Page { ############################################ ### Create template and load from location # ############################################ $templ = new HTMLTMPL; $templ->src("$tpllocation/index.tpl"); ######################################## ### Push variable values into template # ######################################## ####################################### ### Print the new template as webpage # ####################################### $templ->output('Content-Type: text/html'); exit; } # # # ############################################### # # # # # # ############################################### # # # ########################### ### Get the time and date # ########################### sub Get_Date { ################################################################# ### Define arrays for the day of the week and month of the year # ################################################################# @days = ('Sunday','Monday','Tuesday','Wednesday', 'Thursday','Friday','Saturday'); @days2 = ('Sun','Mon','Tue','Wed', 'Thu','Fri','Sat'); @months = ('January','February','March','April','May','June','July', 'August','September','October','November','December'); @months2 = ('Jan','Feb','Mar','Apr','May','Jun','Jul', 'Aug','Sep','Oct','Nov','Dec'); ################################################################### ### Get the current time and format the hour, minutes and seconds # ### Add 1900 to the year to get the full 4 digit year # ################################################################### ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec); $year += 1900; ##################### ### Format the date # ##################### $date = "$days[$wday], $months[$mon] $mday, $year at $time"; $date2 = "$months2[$mon] $mday $year"; $date3 = "$days2[$wday], $mday $months2[$mon] $year $time"; $rawtime = time(); } # # # ############################################### # # # exit;