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

	 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/$member[0]", O_RDWR, 0644;
$mail=$hasht{mail};
$nick=$hasht{nick};
$pass=$hasht{pass};
untie %hasht;


$recip = $mail;
open (MAIL, "|$mail_prog -t");
print MAIL "To: $recip\n";
print MAIL "Reply-to: WM-clicks\n";
print MAIL "From: WM-clicks\n";
print MAIL "Subject: wmclicks.com ::: рассылка для пользователей.\n";
print MAIL "\n\n";
print MAIL "Здравствуйте, $nick!\n\n";
print MAIL "Ваш логин: $login\n" ;
print MAIL "ваш пароль: $pass"
print MAIL "\n\n-----------------------------\n";
print MAIL "АДМИНИСТРАЦИЯ WM-clicks\n";
print MAIL "http://wmclicks.com";
print MAIL "\n\n";
close (MAIL);


print "Location: http://www.wmclicks.com/cgi-bin/pasent.html\nURI: http://www.wmclicks.com/pasent.html\n\n";
