#!/usr/bin/perl sub URLDecode { my $theURL = $_[0]; $theURL =~ tr/+/ /; $theURL =~ s/%([a-fA-F0-9]{2,2})/chr(hex($1))/eg; $theURL =~ s///g; return $theURL; } sub URLEncode { my $theURL = $_[0]; my $MetaChars = quotemeta( ';,/?\|=+)(*&^%$#@!~`:'); $theURL =~ s/([$MetaChars\"\'\x80-\xFF])/"%" . uc(sprintf("%2.2x", ord($1)))/eg; $theURL =~ s/ /\+/g; return $theURL; } my $in; if ($ENV{'REQUEST_METHOD'} eq "GET") { $in = $ENV{'QUERY_STRING'}; } else { $in = ; } #$in = "group=Tieners"; print "Content-type: text/html\n\n"; print "\n"; print "Foto gallerij\n"; print "\n"; print "\n\n"; print "\n\n"; print "
\n\n"; if ($in eq "") { print "

Foto gallerij

"; open (BESTAND, "images.txt"); while ($regel = ) { chomp($regel); if ( $regel=~/\[(.*)\]/ ) { $t = URLEncode($1); print "$1

\n"; } } close (BESTAND); } @data = split(/=/,$in); if ($data[0] eq "group") { $g = URLDecode($data[1]); print "

$g

"; print "\n\n"; open (BESTAND, "images.txt"); $t = ""; $col = 0; while ($regel = ) { chomp($regel); if ( $regel=~/\[(.*)\]/ ) { $t = $1; } else { if ($t eq $g) { @plaatje = split(/;/,$regel); print ""; $col = $col + 1; if ($col == 1) { print "\n\n\n"; $col = 0; } } } } close (BESTAND); print "\n\n
\n"; print "
$plaatje[1]"; print "
\n"; } if ($data[0] eq "file") { print "\n"; } print "
\n\n"; print "\n";