#!/usr/local/bin/perl
$mail_prog = '/usr/sbin/sendmail' ;
&GetFormInput;
$login = $field{'login'} ;	 
$adv = $field{'adv'};
$pass = $field{'pass'};
	 
	 sub GetFormInput {

	(*fval) = @_ if @_ ;

	local ($buf);
	if ($ENV{'REQUEST_METHOD'} eq 'POST') {
		read(STDIN,$buf,$ENV{'CONTENT_LENGTH'});
	}
	else {
		$buf=$ENV{'QUERY_STRING'};
	}
	if ($buf eq "") {
			return 0 ;
		}
	else {
 		@fval=split(/&/,$buf);
		foreach $i (0 .. $#fval){
			($name,$val)=split (/=/,$fval[$i],2);
			$val=~tr/+/ /;
			$val=~ s/%(..)/pack("c",hex($1))/ge;
			$name=~tr/+/ /;
			$name=~ s/%(..)/pack("c",hex($1))/ge;

			if (!defined($field{$name})) {
				$field{$name}=$val;
			}
			else {
				$field{$name} .= ",$val";
				
			}


		   }
		}
return 1;
}

$url="http://wmclicks.com/cgi-bin/links/begin.pl?login=$login&adv=$adv&pass=$pass";
if ($ENV{'HTTP_REFERER'} eq $url)

{

$t=time;
until (time-$t>12)
{
}
print "Location: http://wmclicks.com/cgi-bin/links/end.pl?login=$login&adv=$adv\nURI: http://wmclicks.com/cgi-bin/links/end.pl?login=$login&adv=$adv\n\n";

}

else

{

print "Content-Type: text/html\n\n";
print "<HTML><BODY BACKGROUND=http://wmclicks.com/bg.gif>";
print "<CENTER><FONT SIZE=4 FACE=Tahoma COLOR=#FFFF00>$ENV{'HTTP_REFERER'} - $url</FONT></CENTER>";
print "</BODY></HTML>";
}
