#!/usr/bin/perl
#######################################
#         Noleech CGI Script 	      #
#######################################

$leechsite=$ENV{'HTTP_REFERER'};

# Change this if you changed the name
# of the .txt file containing your links.
$datafile = "noleech.txt";

# Change this to your domain name, e.g.
# www.codelibary.com would just be codelibary.
$IPorDom="codelibary";

$name=$ENV{'QUERY_STRING'};
$dom=$ENV{'HTTP_REFERER'};
($www,$dom,$com)=split(/\./,$dom,3);
$red=$dom;
$red =~ tr/A-Z/a-z/;
if ( "$red" eq "$IPorDom") { 
open(FILE,"$datafile");
@input=<FILE>;			
$amount = @input; #Total Number of lines in file
$g = 0; #Line Num
while ($g <= $amount) {
@info = split("::", $input[$g]);
if ($info[0] =~ $name) {
print "Location: $info[1]\n\n";


exit;
}

$g++;
 }
close(FILE);

}
else{

print "Content-type: text/html\n\n";

print  " <title>Error</title>
<body bgcolor=#000000 text=#ffffff link=#0000ff>
<center><font face=verdana size=7><B><i>Error</i></font><br> ";

#do not remove the EOT its what ends the html printout.
}
Published in: CGI
Download

Related snippets