$error_loop=0;$browser_out=0;if($ENV{REQUEST_METHOD}eqGETandnot$ENV{QUERY_STRING}){$ENV{OUT_TITLE}=Tipsaenkompis!;@msg=(DATA);@msg
=ParseText(@msg);BrowserOut(@msg);exit(0);}CheckRef;ParseForm;if(@missing_valuesor@bad_emailsor@only_digitsor@only_words){Error(ev
ilvalues)}foreach$key(keys%FORM){if($key=~/^_send_email/){@lines=ReadFile(EmailTemplate,$FORM{$key});@lines=ParseText(@lines);Send
Mail(@lines);}elsif($key=~/^_out_file/){@lines=ReadFile(LogFile,$FORM{$key});@lines=ParseText(@lines);LogFile(LogFileTemplate,@lin
es);}elsif($key=~/^_browser_out/and$browser_out2){$browser_out++;@lines=ReadFile(BrowserTemplate,$FORM{$key});@lines=ParseText(@li
nes);BrowserOut(@lines);}elsif($key=~/^_redirect/and$browser_out2){$browser_out++;printLocation:$FORM{$key}\n\n;}}unless($browser_
out){@msg=(DATA);$ENV{OUT_TITLE}=Dittmeddelandeharskickats!;$ENV{OUT_MSG}=Ettmailharskickatstilldinkompisföratttipsaomfilmrecensio
nen.brbrahref=\$FORM{url}\$FORM{film}/abrahref=\http://www.lhasa.nu/~klue/bio/\Filmsidan/a;@msg=ParseText(@msg);BrowserOut(@msg);}
exit(0);subBrowserOut{print$content_type@_\n}subCheckRef{my($valid_referer,@terms);if((@Referers)and($ENV{HTTP_REFERER})){foreach$
referer(@Referers){if($ENV{HTTP_REFERER}=~m|http.*?://$referer|i){$valid_referer++;last;}}}else{$valid_referer++;}unless($valid_re
ferer){@terms=split(/\//,$ENV{HTTP_REFERER});Error(Ogiltigavsauml;ndarsida,Dukaninteskickameddelandenfrån$ENV{HTTP_REFERER}.);}}su
bError{++$error_loop;my$title=shift@_;my$msg=shift@_;my@error;if($titleeqevilvalues){my$val;if(@missing_values){$msg=qq|pFouml;lja
ndefauml;ltmaring;stefyllasi:/p\nol\n|;foreach$val(@missing_values){$msg.=li$val\n}$msg.=/ol\n;}if(@bad_emails){$msg.=qq|pFouml;lj
andefauml;ltmaring;steinneharing;llaemail-adresser:/p\nol\n|;foreach$val(@bad_emails){$msg.=li$val\n}$msg.=/ol\n;}if(@only_digits)
{$msg.=qq|pFouml;ljandefauml;ltfaring;rbarainneharing;llanummer:/p\nol\n|;foreach$val(@only_digits){$msg.=li$val\n}$msg.=/ol\n;}if
(@only_words){$msg.=qq|pFouml;ljandefauml;ltfaring;rbarainneharing;llabokstauml;verochnummer:/p\nol\n|;foreach$val(@only_words){$m
sg.=li$val\n}$msg.=/ol\n;}$title=Felaktigavauml;rden;$msg.=qq|pVargodgaring;tillbakaochrauml;ttafelen./p\n|;}if($FORM{_error_url})
{printLocation:$FORM{_error_url}\n\n}elsif($FORM{_error_path}and$error_loop2){$ENV{OUT_TITLE}=$title;$ENV{OUT_MSG}=$msg;@error=Rea
dFile(ErrorTemplate,$FORM{_error_path});@error=ParseText(@error);BrowserOut(@error);}else{@error=(DATA);$ENV{OUT_TITLE}=$title;$EN
V{OUT_MSG}=$msg;@error=ParseText(@error);BrowserOut(@error);}exit(0);}subLogFile{my$msg=shift@_;my$file=shift@_;$file=~s#\.\./##g;
$file=$base_path.$file;open(FILE,$file)orError(FileAccessError,Anerroroccurredwhentryingtoappendtothe$msg($file):$!);flock(FILE,2)
orError(FileLockError,Anerroroccuredwhenlockingthe$msg($file):$!.);printFILE@_;close(FILE)orError(FileCloseError,Anerroroccurredwh
enclosethe$msg($file):$!.);}subReadFile{my$msg=shift@_;my$file=shift@_;$file=~s#\.\./##g;$file=$base_path.$file;open(FILE,$file)or
Error(FileAccessError,Anerroroccurredwhenopeningthe$msg($file):$!.);my@lines=(FILE);close(FILE)orError(FileCloseError,Anerroroccur
redwhenclosethe$msg($file):$!.);return@lines;}subParseForm{my($key,$prefs,$buffer);if($ENV{REQUEST_METHOD}eqGET){@pairs=split(//,$
ENV{QUERY_STRING})}elsif($ENV{REQUEST_METHOD}eqPOST){read(STDIN,$buffer,$ENV{CONTENT_LENGTH});@pairs=split(//,$buffer)}else{Error(
BadorUnknownRequestMethod,TheformsrequestmethodmustbeeitherPOSTorGET.PleasecheckyourHTML.)}foreach$pair(@pairs){local($name,$value
)=split(/=/,$pair);$name=~tr/+//;$name=~s/%([a-fA-F0-9][a-fA-F0-9])/pack(C,hex($1))/eg;$value=~tr/+//;$value=~s/%([a-fA-F0-9][a-fA
-F0-9])/pack(C,hex($1))/eg;$value=~s/!--(.)*?--//mg;$FORM{$name}=$value;if($name=~/_/and$name!~/^_/){($prefs,$key)=split/_/,$name,
2;if($prefs=~/r/iandnot$value){push@missing_values,$key}if($prefs=~/e/iand$valueand(($value=~/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/)or(
$value!~/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/))){push@bad_emails,$key}if($prefs=~/d/iand$valueand$value=~
/\D/){push@only_digits,$key}if($prefs=~/w/iand$valueand$value=~/\W/){push@only_words,$key}if($prefs=~/s/iand$value){$value=~s/^(\s
)*//;$value=~s/(\s)*$//;$FORM{$name}=$value;}}}}subParseText{my($line,$key,$value,$sub);foreach$line(@_){while(($key=$value)=each%
FORM){$line=~s/\[$key\]/$value/ig}while(($key=$value)=each%ENV){$line=~s/\[\%$key\]/$value/ig}$line=~s/\[[^](.)*?[^]\]//g;}foreach
$line(@_){while($line=~/\[((.)*?)\]/){$sub=$1;$sub=~s/[^\d\+\*\/\-%\.x\(\)]//g;$sub=eval$sub;$line=~s/\[(.)*?\]/$sub/}}return@_;}s
ubSendMail{open(MAIL,|$mail_cmd)orError(MailerOpenError,Anerroroccurredwhentryingtoopenthemailer($mail_cmd):$!.);printMAIL@_;close
(MAIL)orError(MailSendError,Anerroroccurredwhensendingtheemail:$?.Pleasechecktheemailsheaders.);}__END__htmlheadtitle[%OUT_TITLE]/
titlemetahttp-equiv=Content-Typecontent=text/html;charset=iso-8859-1/headbodybgcolor=#FFFFFFbackground=../pics/bg.giftext=#000000l
ink=#6666FFvlink=#6699FFalink=#CCCCCCtablewidth=430border=0cellspacing=0cellpadding=0trtdimgsrc=../pics/streckadlinjev.gifwidth=43
0height=1/td/trtrtdimgsrc=../pics/10x10t.gifwidth=10height=10/td/trtrtdfontface=verdana,arialfontsize=3b[%OUT_TITLE]/b/fontpfontsi
ze=2[%OUT_MSG]/font/p/font/td/trtrtdimgsrc=../pics/10x10t.gifwidth=10height=10/td/trtrtdimgsrc=../pics/streckadlinjev.gifwidth=430
height=1/td/trtrtdimgsrc=../pics/10x10t.gifwidth=10height=10/td/tr/table/body/html$error_loop=0;$browser_out=0;if($ENV{REQUEST_MET
HOD}eqGETandnot$ENV{QUERY_STRING}){$ENV{OUT_TITLE}=Tipsaenkompis!;@msg=(DATA);@msg=ParseText(@msg);BrowserOut(@msg);exit(0);}Check
Ref;ParseForm;if(@missing_valuesor@bad_emailsor@only_digitsor@only_words){Error(evilvalues)}foreach$key(keys%FORM){if($key=~/^_sen
d_email/){@lines=ReadFile(EmailTemplate,$FORM{$key});@lines=ParseText(@lines);SendMail(@lines);}elsif($key=~/^_out_file/){@lines=R
eadFile(LogFile,$FORM{$key});@lines=ParseText(@lines);LogFile(LogFileTemplate,@lines);}elsif($key=~/^_browser_out/and$browser_out2
){$browser_out++;@lines=ReadFile(BrowserTemplate,$FORM{$key});@lines=ParseText(@lines);BrowserOut(@lines);}elsif($key=~/^_redirect
/and$browser_out2){$browser_out++;printLocation:$FORM{$key}\n\n;}}unless($browser_out){@msg=(DATA);$ENV{OUT_TITLE}=Dittmeddelandeh
arskickats!;$ENV{OUT_MSG}=Ettmailharskickatstilldinkompisföratttipsaomfilmrecensionen.brbrahref=\$FORM{url}\$FORM{film}/abrahref=\
http://www.lhasa.nu/~klue/bio/\Filmsidan/a;@msg=ParseText(@msg);BrowserOut(@msg);}exit(0);subBrowserOut{print$content_type@_\n}sub
CheckRef{my($valid_referer,@terms);if((@Referers)and($ENV{HTTP_REFERER})){foreach$referer(@Referers){if($ENV{HTTP_REFERER}=~m|http
.*?://$referer|i){$valid_referer++;last;}}}else{$valid_referer++;}unless($valid_referer){@terms=split(/\//,$ENV{HTTP_REFERER});Err
or(Ogiltigavsauml;ndarsida,Dukaninteskickameddelandenfrån$ENV{HTTP_REFERER}.);}}subError{++$error_loop;my$title=shift@_;my$msg=shi
ft@_;my@error;if($titleeqevilvalues){my$val;if(@missing_values){$msg=qq|pFouml;ljandefauml;ltmaring;stefyllasi:/p\nol\n|;foreach$v
al(@missing_values){$msg.=li$val\n}$msg.=/ol\n;}if(@bad_emails){$msg.=qq|pFouml;ljandefauml;ltmaring;steinneharing;llaemail-adress
er:/p\nol\n|;foreach$val(@bad_emails){$msg.=li$val\n}$msg.=/ol\n;}if(@only_digits){$msg.=qq|pFouml;ljandefauml;ltfaring;rbarainneh
aring;llanummer:/p\nol\n|;foreach$val(@only_digits){$msg.=li$val\n}$msg.=/ol\n;}if(@only_words){$msg.=qq|pFouml;ljandefauml;ltfari
ng;rbarainneharing;llabokstauml;verochnummer:/p\nol\n|;foreach$val(@only_words){$msg.=li$val\n}$msg.=/ol\n;}$title=Felaktigavauml;
rden;$msg.=qq|pVargodgaring;tillbakaochrauml;ttafelen./p\n|;}if($FORM{_error_url}){printLocation:$FORM{_error_url}\n\n}elsif($FORM
{_error_path}and$error_loop2){$ENV{OUT_TITLE}=$title;$ENV{OUT_MSG}=$msg;@error=ReadFile(ErrorTemplate,$FORM{_error_path});@error=P
arseText(@error);BrowserOut(@error);}else{@error=(DATA);$ENV{OUT_TITLE}=$title;$ENV{OUT_MSG}=$msg;@error=ParseText(@error);Browser
Out(@error);}exit(0);}subLogFile{my$msg=shift@_;my$file=shift@_;$file=~s#\.\./##g;$file=$base_path.$file;open(FILE,$file)orError(F
ileAccessError,Anerroroccurredwhentryingtoappendtothe$msg($file):$!);flock(FILE,2)orError(FileLockError,Anerroroccuredwhenlockingt
he$msg($file):$!.);printFILE@_;close(FILE)orError(FileCloseError,Anerroroccurredwhenclosethe$msg($file):$!.);}subReadFile{my$msg=s
hift@_;my$file=shift@_;$file=~s#\.\./##g;$file=$base_path.$file;open(FILE,$file)orError(FileAccessError,Anerroroccurredwhenopening
the$msg($file):$!.);my@lines=(FILE);close(FILE)orError(FileCloseError,Anerroroccurredwhenclosethe$msg($file):$!.);return@lines;}su
bParseForm{my($key,$prefs,$buffer);if($ENV{REQUEST_METHOD}eqGET){@pairs=split(//,$ENV{QUERY_STRING})}elsif($ENV{REQUEST_METHOD}eqP
OST){read(STDIN,$buffer,$ENV{CONTENT_LENGTH});@pairs=split(//,$buffer)}else{Error(BadorUnknownRequestMethod,Theformsrequestmethodm
Hosted by uCoz