#!/usr/local/bin/perl
#
# File : Sub.cgi
# Purpose : A cgi script is aimed for on-line Submission
#
require "../PH/REGVAR.ph";
require "Sub.ph";
#print $query->header;
dbmopen(%DATA, $FileSub, 0600);
@username=split(/\@/,$query->param(email));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time());
$mon += 1;
$year += 1900;
$Tyear = $REG_END{YEAR};
$Tmon = $REG_END{MONTH};
$Tday = $REG_END{DAY};
$PASS = 0;
if ($year >= $Tyear){
if ($mon >= $Tmon){
if ($mday >= $Tday){ $PASS = 1;
}elsif ($mon > $Tmon){ $PASS = 1; }
}elsif ($year > $Tyear){ $PASS = 1; }
}
if ($PASS == 1){
$~=Title;
write;
print '
The Registration Function Expired';
}elsif (!$query->param){ # Show initial form
$~=Title;
write;
$~=SubForm;
write;
} elsif ( $query->param(name) =~/^[ ]*$/ || $query->param(aff) =~/^[ ]*$/ || $query->param(title) =~/^[ ]*$/ || $query->param(email) =~/^[ ]*$/){
$~=Title;
write;
$~=err_form1; # check NULL or blank in field
write;
$~=SubForm;
write;
} elsif (!$query->param(email)=~/\@/ || !$username[0]=~/[0-9a-zA-Z]+/ || $username[2] ne '' || $username[1] eq '' ){
$~=Title;
write;
$~=err_form2;
write;
$~=SubForm;
write;
} else{ # Execute form
$dup_title = 0;
foreach $exist_id (keys %DATA){
UnPackData(\%RECORD,\$DATA{$exist_id});
if ($query->param(title) eq $RECORD{title}){
$dup_title = 1;
goto SKIP;
}
}
SKIP:
if ($dup_title == 1){
$~=Title;
write;
$~=err_form3;
write;
$~=SubForm;
write;
}else{
$count=&CountData(\%DATA) + 1;
$len= length($count);
if ($len == 1){ $len=join('',"000",$count); } # conver number to 3 digits
elsif($len == 2 ) { $len=join('',"00",$count); }
elsif($len == 3 ) { $len=join('',"0",$count); }
elsif($len == 4 ) { $len=join('',"",$count); }
$username[1] =~ tr/A-Z/a-z/;
$temp=$username[0].'@'.$username[1];
$query->param('email',$temp);
#
if($username[0] =~ / /){
$username[0] =~ s/ *//;
}
$id=join('', $username[0], $len);
# &GetTime();
# $pw=join('', $mon++, $mday, $hour, $min);
$retval= rand (10000000);
$pw=60000000 + int ($retval);
$query->delete(Submit);
$DATA{$id} = "pw=$pw&".$query->query_string || die "$!\n";
print $query->header;
$~=SubEnd;
write;
dbmopen(%PASSWD,"$FilePasswd/sub",0600);
$PASSWD{$id}=crypt($pw, 'TL').":sub";
dbmclose(%PASSWD);
$to=$query->param(email);
$name=$query->param(name);
$MailTo = "To: $to\n";
$mailing = $MailReplyTo.$MailFrom.$MailTo.$MailSubject_sub;
$MailData = "$mailing";
$MailData .= "Dear $name\,\n\n";
$MailData .= " ID : $id\n";
$MailData .= " PASSWD : $pw\n\n";
$MailData .= " we have found that you have made a succesful submission! \n";
$MailData .= "You can use the above ID and PASSWD to\n";
$MailData .= " (1) modify paper submission registration information and\n";
$MailData .= " (2) query the status of your paper and reviewers' comments and\n";
$MailData .= " (3) send your paper through upload and\n";
$MailData .= " (4) withdraw your paper.\n";
$MailData .= " \n $Conf Program Committee \n";
sendmail($from, $to, $MailData) ;
}
}
$filedirpath=$DirPaper.'/'.$id.'.'.$pw;
mkdir($filedirpath,0700);
dbmclose(%DATA);