#!/usr/local/bin/perl
$mail_prog = '/usr/lib/sendmail' ;
&GetFormInput;
	

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

open (FILE,"/web/012/wmclicks/public_html/adv/act.dat");
@list=<FILE>;
close (FILE);
chomp ($list[0]);

@advs=split (/,/,$list[0]);


use Fcntl;
use NDBM_File;

print "Content-Type: text/html\n\n";
print "<html><head><title>Информация по рекламодателям WM-clicks</title></head>";
print "<body BACKGROUND=\"http://wmclicks.com/bg.gif\" TEXT=\"#000000\">";
print "<center>";

print "<!-- Russian LinkExchange code START (468x60)-->\n";
print "  <iframe src=http://www.linkexchange.ru/cgi-bin/erle.cgi?28805?44 \n";
print "  frameborder=0 vspace=0 hspace=0 width=468 height=60 \n";
print "  marginwidth=0 marginheight=0 scrolling=no>\n";
print "  <a href=http://www.linkexchange.ru/users/028805/goto.map target=_top> \n";
print "  <img src=http://www.linkexchange.ru/cgi-bin/rle.cgi?28805?44 \n";
print "  alt=\"RLE Banner Network\" border=0 height=60 width=468></a> \n";
print "  </iframe> \n";
print "<!-- Russian LinkExchange code END --> \n";

print "</center>";

print "<p align=center><a href=\"http://casi.ru\"><font color=#000000>Клуб Casi.ru: вклады под проценты, обмен посетителями, кликами, регистрациями</font></a>";

print "<p align=center><a href=http://un-ibank.com target=_blank><font color=#FF0000>UN-iBANK - финансовые услуги в системе WebMoney: инкассо чеков, платежные карты, аттестация, вклады и другое</font></a>";

print "<p align=center><b>Все рекламодатели WM-clicks</b><br>";
print "<center><table border=1>";
print "<tr><td><b>Рекламодатель</b></td><td><b>Хостов на счету</b></td><td><b>Таргетинг</b></td><td><b>Статус аккаунта</b></td></tr>";

foreach $d (@advs)
{
tie %hasht, "NDBM_File", "/web/012/wmclicks/public_html/adv/logs/$d", O_RDWR, 0644;
$sitename = $hasht{sitename};
$url=$hasht{url};
untie %hasht;
tie %hasht, "NDBM_File", "/web/012/wmclicks/public_html/adv/money/$d", O_RDWR, 0644;
$summ = $hasht{summ};
untie %hasht;

$host = $summ/0.005;

open (FILE,"/web/012/wmclicks/public_html/adv/status/$d.dat");
@k=<FILE>;
close (FILE);

chomp ($k[0]);


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



print "<tr><td><A HREF=$url>$sitename</A></td><td>$host</td><td><A HREF=http://wmclicks.com/cgi-bin/advstat.pl?adv=$d TARGET=_blank><FONT COLOR=#FF0000>Таргетинг</FONT></A></td>";

if ($k[0]==1)
{
print "<td>ВКЛ</td>";
}
else
{
print "<td>ВЫКЛ</td>";
}

print "</tr>";	 
	
}


print "</table></center></body></html>";
