#!/usr/bin/perl
##############################################################################
# Cliff's Banner Rotater Version 2.51 #
# Copyright 1998 Shaven Ferret Productions #
# Created 7/8/98 Last Modified 12/04/98 #
# Available at http://www.shavenferret.com/scripts #
##############################################################################
# COPYRIGHT NOTICE #
# Copyright 1998 Shaven Ferret Productions All Rights Reserved. #
# #
# This script can be used\modified free of charge as long as you don't #
# change this header thing. By using this script you agree to indemnify #
# me from any liability that might arise from its use. In simple English, #
# if this script somehow makes your computer run amuck and kill the pope, #
# it's not my fault. #
# #
# Redistributing\selling the code for this program without prior written #
# consent is expressly forbidden. #
##############################################################################
# If the ads directory is not in the same directory as this file, enter
# the server path (not the URL) to the ads directory. Do not include a
# trailing slash.
$datadir = "/var/www/u6614017/data/www/journal.oilgaslaw.ru/cgi-bin/ban468";
##############################################################################
# Congratulations! You've finished defining the variables. If you want to, #
# you can continue screwing with the script, but it isn't necessary. #
##############################################################################
print "Content-type: text/html\n\n";
srand();
open(FILE,"$datadir/main.txt");
@ads = ;
close(FILE);
for ($i = 0; $i <= $#ads; $i++) {
chomp($ads[$i]);
($file,$weight,$page,$max) = split(/\|/, $ads[$i]);
$page = "/" . $page;
for ($j = 1; $j <= $weight; $j++) {
if (($page ne "/" && $page eq $ENV{'DOCUMENT_URI'}) || ($page eq "/")) { splice(@choose,0,0,$i); }
}
}
$adnum = int(rand($#choose));
($file,$weight,$page,$max) = split(/\|/, $ads[$choose[$adnum]]);
open(FILE,"$datadir/$file-ad.txt");
@adtext = ;
close(FILE);
foreach $line(@adtext) { print "$line"; }
open(FILE,"$datadir/$file-count.txt");
flock(FILE,2);
$count = ;
close(FILE);
$count++;
unless ($max && $count >= $max) {
open(FILE,">$datadir/$file-count.txt");
flock(FILE,2);
print FILE "$count";
close(FILE);
exit;
}
else {
splice(@ads,$choose[$adnum],1);
open(FILE,">$datadir/main.txt");
foreach $ad(@ads) { print FILE "$ad\n"; }
close(FILE);
unlink("$datadir/$file-count.txt");
unlink("$datadir/$file-ad.txt");
exit;
}
#!/usr/bin/perl
##############################################################################
# Cliff's Banner Rotater Version 2.51 #
# Copyright 1998 Shaven Ferret Productions #
# Created 7/8/98 Last Modified 12/04/98 #
# Available at http://www.shavenferret.com/scripts #
##############################################################################
# COPYRIGHT NOTICE #
# Copyright 1998 Shaven Ferret Productions All Rights Reserved. #
# #
# This script can be used\modified free of charge as long as you don't #
# change this header thing. By using this script you agree to indemnify #
# me from any liability that might arise from its use. In simple English, #
# if this script somehow makes your computer run amuck and kill the pope, #
# it's not my fault. #
# #
# Redistributing\selling the code for this program without prior written #
# consent is expressly forbidden. #
##############################################################################
# If the ads directory is not in the same directory as this file, enter
# the server path (not the URL) to the ads directory. Do not include a
# trailing slash.
$datadir = "/var/www/u6614017/data/www/journal.oilgaslaw.ru/cgi-bin/ban234";
##############################################################################
# Congratulations! You've finished defining the variables. If you want to, #
# you can continue screwing with the script, but it isn't necessary. #
##############################################################################
print "Content-type: text/html\n\n";
srand();
open(FILE,"$datadir/main.txt");
@ads = ;
close(FILE);
for ($i = 0; $i <= $#ads; $i++) {
chomp($ads[$i]);
($file,$weight,$page,$max) = split(/\|/, $ads[$i]);
$page = "/" . $page;
for ($j = 1; $j <= $weight; $j++) {
if (($page ne "/" && $page eq $ENV{'DOCUMENT_URI'}) || ($page eq "/")) { splice(@choose,0,0,$i); }
}
}
$adnum = int(rand($#choose));
($file,$weight,$page,$max) = split(/\|/, $ads[$choose[$adnum]]);
open(FILE,"$datadir/$file-ad.txt");
@adtext = ;
close(FILE);
foreach $line(@adtext) { print "$line"; }
open(FILE,"$datadir/$file-count.txt");
flock(FILE,2);
$count = ;
close(FILE);
$count++;
unless ($max && $count >= $max) {
open(FILE,">$datadir/$file-count.txt");
flock(FILE,2);
print FILE "$count";
close(FILE);
exit;
}
else {
splice(@ads,$choose[$adnum],1);
open(FILE,">$datadir/main.txt");
foreach $ad(@ads) { print FILE "$ad\n"; }
close(FILE);
unlink("$datadir/$file-count.txt");
unlink("$datadir/$file-ad.txt");
exit;
}
Адрес редакции: 115054 Москва, ул.Зацепа, 23, офис 11 Тел.: +7 (495) 235-25-49, 235-47-88 | e-mail: info@oilgaslaw.ru