#!/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;
}

use Fcntl;
use NDBM_File;

tie %hasht, "NDBM_File", "/web/012/wmclicks/public_html/members/logs/$login", O_RDWR, 0644;
$ps = $hasht{'pass'};
untie %hasht;

#open (FILE,"/web/012/wmclicks/public_html/members/backup/$login.dat");
#@f=<FILE>;
#close (FILE);
#$pass = chomp ($f[0]);



#if ($pass eq $ps)
#{

tie %hash, "NDBM_File", "/web/012/wmclicks/public_html/adv/logs/$adv", O_RDWR, 0644;
$sitename = $hash{'sitename'};
$url = $hash{'url'};
untie %hash;

print "Content-Type: text/html\n\n";
print "<html><head><meta http-equiv=Content-Type content=\"text/html; charset=windows-1251\"><title>$sitename</title></head>";
print "<frameset framespacing=0 rows=99,*>";
print "<frame name=header scrolling=no noresize target=main src=http://www.wmclicks.com/cgi-bin/links/middle.pl?login=$login&adv=$adv&pass=$pass>";
print "<frame name=main src=$url scrolling=auto>";
print "<noframes><body><p>Frames page</p></body></noframes></frameset></html>";





#}
