version 1.109, 2003/04/20 12:21:13
|
version 1.115, 2003/04/22 10:50:37
|
Line 9 use locale;
|
Line 9 use locale;
|
use vars qw($opt_z); |
use vars qw($opt_z); |
use Getopt::Std; |
use Getopt::Std; |
getopts('z'); |
getopts('z'); |
|
my $withanswers=param('answer')||param('answers'); |
open STDERR, ">/var/tmp/errors1"; |
open STDERR, ">/var/tmp/errors1"; |
my $newsurl='http://news.chgk.info/'; |
my $newsurl='http://news.chgk.info/'; |
my $HTMLDIR=""; |
my $reklama="../dimrub/db/reklama.html"; |
|
$reklama="../reklama.html" if $opt_z; |
|
my $HTMLDIR="/znatoki/dimrub/db/baza/"; |
my $realHTMLDIR; |
my $realHTMLDIR; |
if ($^O =~ /win/i) { |
if ($^O =~ /win/i) { |
$realHTMLDIR="/html/znatoki/baza/"; |
$realHTMLDIR="/html/znatoki/baza/"; |
Line 19 if ($^O =~ /win/i) {
|
Line 22 if ($^O =~ /win/i) {
|
{ |
{ |
$realHTMLDIR="/home/znatoki/public_html/dimrub/db/baza/"; |
$realHTMLDIR="/home/znatoki/public_html/dimrub/db/baza/"; |
} |
} |
my $usehtml=1; |
my $usehtml=$opt_z||0; |
my $usewas=0; |
my $usewas=0; |
my $cashednumber=500; |
my $cashednumber=500; |
my $outputnumber=10; |
my $outputnumber=10; |
Line 225 sub tourhref {
|
Line 228 sub tourhref {
|
$res.=$a?"-a":"-q" unless $gr; |
$res.=$a?"-a":"-q" unless $gr; |
$res.=".html"; |
$res.=".html"; |
$res=~s/(\#\d+)(.*)$/$2$1/; |
$res=~s/(\#\d+)(.*)$/$2$1/; |
|
$res="$HTMLDIR$res" unless $opt_z; |
return $res; |
return $res; |
} else { |
} else { |
$res=$url; |
$res=$url; |
$res.="?tour=$t"; |
$res.="?tour=$t"; |
$res.=$a?"?answers=1":""; |
$res.=$a?"&answers=1":""; |
return $res; |
return $res; |
} |
} |
|
|
Line 1415 sub Get12Random {
|
Line 1419 sub Get12Random {
|
|
|
sub Include_virtual { |
sub Include_virtual { |
my ($fn, $output) = (@_, ''); |
my ($fn, $output) = (@_, ''); |
|
return "<!--#include virtual=\"$fn\"-->" if ($opt_z); |
open F , $fn |
open F , $fn |
or return ""; #die "Can't open the file $fn: $!\n"; |
or return ""; #die "Can't open the file $fn: $!\n"; |
|
|
Line 1812 MAIN:
|
Line 1816 MAIN:
|
or do { |
or do { |
print h1("Временные проблемы") . "База вопросов временно не |
print h1("Временные проблемы") . "База вопросов временно не |
работает. Заходите попозже."; |
работает. Заходите попозже."; |
print &Include_virtual("../dimrub/db/reklama.html") if $url!~/localhost/; |
print &Include_virtual("$reklama") if $url!~/localhost/; |
print end_html; |
print end_html; |
die "Can't connect to DB chgk\n"; |
die "Can't connect to DB chgk\n"; |
}; |
}; |
Line 1877 td {font-size: x-small; font-family : sa
|
Line 1881 td {font-size: x-small; font-family : sa
|
th {font-size: x-small; font-family : sans-serif} |
th {font-size: x-small; font-family : sans-serif} |
</style>\n"; |
</style>\n"; |
|
|
$globaloutput.=&Include_virtual("../dimrub/db/reklama.html")||''; |
$globaloutput.=&Include_virtual("$reklama")||''; |
} |
} |
|
|
if (length ($qs)<=255 && $qs !~ /(sstr)|(rand)|(comp)|(all=)/i) { |
if (length ($qs)<=255 && $qs !~ /(sstr)|(rand)|(comp)|(all=)/i) { |
Line 2018 EOT
|
Line 2022 EOT
|
$QuestionNumber=($sth->fetchrow)[0]||0; |
$QuestionNumber=($sth->fetchrow)[0]||0; |
} |
} |
if ($QuestionNumber) { |
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 |
# $dbh, $Id, $answer, $qnum, $title, $text |
} else { |
} else { |
$globaloutput.=&PrintTournament($dbh, $tour, param('answer')); |
$globaloutput.=&PrintTournament($dbh, $tour, $withanswers); |
} |
} |
} |
} |
else { |
else { |
Line 2056 my ($sth) = $dbh->prepare("SELECT t1.Id,
|
Line 2060 my ($sth) = $dbh->prepare("SELECT t1.Id,
|
$fname=~s/\.txt$//; |
$fname=~s/\.txt$//; |
if ($type=~/Т/ || $c<=1) |
if ($type=~/Т/ || $c<=1) |
{ |
{ |
open FF, ">$realHTMLDIR$fname-q.html" or die "ERROR! - $HTMLDIR$fname-q.html\n"; |
open FF, ">$realHTMLDIR$fname-q.html" or die "ERROR! - $fname-q.html\n"; |
my $o=$globaloutput; |
my $o=$globaloutput; |
$o.=&PrintTournament($dbh, $Id, 0); |
$o.=&PrintTournament($dbh, $Id, 0); |
$o.=&Bottom; |
$o.=&Bottom; |
Line 2070 my ($sth) = $dbh->prepare("SELECT t1.Id,
|
Line 2074 my ($sth) = $dbh->prepare("SELECT t1.Id,
|
close FF; |
close FF; |
} |
} |
else { |
else { |
open FF, ">$realHTMLDIR$fname.html" or die "ERROR! - $HTMLDIR$fname-q.html\n"; |
open FF, ">$realHTMLDIR$fname.html" or die "ERROR! - $fname-q.html\n"; |
my $o=$globaloutput; |
my $o=$globaloutput; |
$o.=&PrintTournament($dbh, $Id, 0); |
$o.=&PrintTournament($dbh, $Id, 0); |
$o.=&Bottom; |
$o.=&Bottom; |