#!/usr/bin/perl
=head1 NAME
chik.cgi - a robot for competitions with separate starts
=head1 DESCRIPTION
The robot is a Web CGI interface. It must authentificate
the team. If the regnumber and password are corrrect, it sends
a message to the team's email and demonstrates the questions on
the web. Also, it updates the field "StartTime" and sends message
to the secretary "Team NN started at I<Date>"
=head1 USES
MySQL table Chik with the fields:
RegNum Int UNIQUE,
Name TINYTEXT,
Password TINYTEXT,
Email TINYTEXT,
Started ENUM(Y,N),
StartTime TIMESTAMP(14),
It expects to find the file F<../mail/chik/robot.cfg>, which is a piece of
Perl code, defining the following variables:
=over 4
=item C<$secretary>
Email of the secretary
=item C<$questions>
Location of the file with the questions
=back
=head1 AUTHOR
Boris Veytsman
=head1 DATE
$Date: 2000/10/31 21:30:30 $
=head1 VERSION
$Revision: 1.1 $
=cut
use strict;
use CGI;
my $query=new CGI;
print $query->header;
print $query->start_html(-title=>'Вопросы ЧИК',-bgcolor=>'#fff0e0');
print Include_virtual("../dimrub/db/reklama.html");
print $query->h1({'-align'=>'center'},'Вопросы ЧИК');
print_query($query);
print $query->end_html;
exit 0;
sub Include_virtual {
my ($fn, $output) = (@_, '');
open F , $fn
or return; #die "Can't open the file $fn: $!\n";
while (<F>) {
if (/<!--#include/o) {
s/<!--#include virtual="\/(.*)" -->/&Include_virtual($1)/e;
}
if (/<!--#exec/o) {
s/<!--#exec.*cmd\s*=\s*"([^"]*)".*-->/`$1`/e;
}
$output .= $_;
}
return $output;
}
sub print_query {
my $query = shift;
print $query->start_form;
print $query->end_form;
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>