#!/usr/local/bin/perl
$mail_prog = '/usr/sbin/sendmail' ;

&GetFormInput;

$nick = $field{'nick'} ;	 
$login = $field{'login'} ;
$pass = $field{'pass'} ;
$pass1 = $field{'pass1'} ;	 
$mail = $field{'mail'} ;	 
$sitename = $field{'sitename'} ;
$url = $field{'url'} ;	 
$wmid = $field{'wmid'} ;
$referer = $field {'referer'};	 


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;
}

$err="0";
$f="/web/012/wmclicks/public_html/adv/$login.pag";

if (-e $f) 
{
$err="1";
}
print "Content-Type: text/html\n\n";
print "<html><head><meta http-equiv=Content-Type content='text/html; charset=windows-1251'><title>Registration.</title><link rel=stylesheet type=text/css href=http://wmclicks.com/1.css></head>";
print "<body bgcolor=#00c392 background=http://wm-clicks.h1.ru/bg.gif topmargin=0><script language=javascript>";
print "u=\"u1542.50.spylog.com\";d=document;nv=navigator;na=nv.appName;p=1;";
print "bv=Math.round(parseFloat(nv.appVersion)*100);";
print "n=(na.substring(0,2)==\"Mi\")?0:1;rn=Math.random();z=\"p=\"+p+\"&rn=\"+rn+\"&tl=0&ls=0&ln=0\";y=\"\";";
print "y+=\"<img src='http://\"+u+\"/cnt?\"+z+";
print "\"&r=\"+escape(d.referrer)+\"&pg=\"+escape(window.location.href)+\"' border=0 width=1 height=1 alt='SpyLOG'>\";";
print "d.write(y);if(!n) { d.write(\"<\"+\"!--\"); }//--></script><noscript>";
print "<img src=\"http://u1542.50.spylog.com/cnt?p=1\" alt='SpyLOG' border='0' width=1 height=1 >";
print "</noscript><script language=javascript1.2><!--";
print "if(!n) { d.write(\"--\"+\">\"); }//--></script><hr color=#006c00 width=600>";
print "<table width=600 border=0 align=center cellspacing=0 cellpadding=0><tr><td align=center width=230 colspan=2><img src=http://wm-clicks.h1.ru/logo.gif></td>";
print "<td width=475><!-- RLE --><iframe src=http://www.linkexchange.ru/cgi-bin/erle.cgi?39536?184651 frameborder=0 vspace=0 hspace=0 width=468 height=60 marginwidth=0 marginheight=0 scrolling=no>";
print "<a href=http://www.linkexchange.ru/users/039536/goto.map target=_top><img src=http://www.linkexchange.ru/cgi-bin/rle.cgi?39536?184651 alt=RLE Banner Network border=0></a></iframe> ";
print "<!-- RLE --></td></tr></table><p class=mn><table width=600 border=0 cellspacing=0 cellpadding=0 align=center height=100%>";
print "<tr><td width=13><img src=http://wm-clicks.h1.ru/corn.gif></td><td bgcolor=#006c00 width=100% valign=middle><font color=#91e1cd>W M - C L I C K S -&gt; R e g i s t r a t i o n</font></td><td width=13 align=right><img src=http://wm-clicks.h1.ru/cornr.gif></td></tr><tr>"; 
print "<td colspan=3><table width=100% border=1 cellspacing=0 cellpadding=3 bordercolor=#006c00><tr><td rowspan=5 valign=top bgcolor=#91e1cd>";

