#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<body bgcolor=fffffff text=000000>";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
      ($name, $value) = split(/=/, $pair);
      $value =~ tr/+/ /;
      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
      $cgi{$name} = $value;
}
# load in the form contents
$email = $cgi{'email'};
if(length($email) == 0){
        print "<BLINK>Please go back and fill the name...";
        exit;
}
$findone = 0;
open(F,"/var/spool/news/htdocs/tlcplus/dev/locked.html");
open(F1,">/var/spool/news/htdocs/tlcplus//dev/locked");
while(<F>){
	$record = $_;
	chop($record);
	if($email =~ /$record/){
		print "$email has been unlocked<BR>"; 
		$findone += 1;
	}else{
		print F1 "$record\n";
	}
}
close(F1);
close(F);
if($findone == 0)
{
        print "$nickname does not exist in the database!";
	exit;
} 
system("mv /var/spool/news/htdocs/tlcplus//dev/locked /var/spool/news/htdocs/tlcplus/dev/locked.html");
