Annotation of chik/chik.cgi, revision 1.1
1.1 ! boris 1: #!/usr/bin/perl
! 2:
! 3: =head1 NAME
! 4:
! 5: chik.cgi - a robot for competitions with separate starts
! 6:
! 7: =head1 DESCRIPTION
! 8:
! 9: The robot is a Web CGI interface. It must authentificate
! 10: the team. If the regnumber and password are corrrect, it sends
! 11: a message to the team's email and demonstrates the questions on
! 12: the web. Also, it updates the field "StartTime" and sends message
! 13: to the secretary "Team NN started at I<Date>"
! 14:
! 15: =head1 USES
! 16:
! 17: MySQL table Chik with the fields:
! 18: RegNum Int UNIQUE,
! 19: Name TINYTEXT,
! 20: Password TINYTEXT,
! 21: Email TINYTEXT,
! 22: Started ENUM(Y,N),
! 23: StartTime TIMESTAMP(14),
! 24:
! 25: It expects to find the file F<../mail/chik/robot.cfg>, which is a piece of
! 26: Perl code, defining the following variables:
! 27:
! 28: =over 4
! 29:
! 30: =item C<$secretary>
! 31:
! 32: Email of the secretary
! 33:
! 34: =item C<$questions>
! 35:
! 36: Location of the file with the questions
! 37:
! 38: =back
! 39:
! 40: =head1 AUTHOR
! 41:
! 42: Boris Veytsman
! 43:
! 44: =head1 DATE
! 45:
! 46: $Date:$
! 47:
! 48: =head1 VERSION
! 49:
! 50: $Revision:$
! 51:
! 52: =cut
! 53:
! 54: use strict;
! 55: use CGI;
! 56:
! 57: my $query=new CGI;
! 58:
! 59: print $query->header;
! 60: print $query->start_html(-title=>'÷ÏÐÒÏÓÙ þéë',-bgcolor=>'#fff0e0');
! 61: print Include_virtual("../dimrub/db/reklama.html");
! 62: print $query->h1({'-align'=>'center'},'÷ÏÐÒÏÓÙ þéë');
! 63:
! 64: print_query($query);
! 65:
! 66: print $query->end_html;
! 67:
! 68: exit 0;
! 69:
! 70:
! 71: sub Include_virtual {
! 72: my ($fn, $output) = (@_, '');
! 73:
! 74: open F , $fn
! 75: or return; #die "Can't open the file $fn: $!\n";
! 76:
! 77: while (<F>) {
! 78: if (/<!--#include/o) {
! 79: s/<!--#include virtual="\/(.*)" -->/&Include_virtual($1)/e;
! 80: }
! 81: if (/<!--#exec/o) {
! 82: s/<!--#exec.*cmd\s*=\s*"([^"]*)".*-->/`$1`/e;
! 83: }
! 84: $output .= $_;
! 85: }
! 86: return $output;
! 87: }
! 88:
! 89:
! 90:
! 91: sub print_query {
! 92: my $query = shift;
! 93: print $query->start_form;
! 94: print $query->end_form;
! 95: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>