#!/usr/bin/perl -w # # captcha.cgi - gibt eine HTML-Seite (Formular) aus und baut an einer # beliebigen Stelle ein Captcha ein # Die Seite muss im selben Verzeichnis wie das Skript liegen und form.shtml # heissen ############################################################################### use strict; #use CGI::Carp('fatalsToBrowser'); BEGIN { if(!defined($ENV{'DOCUMENT_ROOT'})) { warn "no documentroot defined!\n"; print "Status: 204 No Response\n\n"; exit(0); } } use lib "$ENV{'DOCUMENT_ROOT'}/cgi-bin/mail/"; use lib "$ENV{'DOCUMENT_ROOT'}/_lib/"; use Captcha; use SSI_Parser; $SSI_Parser::recursive = 1; ############################################################################### my $TPL='form.shtml'; ############################################################################### print "Content-type:text/html\n\n"; if(!-e $TPL) { die("Das Formular wurde nicht gefunden.\n"); } open(FH,$TPL) || die($!); local($/); my $html=; close(FH); # my $captcha=Captcha::fetch(); $html=~s/<\?Captcha.Question\?>/$captcha->{'question'}/sg; $html=~s/<\?Captcha.Serial\?>/$captcha->{'serial'}/sg; sssi($html); exit(0);