#!/usr/local/bin/perl
$mail_prog = '/usr/sbin/sendmail' ;
&GetFormInput;
$login = $field{'login'} ;	 
$number = $field{'number'};
$text = $field{'text'};
$R1 = $field{'R1'};
$C1 = $field{'C1'};
$C2 = $field{'C2'};
$C3 = $field{'C3'};
$C4 = $field{'C4'};
$C5 = $field{'C5'};
$C6 = $field{'C6'};
$C7 = $field{'C7'};


$V1 = $field{'V1'};
$V2 = $field{'V2'};
$V3 = $field{'V3'};
$V4 = $field{'V4'};
$V5 = $field{'V5'};
$V6 = $field{'V6'};
$V7 = $field{'V7'};
$V8 = $field{'V8'};
$V9 = $field{'V9'};
$V10 = $field{'V10'};
$V11 = $field{'V11'};
$V12 = $field{'V12'};
$V13 = $field{'V13'};
$V14 = $field{'V14'};
$V15 = $field{'V15'};
$V16 = $field{'V16'};
$V17 = $field{'V17'};
$V18 = $field{'V18'};
$V19 = $field{'V19'};
$V20 = $field{'V20'};
$V21 = $field{'V21'};
$V22 = $field{'V22'};
$V23 = $field{'V23'};
$V24 = $field{'V24'};


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


$f="/web/012/wmclicks/public_html/adv/tun/$login.pag";
unlink ($f);

$f="/web/012/wmclicks/public_html/adv/tun/$login.dir";
unlink ($f);

use Fcntl;
use NDBM_File;

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

if ($R1 eq "v1")
{
$box = 1;
} 

if ($R1 eq "v2")
{
$box = 2;
} 

if ($R1 eq "v3")
{
$box = 3;
} 


$hasht{box} = $box;


if ($C1 eq "on")
{
$day="1";
}
if ($C2 eq "on")
{
$day="$day,2";
}
if ($C3 eq "on")
{
$day="$day,3";
}
if ($C4 eq "on")
{
$day="$day,4";
}
if ($C5 eq "on")
{
$day="$day,5";
}
if ($C6 eq "on")
{
$day="$day,6";
}
if ($C7 eq "on")
{
$day="$day,7";
}

$hasht{day}=$day;

if ($V1 eq "on")
{
$hour="1";
}
if ($V2 eq "on")
{
$hour="$hour,2";
}
if ($V3 eq "on")
{
$hour="$hour,3";
}
if ($V4 eq "on")
{
$hour="$hour,4";
}
if ($V5 eq "on")
{
$hour="$hour,5";
}
if ($V6 eq "on")
{
$hour="$hour,6";
}
if ($V7 eq "on")
{
$hour="$hour,7";
}
if ($V8 eq "on")
{
$hour="$hour,8";
}
if ($V9 eq "on")
{
$hour="$hour,9";
}
if ($V10 eq "on")
{
$hour="$hour,10";
}
if ($V11 eq "on")
{
$hour="$hour,11";
}
if ($V12 eq "on")
{
$hour="$hour,12";
}
if ($V13 eq "on")
{
$hour="$hour,13";
}
if ($V14 eq "on")
{
$hour="$hour,14";
}if ($V15 eq "on")
{
$hour="$hour,15";
}
if ($V16 eq "on")
{
$hour="$hour,16";
}
if ($V17 eq "on")
{
$hour="$hour,17";
}
if ($V18 eq "on")
{
$hour="$hour,18";
}
if ($V19 eq "on")
{
$hour="$hour,19";
}
if ($V20 eq "on")
{
$hour="$hour,20";
}
if ($V21 eq "on")
{
$hour="$hour,21";
}
if ($V22 eq "on")
{
$hour="$hour,22";
}
if ($V23 eq "on")
{
$hour="$hour,23";
}
if ($V24 eq "on")
{
$hour="$hour,24";
}

$hasht{hour}=$hour;
$hasht{text}=$text;



untie %hasht;





tie %hash, "NDBM_File", "/web/012/wmclicks/public_html/adv/logs/$login", O_RDWR, 0644;

$ps=$hash{pass};


untie %hash;

print "Location: http://www.wmclicks.com/cgi-bin/adventer.pl?login=$login&pass=$ps\nURI: http://www.wmclicks.com/cgi-bin/adventer.pl?login=$login&pass=$ps\n\n";





