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

&GetFormInput;

$nick = $field{'nick'} ;	 
$login = $field{'login'} ;
$pass = $field{'pass'} ;
$mail = $field{'mail'} ;	 
$z = $field{'z'} ;
$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/members/logs/$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://wmclicks.com/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://wmclicks.com/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://wmclicks.com/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://wmclicks.com/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" and $login ne "" and $login ne $referer)
{

use Fcntl;
use NDBM_File;


tie %hash, "NDBM_File", "/web/012/wmclicks/public_html/members/logs/$login", O_RDWR|O_CREAT|O_EXCL, 0644;
$hash{pass} = $pass;
$hash{nick} = $nick;
$hash{mail} = $mail;
$hash{csumm} = "0";
$hash{psumm} = "0";
$hash{refnum} = "0";
$hash{z} = $z;
$hash {referer} = $referer;
untie %hash;

$pg = $pass;
$pg1 = $pass1;

open (FILE,">/web/012/wmclicks/public_html/members/tasks/getmoney/$login.dat");
print FILE "0";
close (FILE);



#Adding number of referals to referers account
$refile="/web/012/wmclicks/public_html/members/logs/$referer.pag";
$refiles="/web/012/wmclicks/public_html/members/logs/$referer.dir";

if (-e $refile)
{



tie %hashd, "NDBM_File", "/web/012/wmclicks/public_html/members/logs/$referer", O_RDWR, 0644;
$pass=$hashd{pass};
$nick=$hashd{nick};
$mail=$hashd{mail};
$z=$hashd{z};
$csumm=$hashd{csumm};
$psumm=$hashd{psumm};
$refnum=$hashd{refnum};
$rf=$hashd{referer};
untie %hashd;

$refnum=$refnum+1;


unlink ($refile);
unlink ($refiles);

tie %hashr, "NDBM_File", "/web/012/wmclicks/public_html/members/logs/$referer", O_RDWR|O_CREAT|O_EXCL, 0644;
$hashr{pass} = $pass;
$hashr{nick} = $nick;
$hashr{mail} = $mail;
$hashr{csumm} = $csumm;
$hashr{psumm} = $psumm;
$hashr{refnum} = $refnum;
$hashr{z} = $z;
$hashr{referer} = $rf;
untie %hashr;




}


print "<p align=center><b>Поздравляем, теперь вы зарегистрированы! Заходите в свой аккаунт и зарабатывайте WM!</b>";
print "<p>&nbsp;<p align=center><A HREF=http://wmclicks.com><FONT COLOR=\"#FF0000\">На главную страницу</FONT></A></p>";
print "$r";










}



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

if ($pg ne $pg1)
{
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://wmclicks.com/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>";
