|
Links
[an error occurred while processing this directive]
[an error occurred while processing this directive]
[an error occurred while processing this directive]
[an error occurred while processing this directive]
[an error occurred while processing this directive]
[an error occurred while processing this directive]
Unterstützte Projekte
[an error occurred while processing this directive]
Menschenrecht / Friedensarbeit
[an error occurred while processing this directive]
Veganismus / Tierrechte
[an error occurred while processing this directive]
Globalisierungskritik
[an error occurred while processing this directive]
Festivals
[an error occurred while processing this directive]
Sponsoren
[an error occurred while processing this directive]
Medienpartner
[an error occurred while processing this directive]
Partner
|
|
|
#!/usr/bin/perl
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
my $num_boxes=param('num');
$num_boxes = "5" if ($num_boxes eq "");
my $win=param('win');
my (@boxdat,@tmp);
my $topic=param('topic');
$topic = "main" if ($topic eq "");
$outfile="data/$topic.html";
$infile="data/$topic.dat";
print "Content-type: text/html\n\n";
if (-M $outfile > "0.0005") {
&newdata;
&gettemplate;
foreach (@boxdat){
($h1,$txt,$link) = split(/\|/,$_);
foreach (@tmp){
$line=$_;
$line =~ s//$h1/g;
$line =~ s//$txt/g;
$line =~ s,href=\"\",href=\"\" target=\"_blank\", if ($win eq "new");
$line =~ s//$link/g;
push (@outp,$line);
}
}
print @outp;
open (NEW, "> $outfile");
flock (NEW,2);
print NEW @outp;
flock (NEW,8);
close (NEW);
}
else{
open(FILE,"$outfile");
foreach (){print;}
close(FILE);
}
exit;
sub newdata{
my ($i, @data, $rnd);
open (DATA, "$infile");
@data= ;
close (DATA);
srand();
$i=0;
$num_boxes=$#data+1 if ($num_boxes>$#data+1);
while ($i <= $num_boxes-1) {
$rnd= rand($#data+1);
if ($data[$rnd]) {
$boxdat[$i]=$data[$rnd];
chomp $boxdat[$i];
$data[$rnd]=undef;
$i++;
}
}}
sub gettemplate
{
open(FILE,"box_temp.html");
@tmp=;
close(FILE);
}
|