DE URL VAN HET FORUM STAAT BOVENAAN IN DEZE TOPIC
DIT IS HET PEARL-FILE VAN HET FORUM
KAN IEMAND DE OPLOSSING GEVEN VOOR DEZE DIVERSE FOUTMELDINGEN!?!?!?!?!
$aantalgetoond=25; $imagedir='http://cloud.prohosting.com/amteur/images'; #$GMToffset=1;#
use CGI;
$imagepre='<IMG src="'.$imagedir;
$ht='http://';
$ww='www.';
$lt = '<';
$gt = '>';
$amp = '&';
$br = '<BR>';
($datum,$maand,$jaar,$uur,$minuut,$gmt)=split(/-/,`date +%d-%m-%Y-%H-%M-%g`);
chomp $gmt;
$uur=$uur-$gmt+$GMToffset;
if ( length($uur)<2 ) {
$uur='0'.$uur;
}
if ( length($minuut)<2 ) {
$minuut='0'.$minuut;
}
sub berichtmod(\$) {
$berichtmod=pop;
$$berichtmod.="\n";
$$berichtmod =~ s/&/$amp/g;
$$berichtmod =~ s/</$lt/g;
$$berichtmod =~ s/>/$gt/g;
$$berichtmod =~ s/($ht|$ww)(.+?)( |\. |\? |\,|\(|\)|\n|\r|\"|\')/<A href=\"$ht$1$2\" target=\"_blank\">$1$2<\/A>$3/g;
$$berichtmod =~ s/$ht$ht/$ht/g;
$$berichtmod =~ s/\n|\r/$br/g;
$$berichtmod =~ s/\:\-\)|\:\)/$imagepre\/smile\.gif\">/g;
$$berichtmod =~ s/\:\-\(|\:\(/$imagepre\/sad\.gif\">/g;
$$berichtmod =~ s/\;\-\)|\;\)/$imagepre\/wink\.gif\">/g;
$$berichtmod =~ s/\;\-\(|\;\(/$imagepre\/cry\.gif\">/g;
$$berichtmod =~ s/\:\-\||\:\|/$imagepre\/bored\.gif\">/g;
$$berichtmod =~ s/\:\-d|\:d/$imagepre\/laugh\.gif\">/gi;
$$berichtmod =~ s/\:\-p|\:p/$imagepre\/tongue\.gif\">/gi;
$$berichtmod =~ s/\:\-s|\:s/$imagepre\/sick\.gif\">/gi;
chomp $$berichtmod;
}
sub restmod(\$) {
$restmod=pop;
$$restmod =~ s/&/$amp/g;
$$restmod =~ s/</$lt/g;
$$restmod =~ s/>/$gt/g;
}
sub getCookie($$) {
(my $nr, my $name)=@_;
open (COOKIE, "cookie.txt");
foreach $dummy (<COOKIE>) {
if ( $dummy =~ /^($nr)\:/ ) {
if ( $dummy =~ /\&($name)\=(.+?)\&/ ) {
$value=$2;
} else {
$value="";
}
}
}
close (COOKIE);
return $value;
}
sub setCookie($$$) {
(my $nr, my $name, my $value)=@_;
my $inhoud="";
open (COOKIE, "cookie.txt");
foreach $dummy (<COOKIE>) {
if ( $dummy =~ /^($nr)\:/ ) {
if ( $dummy =~ /\&$name\=/ ) {
$dummy =~ s/(\&$name\=)(.+?)\&/$1$value\&/;
} else {
chomp $dummy;
$dummy.="\&$name=$value\&\n";
}
}
$inhoud.=$dummy;
}
close (COOKIE);
open (COOKIE, ">cookie.txt");
print COOKIE $inhoud;
}
sub makeCookie() {
open (COOKIE, "cookie.txt");
$aantal=<COOKIE>;
chomp $aantal;
$dummy="";
foreach (<COOKIE>) {
$dummy.=$_;
}
close (COOKIE);
$cookienr=++$aantal;
open (COOKIE, ">cookie.txt");
print COOKIE "$aantal\n";
print COOKIE $dummy;
print COOKIE "$cookienr:\n";
close (COOKIE);
}
################################################################
$q = $ENV{'QUERY_STRING'};
$cookienr=CGI::cookie('cookienr');
if ( $cookienr =="" ) {
makeCookie();
}
if ( $q =~ /^0/ ) {
$begin=$';
open (TELBESTAND, "aantal.txt");
$aantal = <TELBESTAND>;
close (TELBESTAND);
if ( $begin eq "" ) {
$begin=$aantal;
}
open (FORUM, "forum.html");
print ("Content-Type: text/html\n\n");
foreach $regel (<FORUM>){
if ( $regel =~ /<!--bericht-->/ ) {
for ( $i = $begin ; $i>$begin-$aantalgetoond && $i>=1 ; $i-- ) {
$r = $regel;
$bestand = $i . '.txt';
open (BESTAND, $bestand) || die $bestand;
$a = <BESTAND>;
chop $a;
$nummer = <BESTAND>;
@dummy=split(/!/,<BESTAND>);
$tijd=$dummy[$#dummy];
chomp $tijd;
$naam = <BESTAND>;
chop $naam;
restmod($naam);
$email = <BESTAND>;
chop $email;
$onderwerp = <BESTAND>;
chomp $onderwerp;
restmod($onderwerp);
($d,$t)=split(/ /,$tijd);
($datum,$maand,$jaar)=split(/-/,$d);
($uur,$minuut)=split(/:/,$t);
if ( getCookie($cookienr,$i) lt "$jaar-$maand-$datum-$uur-$minuut" ) {
$onderwerp .=' '.$imagepre.'/new.gif" border="0">';
}
$r =~ s/!nummer!/$i/g;
$r =~ s/!tijd!/$tijd/g;
$r =~ s/!naam!/$naam/;
$r =~ s/!email!/$email/;
$r =~ s/!onderwerp!/$onderwerp/;
$r =~ s/!reacties!/$a/;
close (BESTAND);
print $r;
}
} elsif ( $regel =~ /<!--nummer-->/ ) {
$nummer = ($aantal + 1);
$regel =~ s/!nr!/$nummer/;
print $regel;
} elsif ($regel =~ /<!--nieuwoud-->/ ) {
if ( $begin+$aantalgetoond <= $aantal ) {
print '<A href="lees.cgi?0'.($begin+$aantalgetoond).'">'.$imagepre.'/nieuwer.gif" border="0"></A>';
} elsif ( $begin != $aantal ) {
print '<A href="lees.cgi?0'.$aantal.'">'.$imagepre.'/nieuwer.gif" border="0"></A>';
}
print ' ';
if ( $begin-$aantalgetoond > 0 ) {
print '<A href="lees.cgi?0'.($begin-$aantalgetoond).'">'.$imagepre.'/ouder.gif" border="0"></A>';
}
} elsif ( $regel =~ /\/\/cookienr/ ) {
$regel =~ s/!cookienr!/$cookienr/;
print $regel;
} else { print $regel }
}
} elsif ($q eq "reset") {
open (AANTAL, "aantal.txt");
$aantal=<AANTAL>;
close (AANTAL);
for ( $i=1;$i<=$aantal;$i++ ) {
setCookie($cookienr,$i,"$jaar-$maand-$datum-$uur-$minuut");
}
print ("Content-Type: text/html\n\n");
print '<HTML><BODY onLoad="window.location='."\'".'lees.cgi?0'."\'".'"></BODY></HTML>';
} else {
setCookie($cookienr,$q,"$jaar-$maand-$datum-$uur-$minuut");
$bestand = $q . '.txt';
open (BESTAND, $bestand) || die "Kan bestand niet openen";
$aantal = <BESTAND>;
chop $aantal;
$n = <BESTAND>;
open (BERICHT, "bericht.html") || die "Kan bestand niet openen";
print ("Content-Type: text/html\n\n");
foreach $regel (<BERICHT>) {
if ( $regel =~ /<!--bericht-->/ ) {
@dummy=split(/!/,<BESTAND>);
$tijd=$dummy[0];
chomp $tijd;
$naam = <BESTAND>;
chop $naam;
restmod($naam);
$email = <BESTAND>;
chop $email;
$onderwerp = <BESTAND>;
chop $onderwerp;
restmod($onderwerp);
while (1) {
$dummy = <BESTAND>;
chop $dummy;
last if ($dummy eq '!eind!');
$bericht .= $dummy;
}
berichtmod($bericht);
$regel =~ s/!tijd!/$tijd/g;
$regel =~ s/!naam!/$naam/;
$regel =~ s/!email!/$email/;
$regel =~ s/!onderwerp!/$onderwerp/;
$regel =~ s/!tekst!/$bericht/;
print $regel;
} elsif ( $regel =~ /<!--reactie-->/ ) {
for ( $i = 0 ; $i < $aantal ; $i++ ) {
$r = $regel;
$tijd = <BESTAND>;
chop $tijd;
$naam = <BESTAND>;
chop $naam;
restmod($naam);
$email = <BESTAND>;
chop $email;
$onderwerp = <BESTAND>;
chop $onderwerp;
restmod($onderwerp);
$bericht = "";
while (1) {
$dummy = <BESTAND>;
chop $dummy;
last if ($dummy eq '!eind!');
$bericht .= $dummy;
}
berichtmod($bericht);
$r =~ s/!tijd!/$tijd/;
$r =~ s/!naam!/$naam/;
$r =~ s/!email!/$email/;
$r =~ s/!onderwerp!/$onderwerp/;
$r =~ s/!tekst!/$bericht/;
print $r;
}
} elsif ( $regel =~ /<!--nummer-->/ ) {
$nummer = $q;
$regel =~ s/!nr!/$nummer/;
print $regel;
} elsif ( $regel =~ /\/\/cookienr/ ) {
$regel =~ s/!cookienr!/$cookienr/;
print $regel;
} else {
print $regel;
}
}
close (BERICHT);
close (BESTAND);
}