1
0
Fork 0
my_site_mk3/outside.pl

53 lines
1.9 KiB
Perl

#!/usr/bin/perl
use locale;
require 'common.pl';
use CGI qw/:standard/;
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
my $debug_out="debug/debug_outside.txt";
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
local($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$in{$name} = $value;
}
my @cookieArray=split ("; ",$ENV{'HTTP_COOKIE'});
my $cookieName;my $cookieValue;
foreach (@cookieArray){
($cookieName,$cookieValue)=split("=",$_);
$cookieHash{$cookieName}=$cookieValue;
}
if ($ENV{'QUERY_STRING'} ne '') {
@qstr = split (/=/,$ENV{'QUERY_STRING'});
$command = $qstr[0];
$value = $qstr[1];
$value =~ s/[\x00-\x20<>\|;\(\)\$^\+!\^\[\]\?\"\'\`]//g;
if ($command eq "error"){$error=1;&displayDefault;}
else {&displayDefault;}
}
else{&displayDefault;}
sub displayDefault(){
print "Content-type: text/html\n\n";
print <<"EOF";
<html>\n
<head><script language="javascript">
window.onload=function() {document.getElementById("in").focus();};
</script>\n<title>Çà îêíîì</title>\n
EOF
if ($cookieHash{'light'}){print '<link type="text/css" rel="stylesheet" href="white.css">';}
else {print '<link type="text/css" rel="stylesheet" href="black.css">';}
print <<"EOF";
</head><body>
Âû ñòàâèòå ñèíþþ êîíå÷íîñòü íà ñòåíó.Îíà ïðèðàñòàåò ê êàìíþ,è âû ëåãêî âñòà¸òå íà íå¸.Çàöåïèâøèñü çà êðàé ñòåíû,âû çàáèðàåòåñü íàâåðõ.<br>
Íà ýòîì ìåñòå ÿ âûíóæäåí ïðèîñòàíîâèòü ìîé ðàññêàç. áóäóùåì îí ïðîäîëæèòñÿ.<br>
Ñ óâàæåíèåì,<be>
<em>Oreolek</em>
EOF
if ($error){print "<p id=\"err\">Êîìàíäà íå ðàñïîçíàíà.</p>";$error=0;}
print "<FORM NAME='input' ACTION='outside.pl' METHOD='POST'>\n";
print "<input type='hidden' name='location' id='location' value='outside'>\n";
print "&gt; <input type=text id=\"in\" name=\"input\" size=54 maxlength=65>\n";
print "</body>\n</html>";
}