#!/usr/bin/perl ############################################################################# # Guest Book 98.1.0 Personal Version - Database Maintenance Utility # # [Eng/Unix/Perl5] ############################################################################# # # Dies Script ist Frei für die Benutzung # Das Script kann kostenlos registriert werden bei www.ray.org.hk/perl # ############################################################################# # # Hinweis: # # Bei der Benutzung des Scripts übernimmt der Author keine Haftung, # für evtl. Fehler, bzw. Datenverlustet die durch die Benutzung des # Scriptes hervorgerufen werden. Die Verwendung erfolgt auf eigene Gefahr! # ############################################################################# # # gbkutil.pl - Gästebuch Utility # # Dieses Script erlaubt das Löschen von Gästebucheinträgen # ############################################################################# # # Einstellungen # ############################################################################# # # $cfgpath # Voller Pfad und Verzeichnis zur Gästebuch-Konfigurations-Datei $cfgpath='/home/snoopy/flott/htdocs/cgibin/guestbook/gbkcfg.txt'; ############################################################################# # Ende Einstellungen ############################################################################# require 5; require $cfgpath; #if ($ARGV[0] ne $admin_pass){ # print "Content-type: text/html\n\n"; # print "Gästebuch Utility": # print "Zugriff verweigert."; #}else{ # Lese Gästebuchdaten von Datenbank open (GBK, $guestsrc); @GBKDATA=; close (GBK); # Zählen der gesammten Seiten $count=0; foreach $rec (@GBKDATA){ if ($rec =~ //){ $count++; } } $maxpage=int($count/$entryno); if ($count/$entryno != int($count/$entryno)){ $maxpage++; } if ($maxpage < 1){ $maxpage=1; } # Ausgabe der HTML-Header-Datei print "Content-type: text/html\n\n"; # Lesen der Header-Datei open (HEAD, $headersrc); @DATA1=; close (HEAD); # Ausgabe der Daten foreach $item (@DATA1){ print "$item\n"; } $temp=0; $stop=0; $more=0; $flag=0; $con=0; # Erkennung der Auswahl if ($ARGV[0] eq ""){ # Ausgabe der ersten Seite $min=0; $max=$entryno; } if ($ARGV[0] ne ""){ # Ausgabe spezifizierter Seite $min=(($ARGV[0]-1)*$entryno)+1; $max=$ARGV[0]*$entryno; } # Start Ausgabe Gästebuchdaten print "
"; print "Administrations-Passwort: "; print "


"; print ""; foreach $item (@GBKDATA){ chomp($item); if ($stop == 1){ $more=1; break; } if ($temp >=$min -1 && $temp <=$max -1){ print $item; $flag=1; } if ($item eq ""){ if ($temp>=$min -1 && $temp <=$max-1){ print "

"; print "Eintrag löschen "; print "


"; } $temp++; if ($temp >= $max){ $stop=1; } } } print "

"; if ($flag == 0){ print "Momentan kein Eintrag vorhanden.


"; if ($ontop1==0){ print "Zurück zu Home

"; } if ($ontop1==1){ print "Zurück zu Home

"; } print "

[Letzte | Seite 0 von 0 | Nächste]
"; print ""; $con=1; } if ($con==0){ if ($ontop1==0){ print "Zurück zu Home

"; } if ($ontop1==1){ print "Zurück zu Home

"; } if ($ARGV[0] eq ""){ &bar(1,$maxpage); }else{ &bar($ARGV[0],$maxpage); } } print ""; sub bar{ local ($i)=0; $curr_page=$_[0]; $max_page=$_[1]; $first=int($curr_page/10)*10+1; $last=$first+9; if ($curr_page < $first){ $first=$first-10; $last=$last-10; } if ($last > $max_page){ $last=$max_page; } print "

["; if ($first > 1){ $prev_page=$first-1; $pi=$prev_page-9; print <$pi - $prev_page | EOF } for($i=$first;$i<=$last;$i++){ if ($i != $curr_page){ print<$i EOF }else{ print " $i "; } if ($i<$last){ print "|"; } } if ($last < $max_page){ $next_page=$last+1; $pi = $next_page+9; print <$next_page - $pi EOF } print "]
"; }