--- db/prgsrc/db.cgi 2003/04/20 12:27:29 1.111 +++ db/prgsrc/db.cgi 2003/04/22 10:49:32 1.114 @@ -9,8 +9,11 @@ use locale; use vars qw($opt_z); use Getopt::Std; getopts('z'); +my $withanswers=param('answer')||param('answers'); open STDERR, ">/var/tmp/errors1"; my $newsurl='http://news.chgk.info/'; +my $reklama="../dimrub/db/reklama.html"; +$reklama="../reklama.html" if $opt_z; my $HTMLDIR="/znatoki/dimrub/db/baza/"; my $realHTMLDIR; if ($^O =~ /win/i) { @@ -19,7 +22,7 @@ if ($^O =~ /win/i) { { $realHTMLDIR="/home/znatoki/public_html/dimrub/db/baza/"; } -my $usehtml=1; +my $usehtml=0; my $usewas=0; my $cashednumber=500; my $outputnumber=10; @@ -230,7 +233,7 @@ sub tourhref { } else { $res=$url; $res.="?tour=$t"; - $res.=$a?"?answers=1":""; + $res.=$a?"&answers=1":""; return $res; } @@ -1416,7 +1419,7 @@ sub Get12Random { sub Include_virtual { my ($fn, $output) = (@_, ''); - + return "" if ($opt_z); open F , $fn or return ""; #die "Can't open the file $fn: $!\n"; @@ -1813,7 +1816,7 @@ MAIN: or do { print h1("Временные проблемы") . "База вопросов временно не работает. Заходите попозже."; - print &Include_virtual("../dimrub/db/reklama.html") if $url!~/localhost/; + print &Include_virtual("$reklama") if $url!~/localhost/; print end_html; die "Can't connect to DB chgk\n"; }; @@ -1878,7 +1881,7 @@ td {font-size: x-small; font-family : sa th {font-size: x-small; font-family : sans-serif} \n"; - $globaloutput.=&Include_virtual("../dimrub/db/reklama.html")||''; + $globaloutput.=&Include_virtual("$reklama")||''; } if (length ($qs)<=255 && $qs !~ /(sstr)|(rand)|(comp)|(all=)/i) { @@ -2019,10 +2022,10 @@ EOT $QuestionNumber=($sth->fetchrow)[0]||0; } if ($QuestionNumber) { - $globaloutput.= &PrintQuestion($dbh, $QuestionNumber, param('answer')||0, $qnum, 1,0,0); + $globaloutput.= &PrintQuestion($dbh, $QuestionNumber, $withanswers||0, $qnum, 1,0,0); # $dbh, $Id, $answer, $qnum, $title, $text } else { - $globaloutput.=&PrintTournament($dbh, $tour, param('answer')); + $globaloutput.=&PrintTournament($dbh, $tour, $withanswers); } } else {