if ($pass eq $pass1 and $err eq "0")
{
use Fcntl;
use NDBM_File;


tie %hash, "NDBM_File", "/web/012/wmclicks/public_html/adv/logs/$login", O_RDWR|O_CREAT|O_EXCL, 0644;
$hash{pass} = $pass;
$hash{nick} = $nick;
$hash{mail} = $mail;
$hash{sitename} = $sitename;
$hash{url} = $url;
$hash{wmid} = $wmid;
$hash {referer} = $referer;
untie %hash;


tie %hashm, "NDBM_File", "/web/012/wmclicks/public_html/adv/money/$login", O_RDWR|O_CREAT|O_EXCL, 0644;
$hashm{summ} ="0";
untie %hashm;



tie %hasht, "NDBM_File", "/web/012/wmclicks/public_html/adv/tun/$login", O_RDWR|O_CREAT|O_EXCL, 0644;
$hasht{number} ="0";
untie %hasht;


if ($referer ne "")
{
$f="/web/012/wmclicks/public_html/adv/refered/$referer.dat";

	if (-e $f)
	{
	open (FILE,">>/web/012/wmclicks/public_html/adv/refered/$referer.dat");
	print FILE "$login\n";
    close (FILE); 
	}

	else
	
	{
	open (FILE,">/web/012/wmclicks/public_html/adv/refered/$referer.dat");
	print FILE "$login\n";
    close (FILE); 
	}

}


print "<p align=center><b>Поздравляем, теперь вы зарегистрированы! Переводите деньги на Ваш счет и получайте посетителей на свой сайт!</b>";
print "<p>&nbsp;<p align=center><A HREF=http://wmclicks.com>На главную страницу</A></p>";
print "$r";

}

if ($err eq "1")
{
print "<p align=center><b>Рекламодатель с таким логином уже существует!</b>";
}

if ($pass ne $pass1)
{
print "<p align=center><b>Введенные пароли не совпадают!!!</b>";
}



print "<p align=right><img src=http://wmclicks.com/reg.gif hspace=10 align=right>";
print "</td><td width=150 align=center bgcolor=#91e1cd height=25><b>Для посетителей</b></td></tr><tr>";
print "<td width=150 bgcolor=#006c00 valign=top><FORM METHOD=POST ACTION=http://wm-clicks.h1.ru/cgi-bin/enter.pl><font color=#91e1cd>Логин:<br></font><input type=text name=login class=fr><br><font color=#91e1cd>Пароль:<br></font><input type=password name=pass class=fr>";
print "<p class=mn><input type=submit value=\" Вход \" style='background: #00c392; font-face:Verdana; font-size: 9pt'></p>";
print "</FORM><p class=s><a href=http://wmclicks.com/cgi-bin/regform.pl>Регистрация</a></p><p class=s><a href=http://wmclicks.com/qvest.html>Вопросы и ответы</a><br><br></p></td></tr><tr><td width=150 align=center bgcolor=#91e1cd height=25><b>Для рекламодателей</b></td></tr><tr>";
print "<td width=150 bgcolor=#006c00 valign=top><FORM METHOD=POST ACTION=http://wmclicks.com/cgi-bin/adventer.pl><font color=#91e1cd>Логин:<br></font><input type=text name=login class=fr><br><font color=#91e1cd>Пароль:<br></font><input type=password name=pass class=fr>";
print "<p class=mn><input type=submit value=\" Вход \" style='background: #00c392; font-face:Verdana; font-size: 9pt'></p></FORM><p class=s><a href=http://wmclicks.com/adv_reg.html>Регистрация</a></p><p class=s><a href=http://wmclicks.com/adv_qvest.html>Вопросы и ответы</a><br>";
print "<br></p></td></tr><tr><td width=150 bgcolor=#006c00 valign=bottom align=right><p class=mn align=left><script language=javascript>";
print "d=document;rn=Math.random();";
print "y=\"<a href='http://u1542.50.spylog.com/cnt?f=3&rn=\"+rn+\"' target=_blank><img src='http://u1542.50.spylog.com/cnt?\";";
print "y+=\"p=1&f=4&rn=\"+rn+\"' border=0 width=88 height=31 ></a>\"; d.write(y);";
print "</script><noscript><a href=http://u1542.50.spylog.com/cnt?f=3&p=1 target=_blank>";
print "<img src=http://u1542.50.spylog.com/cnt?p=1&f=4 alt='SpyLOG' border='0' width=88 height=31 ></a></noscript></p><font color=#91e1cd size=1>Web Design by<br><a href=mailto:admin\@wmclicks.com>WM-Clicks</a> &copy;</font></td></tr></table></td></tr></table></body></html>";
