Документ взят из кэша поисковой машины. Адрес оригинального документа : http://hea.iki.rssi.ru/integral06/perl-bin/confirm.pl~
Дата изменения: Wed Mar 21 23:31:55 2007
Дата индексирования: Mon Oct 1 23:07:56 2012
Кодировка:
#!/usr/bin/perl

# get current time and data
@TIME = localtime(time);
$DATE = @TIME[3].".".(@TIME[4]+1).".".(@TIME[5]+1900);
$time = @TIME[2].":".@TIME[1].":".@TIME[0];

#$bibfile="/export/web/data/integral06/pregistration.bib";
$bibfile="/export/web/www/integral06/perl-bin/pregistration.bib";

require "bp.pl";
&bib'format("auto");


if($ENV{'REQUEST_METHOD'} eq 'GET'){
$query = $ENV{'QUERY_STRING'};
}elsif($ENV{'REQUEST_METHOD'} eq 'POST'){
sysread(STDIN,$query,$ENV{'CONTENT_LENGTH'});
}
$query=urldecode($query);

print "Content-Type: text/html\n\n";
print "";

if($query ne ''){
@fvalues = split(/&/,$query);

foreach $i (0 .. $#fvalues){
$str=$fvalues[$i];
($name,$val) = split(/=/,$fvalues[$i],2);
$name=&urldecode($name);
$val=&urldecode($val);
$field{$name} = $val;
}
}


if($query eq '' || $field{email} eq ''){
&print_form;
print "";
exit 0;
}

exit 0 unless &bib'open($bibfile);
$totrecs = 0;

$is_valid=0;
$print="";
while ($record = &bib'read($bibfile) ) {
%entry = &bib'explode($record);
#print "$entry{'first_name'} $entry{'last_name'}
\n";
if($entry{email} eq $field{email}){
$is_valid=1;
$print.="

Title:

$entry{title}
";
$print.="

Abstract:

$entry{abstract}
";
$print.="
Related information:
";
$name="$entry{first_name} $entry{last_name}";
$print.="";
foreach $k (sort keys %entry){
next if($k eq "CITEKEY");
next if($k eq "TYPE");
next if($k eq "date");
next if($k eq "first_name");
next if($k eq "last_name");
next if($k eq "title");
next if($k eq "abstract");
next if($k eq "persons_number" && $entry{'persons_number'} == 0);
next if($k eq "comments" && $entry{'comments'} eq "");
next if($k eq "under35" && $entry{'under35'} eq "no");
next if($k eq "comments" && $entry{'comments'} eq "");
next if($k eq "address" && $entry{'address'} eq "");
$print.="\n";
}
$print.="
$k$entry{$k}
";
$print.="

Record $entry{date}


";
}
}
&bib'close($bibfile);

if($is_valid == 0){
print "ERROR: Entry not found.
";
&print_form;
}else{

print "

Dear $name,

Please find below the information you have entered on pre-registration, check and confirm.

If you find misstypings and errors in the pre-registration info please fill registration form again using this link.

";
print $print;
print "


I confirm my attendance

Remove me from list

";
}

print "\n";

sub urldecode{
local($val)=@_;
#$val =~ s/\+/ /g;
$val =~ s/%([0-9a-hA-H]{2})/pack('C',hex($1))/ge;
return $val;
}


sub print_form{
print "Please enter e-mail which you have typed in pre-registration:
";
print "
";
}