#!/usr/bin/perl ########################################################################################### # gbook.cgi # GEOs G”stebuch V. 2.9 - 17. April 2000 # # GEOsWEB # http://www.geosweb.de # admin@geosweb.de #__________________________________________________________________________________________ # # Copyright (C) 1999 GEOsWEB - Georg Bartsch, J–rg von Livonius # ALLE RECHTE VORBEHALTEN # # GEOs G”stebuch ist f¸r private Nutzer kostenlos. Gewerbliche Nutzer bitten wir um R¸cksprache (admin@geosweb.de). # Das Kopieren und Weitergeben des Dokuments ist NICHT erlaubt. # Das Ÿndern des Skriptes ist NICHT erlaubt, mit Ausnahme des Suffix (anstelle .cgi z.B. .pl). # Die Konfigurationsdatei darf mit Ausnahme dieser Passage ge”ndert werden. # Das w–rtliche Ðbernehmen von einzelnen Passagen aus diesem Dokument in eigene Projekte ist NICHT erlaubt. # Die Copyright-Angaben und Hinweise zu GEOsWEB d¸rfen aus keiner Datei entfernt werden und m¸þen stets lesbar sein. # # Bei Ver–ffentlichung dieses Dokuments ist es eine feine Geste, uns eine Nachricht zukommen zu lassen. ########################################################################################### BEGIN { $usemod = 0; if (eval("require LWP::Simple")) { import LWP::Simple; $usemod = 1; } } $VER = "V. 2.9 - 17. April 2000"; $time = time; print "Content-type: text/html\n\n"; get_input(); require "gbook.cfg"; if ($time_zone !~ /\d/) { $time_zone = 0; } if ($show_time !~ /0|1/) { $show_time = 1; } if ($maxentries !~ /\d+?/) { $maxentries = 25; } if ($show_search !~ /\d+?/) { $show_search = 25; } if ($autodel !~ /\d+?/) { $autodel = 0; } if ($html !~ /0|1/) { $html = 0; } if ($check_bw !~ /0|1/) { $check_bw = 1; } if ($check_ip !~ /0|1/) { $check_ip = 0; } if ($print_log !~ /0|1/) { $print_log = 1; } if ($max_word !~ /\d+?/) { $max_word = 50; } if ($post_break !~ /\d+?/) { $post_break = 3; } if ($check_host !~ /0|1/) { $check_host = 1; } action(); ########################################################################################### sub action { if ($query{'action'} eq "preview") { preview(); } elsif ($query{'action'} eq "newpost") { newpost(); } elsif ($query{'action'} eq "submit") { submit(); } elsif ($query{'action'} eq "search") { search(); } elsif ($query{'action'} eq "admin") { admin(); } elsif ($query{'action'} eq "alogin") { alogin(); } elsif ($query{'action'} eq "edit_entry") { edit_entry(); } elsif ($query{'action'} eq "change_entry") { change_entry(); } elsif ($query{'action'} eq "adelete") { adelete(); } elsif ($query{'action'} eq "delbytime") { delbytime(); } elsif ($query{'action'} eq "asearch") { asearch(); } elsif ($query{'action'} eq "badword") { badword(); } elsif ($query{'action'} eq "delbw") { delbw(); } elsif ($query{'action'} eq "addbw") { addbw(); } elsif ($query{'action'} eq "ipblock") { ipblock(); } elsif ($query{'action'} eq "delip") { delip(); } elsif ($query{'action'} eq "addip") { addip(); } elsif ($query{'action'} eq "setup") { setup(); } elsif ($query{'action'} eq "save_setup") { save_setup(); } elsif ($query{'action'} eq "bugrep") { bugrep(); } elsif ($query{'action'} eq "sendbug") { sendbug(); } elsif ($query{'action'} eq "chpasswd") { chpasswd(); } elsif ($query{'action'} eq "change_login") { change_login(); } elsif ($query{'action'} eq "logfile") { logfile(); } elsif ($query{'action'} eq "del_log") { del_log(); } elsif ($query{'action'} eq "about") { about(); } elsif ($query{'action'} eq "set_passwd") { set_passwd(); } else { view(); } } ########################################################################################### sub view { open(BOOK,"<$book_path/$book_file") || die error(no_bookfile); my @BOOK = ; close(BOOK); print "$html_header\n$html_body\n"; print "$post_text\n"; unless ($show_search == 0) { if ($show_search == 1 || $#BOOK > $show_search) { print <
$searcht
EOF } } print "

\n"; if ($maxentries > 0) { unless ($linkup) { $linkup = 1; } if (!$query{'next'}) { $nexts = 10; } else { $nexts = $query{'next'}; } $dmax = $#BOOK; $nextp = $nexts + 10; $nextm = $nexts - 10; $linkupm = $nexts - 19; $linkupp = $nexts + 1; $countlink = $#BOOK / $maxentries; $#BOOK = $maxentries * $linkup; $splita = ($maxentries * $linkup) - $maxentries + 1; splice(@BOOK, 0, $splita); for ($i = $nextm; $i < $countlink; $i++) { $linku = $i; $linku++; while ($linku <= $nexts && $dmax > $maxentries) { if ($linku >= $countlink && $linkup == $linku) { print "[ $linku ]"; } elsif ($linku >= $countlink && $linkup != $linku) { print "[ $linku ]"; } elsif ($linku == $nexts && $linkup == $linku) { print "[ $linku ]"; } elsif ($linku == $nexts) { print "[ $linku ]"; } elsif ($linku == $linkup) { print "[ $linku ] - "; } else { print "[ $linku ] - "; } last; } } if ($linku > 10) { print "
\n"; $nexte = $linku; while ($nexte !~ /\d+?0$/) { $nexte++; } if ($nexts > 20) { print "[ << ] - "; } else { print "[ << ] - "; } if ($nexts > 10) { print "[ < ] - "; } else { print "[ < ] - "; } if ($linku > $nexts) { print "[ > ] - "; } else { print "[ > ] - "; } if ($linku > ($nexts + 10)) { print "[ >> ]"; } else { print "[ >> ]"; } } unless ($dmax <= 1) { print "

$dmax $show_count"; if ($dmax > $maxentries) { print " - Seite $linkup von $linku\n

\n"; } } } else { unless ($#BOOK <= 1) { print "$#BOOK $show_count\n

\n" } } foreach $line (@BOOK) { if ($line =~ /^\d+?\|/) { chomp($line); $line =~ s/\s$//g; ($numb, $timeb, $nameb, $emailb, $dateb, $commentb, $urlb, $titleurlb) = split(/\|/,$line); $tcheck = substr($dateb, 0, 10); print "

$book_table\n\n"; if ($tcheck eq "$mday.$mon.$year" && $today ne "0") { print "$today "; } if ($emailb) { print "$nameb"; } else { print "$nameb"; } print " - $dateb"; print "$commentb"; if ($urlb && $titleurlb) { print "

  • $titleurlb
  • "; } if ($urlb && !$titleurlb) { print "
  • $urlb
  • "; } print "\n"; unless ($hrentry eq "0") { print "

    $hrentry\n"; } } } print "$html_footer2"; exit; } ########################################################################################### sub newpost { if ($ENV{'HTTP_USER_AGENT'} !~ /msie/i) { $tcols = 23; $tsize = 20;} else { $tcols = 41; $tsize = 30; } print < $html_body

    new message

    name:
    email:
    message:
    Link-URL:
    title of link:
    $html_footer EOF exit; } ########################################################################################### sub preview { if ($query{'direkt'} && !$query{'npreview'}) { submit(); exit; } check_form(); print < $html_body
    $preview EOF print "

    $book_table\n\n"; if ($email) { print "$name"; } else { print "$name"; } print " - $date"; print "$comment"; if ($url && $titleurl) { print "

  • $titleurl
  • "; } if ($url && !$titleurl) { print "
  • $url
  • "; } print "\n

    $hr"; restform(); print "

    $html_footer"; exit; } ########################################################################################### sub restform { if ($ENV{'HTTP_USER_AGENT'} !~ /msie/i) { $tcols = 23; $tsize = 20;} else { $tcols = 41; $tsize = 30; } print "

    \n\n"; if ($error) { print "\n"; } else { print "\n"; } print "\n"; if (!$error) { print "\n"; } print "\n"; print "\n"; print "\n"; print "\n"; print "
    "; if ($error eq 'no_name' || ($query{'name'} eq "$bwquery" && $bwquery ne "")) { print "Name:"; } else { print "name:"; } print "
    "; if ($error eq 'wrong_email' || ($query{'email'} eq "$bwquery" && $bwquery ne "")) { print "eMail:"; } else { print "email:"; } print "
    "; if ($error eq 'no_comment' || ($query{'comment'} eq "$bwquery" && $bwquery ne "")) { print "comment:"; } else { print "comment:"; } $comment =~ s/
    /\n/g; $comment =~ s/

    /\n\n/g; print "

    "; if ($error eq 'wrong_url' || $error eq 'url_not_found' || ($query{'url'} eq "$bwquery" && $bwquery ne "")) { print "link-URL:"; } else { print "link-URL:"; } print "
    "; if (($query{'titleurl'} eq "$bwquery" && $bwquery ne "")) { print "title of link:"; } else { print "title of link:"; } unless ($url) { $titleurl = ""; } print <
                        
    EOF } ########################################################################################### sub search { unless ($searchv) { return(error(no_searchv)); exit; } open(BOOK,"<$book_path/$book_file") || die error(no_bookfile); my @BOOK = ; close(BOOK); print "$html_header\n$html_body\n"; $countm = 0; foreach $line (@BOOK) { chomp($line); if ($line =~ /$searchv/i && $line =~ /^\d+?\|/) { $countm++; } } if ($countm == 1) { print "

    $countm Eintrag gefunden
    \n"; } else { print "
    $countm $match
    \n"; } foreach $line (@BOOK) { chomp($line); $line =~ s/\s$//g; if ($line =~ /$searchv/i) { $match = 1; ($numb, $timeb, $nameb, $emailb, $dateb, $commentb, $urlb, $titleurlb) = split(/\|/,$line); print "

    $book_table\n\n"; if ($emailb) { print "$nameb"; } else { print "$nameb"; } print " - $dateb"; print "$commentb"; if ($urlb && $titleurlb) { print "

  • $titleurlb
  • "; } if ($urlb && !$titleurlb) { print "
  • $urlb
  • "; } print "\n"; } } if ($match != 1) { print "$matchn\n"; } print <$hr

    $searcht
    $html_footer EOF exit; } ########################################################################################### sub submit { check_form(); open(BOOK,"<$book_path/$book_file") || die error(no_bookfile); my @BOOK = ; close(BOOK); unless ($post_break == 0) { foreach $check (@BOOK) { chomp($check); if ($check =~ /^\d+?\|(\d+?)\|(.*)\|.*\|.*\|.*\|.*\|/) { $gettime = $1; $namec = $2; } if (($gettime + ($post_break * 60) > time) && $namec eq "$name") { error(block_post); exit; } } } open(COUNT,"<$book_path/$count_file") || die error(no_countfile); $num = ; close(COUNT); if ($num == 99999) { $num = 1; } else { $num++; } open(COUNT,">$book_path/$count_file") || die error(no_countfile); if ($windows == 0) { flock (COUNT, 2); } print COUNT "$num"; close(COUNT); open(BOOK,">$book_path/$book_file") || die error(no_bookfile); if ($windows == 0) { flock (BOARD, 2); } foreach $line (@BOOK) { chomp($line); if ($line =~ /^<\!--start-->/) { print BOOK "\n$num\|$time\|$name\|$email\|$date\|$comment\|$url\|$titleurl\n"; } else { print BOOK "$line\n"; } } close(BOOK); if ($print_log == 1) { open(LOG,">>$book_path/$log_file") || die error(no_logfile); if ($windows == 0) { flock (LOG, 2); } print LOG "$num|$name|$date|$ENV{'REMOTE_ADDR'}|$ENV{'HTTP_USER_AGENT'}\n"; close(LOG); } print "$back_board"; unless ($autodel <= 0) { auto_del(); } exit; } ########################################################################################### sub auto_del { $autodel *= 86400; $autodel = time - $autodel; open(BOOK,"<$book_path/$book_file") || die error(no_bookfile); my @BOOK = ; close(BOOK); foreach ($j = 0; $j <= $#BOOK; $j++) { if ($BOOK[$j] =~ /^\d+?\|(\d+?)\|/ && $autodel > 0 && $autodel >= $1) { splice(@BOOK, $j, 1); $j--; } } open(BOOK,">$book_path/$book_file") || die error(no_bookfile); if ($windows == 0) { flock (BOOK, 2); } print BOOK @BOOK; close(BOOK); } ########################################################################################### sub admin { open(PASSWD, "<$passwd_file") || die error(no_passwd_file); if ($windows == 0) { flock (TEMP, 2); } my $PASSWD = ; close (PASSWD); print < $html_body

    EOF if ($PASSWD !~ /:/) { print <Willkommen im Administrator.
    Wählen Sie nun einen Benutzernamen und ein Passwort für den Admin-Bereich aus.
    Die von Ihnen angegebenen Daten werden anschl. in Ihrer Passwortdatei gespeichert.

    $hr

    Login

    Name:
    Passwort:

      
    EOF } else { print <Administrator

    Name:
    Passwort:

      
    EOF } print < EOF print "

    \n$html_footer"; exit; } ########################################################################################### sub alogin { check_passwd(); open(BOOK,"<$book_path/$book_file") || die error(no_bookfile); my @BOOK = ; close(BOOK); $alogin_is = 1; print < $html_body

    Administrator

    $hr [ Einträge löschen ] • [ Löschen nach Zeit ] • [ Einträge suchen ] • [ Weitere Optionen ] $hr
    Einträge löschen
    EOF if ($maxentries > 0) { unless ($linkup) { $linkup = 1; } if (!$query{'next'}) { $nexts = 10; } else { $nexts = $query{'next'}; } $dmax = $#BOOK; $nextp = $nexts + 10; $nextm = $nexts - 10; $linkupm = $nexts - 19; $linkupp = $nexts + 1; $countlink = $#BOOK / $maxentries; $#BOOK = $maxentries * $linkup; $splita = ($maxentries * $linkup) - $maxentries + 1; splice(@BOOK, 0, $splita); for ($i = $nextm; $i < $countlink; $i++) { $linku = $i; $linku++; while ($linku <= $nexts && $dmax > $maxentries) { if ($linku >= $countlink && $linkup == $linku) { print "[ $linku ]"; } elsif ($linku >= $countlink && $linkup != $linku) { print "[ $linku ]"; } elsif ($linku == $nexts && $linkup == $linku) { print "[ $linku ]"; } elsif ($linku == $nexts) { print "[ $linku ]"; } elsif ($linku == $linkup) { print "[ $linku ] - "; } else { print "[ $linku ] - "; } last; } } if ($linku > 10) { print "
    \n"; $nexte = $linku; while ($nexte !~ /\d+?0$/) { $nexte++; } if ($nexts > 20) { print "[ << ] - "; } else { print "[ << ] - "; } if ($nexts > 10) { print "[ < ] - "; } else { print "[ < ] - "; } if ($linku > $nexts) { print "[ > ] - "; } else { print "[ > ] - "; } if ($linku > ($nexts + 10)) { print "[ >> ]"; } else { print "[ >> ]"; } } unless ($dmax <= 1) { if ($dmax > $maxentries) { print "

    $dmax $show_count - Seite $linkup von $linku\n

    \n"; } else { print "

    $dmax $show_count\n

    \n"; } } } else { unless ($#BOOK <= 1) { print "$#BOOK $show_count\n

    \n"; } } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; foreach $line (@BOOK) { chomp($line); $line =~ s/\s$//g; if ($line =~ /^\d+?/) { ($numd, $timed, $named, $emaild, $dated, $commentd, $urld, $titleurld) = split(/\|/,$line); $deleok = 1; print "\n"; if ($emaild) { print ""; print "\n"; print ""; if ($urld && $titleurld) { print ""; } if ($urld && !$titleurld) { print ""; } print "


    $book_table\n
    $named"; } else { print "$named"; } print " - $dated[Bearbeiten]
     $commentd
     
  • $titleurld
  •  
  • $urld
  • \n"; } } if ($deleok == 1) { print "

    $book_table\n"; print " \n"; } else { print "KEINE EINTRÄGE VORHANDEN\n"; } print "\n

    $hr\n"; print "

    Löschen nach Zeit
    \n"; if ($deleok == 1) { print <
    Tage beziehen sich nicht auf das Datum sondern auf 24h.
    Löschen aller Beiträge die älter sind als Tage
    VORSICHT! "0" löscht alle Einträge!
    EOF } else { print "KEINE EINTRÄGE VORHANDEN\n"; } print "

    $hr\n"; print "

    Einträge suchen
    \n"; if ($deleok == 1) { print <
    $searcht
    EOF } else { print "KEINE EINTRÄGE VORHANDEN\n"; } print "

    $hr\n"; print "

    Weitere Optionen
    \n"; restadmin(); print "$html_footer"; exit; } ########################################################################################### sub edit_entry { check_passwd(); open(BOOK,"<$book_path/$book_file") || die error(no_bookfile); my @BOOK = ; close(BOOK); print <Administrator $hr
    Eintrag Bearbeiten
    EOF foreach $line (@BOOK) { chomp($line); $line =~ s/\s$//g; if ($line =~ /^$query{'nume'}\|/) { ($nume, $timee, $namee, $emaile, $datee, $commente, $urle, $titleurle) = split(/\|/,$line); $commente =~ s/

    /\n\n/g; $commente =~ s/
    /\n/g; print <

    Name: eMail: Kommentar: Link-URL: Titel des Links:  
    EOF last; } } print "

    $hr\n"; restadmin(); print "$html_footer"; exit; } ########################################################################################### sub change_entry { check_passwd(); check_form(); splice(@QUERY, 0, 3); open(BOOK,"<$book_path/$book_file") || die error(no_bookfile); my @BOOK = ; close(BOOK); open(BOOK,">$book_path/$book_file") || die error(no_bookfile); if ($windows == 0) { flock (BOOK, 2); } foreach $change (@BOOK) { if ($change =~ /^$query{'numc'}\|/) { print BOOK "$query{'numc'}\|$query{'timec'}\|$name\|$email\|$query{'datec'}\|$comment\|$url\|$titleurl\n"; } else { print BOOK "$change"; } } close(BOOK); return(alogin); exit; } ########################################################################################### sub adelete { unless ($query{'del'}) { return(error(no_del)); } check_passwd(); splice(@QUERY, 0, 3); open(BOOK,"<$book_path/$book_file") || die error(no_bookfile); my @BOOK = ; close(BOOK); foreach $del (@QUERY) { chomp($del); foreach ($j = 0; $j <= $#BOOK; $j++) { if ($BOOK[$j] =~ /^$del\|/) { splice(@BOOK, $j, 1); $j--; } } } open(BOOK,">$book_path/$book_file") || die error(no_bookfile); if ($windows == 0) { flock (BOOK, 2); } print BOOK @BOOK; close(BOOK); return(alogin); exit; } ########################################################################################### sub delbytime { unless ($query{'deltime'} =~ /\d+?/) { return(error(no_del)); exit; } check_passwd(); $del_days = $query{'deltime'} * 86400; $del_days = time - $del_days; open(BOOK,"<$book_path/$book_file") || die error(no_bookfile); my @BOOK = ; close(BOOK); foreach ($j = 0; $j <= $#BOOK; $j++) { if ($BOOK[$j] =~ /^\d+?\|(\d+?)\|/ && $del_days > 0 && $del_days >= $1) { splice(@BOOK, $j, 1); $j--; } } open(BOOK,">$book_path/$book_file") || die error(no_bookfile); if ($windows == 0) { flock (BOOK, 2); } print BOOK @BOOK; close(BOOK); if ($query{'deltime'} == 0) { open(COUNT,">$book_path/$count_file") || die error(no_countfile); if ($windows == 0) { flock (COUNT, 2); } print COUNT "0"; close(COUNT); } return(alogin); exit; } ########################################################################################### sub asearch { check_passwd(); unless ($searchv) { return(error(no_searchv)); exit; } open(BOOK,"<$book_path/$book_file") || die error(no_bookfile); my @BOOK = ; close(BOOK); print < $html_body

    Administrator

    EOF $countm = 0; foreach $line (@BOOK) { chomp($line); if ($line =~ /$searchv/i && $line =~ /^\d+?\|/) { $countm++; } } if ($countm == 1) { print "
    $countm Eintrag gefunden
    \n"; } else { print "
    $countm $match
    \n"; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; foreach $line (@BOOK) { chomp($line); $line =~ s/\s$//g; if ($line =~ /$searchv/i && $line =~ /^\d+?\|/) { ($numd, $timed, $named, $emaild, $dated, $commentd, $urld, $titleurld) = split(/\|/,$line); $match = 1; print "\n"; if ($emaild) { print ""; print "\n"; print ""; if ($urld && $titleurld) { print ""; } if ($urld && !$titleurld) { print ""; } print "


    $book_table\n
    $named"; } else { print "$named"; } print " - $dated[Bearbeiten]
     $commentd
     
  • $titleurld
  •  
  • $urld
  • \n"; } } if ($match != 1) { print "$matchn\n"; } else { print "

    $book_table"; print "\n"; } print <

    $hr

    $searcht

    $hr EOF restadmin(); print "$html_footer"; exit; } ########################################################################################### sub badword { check_passwd(); $badword_is = 1; open(BW,"<$book_path/$badword_file") || die error(no_badwordfile); my @BW = ; close(BW); $countbw = 0; for (@BW) { $countbw++; } $tds = $countbw / 3; print < $html_body EOF if ($check_bw == 0) { print "Der BadWords-Check ist deaktiviert.\n"; } else { print "Der BadWords-Check ist aktiviert.\n"; } print <$hr

    Es sind $countbw Wörter registriert.

    EOF if ($tds =~ /\./) { $tds++; } my @SORTBW = sort(@BW); $count2 = 0; print "\n"; if ($countbw >= 1) { print < EOF } print <
    Bad Words löschen
    "; foreach $td1 (@SORTBW) { $td1 =~ s/\s//g; $count2++; if ($count2 <= $tds) { print " $td1
    \n"; } else { push (@TD2, $td1); } } print "
    \n"; $count2 = 0; foreach $td2 (@TD2) { $count2++; if ($count2 <= $tds) { print " $td2
    \n"; } else { push (@TD3, $td2); } } print "
    \n"; foreach $td3 (@TD3) { print " $td3
    \n"; } print "

    Bad Word hinzufügen
    Achtung:
    Mit \\b markieren Sie einen Wortanfang bzw. das Wortende.
    \\bSau\\b, findet nur Sau.
    Sau, findet Sau, Sauhund und auch sauber !!!
    Groß/Kleinschreibung spielt keine Rolle.

    $hr EOF restadmin(); print "$html_footer"; exit; } ########################################################################################### sub delbw { unless ($query{'delbw'}) { return(error(no_del)); exit; } check_passwd(); open(DELBW,"<$book_path/$badword_file") || die error(no_badwordfile); my @DELBW = ; close(DELBW); splice(@QUERY, 0, 3); foreach $delq (@QUERY) { foreach ($i = 0;$i <= $#DELBW; $i++) { chomp($DELBW[$i]); if ($delq eq "$DELBW[$i]") { splice(@DELBW, $i, 1); $i--; } } } open(DELBW,">$book_path/$badword_file") || die error(no_badwordfile); if ($windows == 0) { flock (DELBW, 2); } for (@DELBW) { print DELBW "$_\n"; } close(DELBW); return(badword); exit; } ########################################################################################### sub addbw { unless ($query{'newbw'}) { return(error(no_del)); exit; } check_passwd(); open(ADDBW,"<$book_path/$badword_file") || die error(no_badwordfile); my @ADDBW = ; close(ADDBW); foreach $badword (@ADDBW) { chomp($badword); $badword =~ tr/A-Z/a-z/; $query{'newbw'} =~ tr/A-Z/a-z/; if ($badword eq "$query{'newbw'}" || $badword eq "\\b$query{'newbw'}\\b" || $query{'newbw'} eq "\\b$badword\\b") { $bw_exist = 1; } } if ($bw_exist == 1) { print "$html_header\n$html_body\n

    \n"; print "

    FEHLER:

    \n
    Das von Ihnen gewählte Wort existiert schon
    \n$html_footer"; } else { push(@ADDBW, "$query{'newbw'}"); open(ADDBW,">$book_path/$badword_file") || die error(no_badwordfile); if ($windows == 0) { flock (ADDBW, 2); } for (@ADDBW) { print ADDBW "$_\n"; } close(ADDBW); return(badword); } exit; } ########################################################################################### sub ipblock { check_passwd(); $ipblock_is = 1; open(IP,"<$book_path/$ip_file") || die error(no_ipfile); my @IP = ; close(IP); $countip = 0; for (@IP) { $countip++; } print < $html_body EOF if ($check_ip == 0) { print "Die IP-Sperre ist deaktiviert.\n"; } else { print "Die IP-Sperre ist aktiviert.\n"; } print <$hr

    Es sind $countip IP's gesperrt.

    EOF my @SORTIP = sort(@IP); for (@SORTIP) { $_ =~ s/\s//g; print "\n"; } if ($countip >= 1) { print < EOF } print <
    LöschenIP
    $_

    IP hinzufügen

    $hr EOF restadmin(); print "$html_footer"; exit; } ########################################################################################### sub delip { unless ($query{'delip'}) { return(error(no_del)); exit; } check_passwd(); open(DELIP,"<$book_path/$ip_file") || die error(no_ipfile); my @DELIP = ; close(DELIP); splice(@QUERY, 0, 3); foreach $delip(@QUERY) { $delip =~ s/\s+?//g; foreach ($i = 0;$i <= $#DELIP; $i++) { $DELIP[$i] =~ s/\\b+?//g; if ($DELIP[$i] =~ /^$delip$/) { splice(@DELIP, $i, 1); $i--; } } } open(DELIP,">$book_path/$ip_file") || die error(no_ipfile); if ($windows == 0) { flock (DELIP, 2); } print DELIP @DELIP; close(DELIP); return(ipblock); exit; } ########################################################################################### sub addip { unless ($query{'newip'}) { return(error(no_del)); exit; } check_passwd(); unless ($query{'newip'} =~ /\d+?\.\d+?\.\d+?\.\d+?/) { print "$html_header\n$html_body\n

    \n"; print "

    FEHLER:

    \n
    Sie haben eine ungültige IP angegeben
    \n$html_footer"; exit; } open(ADDIP,"<$book_path/$ip_file") || die error(no_ipfile); my @ADDIP = ; close(ADDIP); foreach $ip(@ADDIP) { if ($ip =~ /^$query{'newip'}\s/i) { $ip_exist = 1; } } if ($ip_exist == 1) { print "$html_header\n$html_body\n
    \n"; print "

    FEHLER:

    \n
    Die von Ihnen angegebene IP existiert schon
    \n$html_footer"; } else { push(@ADDIP, "$query{'newip'}\n"); open(ADDIP,">$book_path/$ip_file") || die error(no_ipfile); if ($windows == 0) { flock (ADDIP, 2); } print ADDIP @ADDIP; close(ADDIP); return(ipblock); } exit; } ########################################################################################### sub logfile { check_passwd(); $logfile_is = 1; open(LOG,"$book_path/$log_file") || die error(no_logfile); my @LOG = ; close(LOG); $countl = 0; for (@LOG) { $countl++; } print < $html_body EOF if ($print_log == 0) { print "Das Logfile ist deaktiviert.\n"; } else { print "Das Logfile ist aktiviert.\n"; } print "

    $hr\n"; if ($countl > 1) { print "

    $countl Einträge
    \n"; } print < EOF my @SORTLOG = sort by_number @LOG; if ($countl >= 1) { foreach $logf (@SORTLOG) { ($numl, $namel, $datel, $ipl, $browserl) = split(/\|/,$logf); print "\n"; } print "\n"; } else { print "\n"; } print "
    #NameDatumIPBrowser
    $numl$namel$datel$ipl$browserl
    KEINE EINTRÄGE VORHANDEN

    $hr\n"; restadmin(); print "$html_footer"; exit; } ########################################################################################### sub del_log { check_passwd(); open(LOG,">$book_path/$log_file") || die error(no_logfile); if ($windows == 0) { flock (LOG, 2); } print LOG ""; close(LOG); return(logfile); exit; } ########################################################################################### sub setup { check_passwd(); $setup_is = 1; print < $html_body EOF print "

    Setup

    $hr

    \n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print ""; if ($show_time == 1) { print "\n"; } else { print "\n"; } if ($show_time == 0) { print "\n"; } else { print "\n"; } print "\n"; print ""; if ($html == 1) { print "\n"; } else { print "\n"; } if ($html == 0) { print "\n"; } else { print "\n"; } print "\n"; print ""; if ($check_bw == 1) { print "\n"; } else { print "\n"; } if ($check_bw == 0) { print "\n"; } else { print "\n"; } print "\n"; print ""; if ($check_ip == 1) { print "\n"; } else { print "\n"; } if ($check_ip == 0) { print "\n"; } else { print "\n"; } print "\n"; print ""; if ($print_log == 1) { print "\n"; } else { print "\n"; } if ($print_log == 0) { print "\n"; } else { print "\n"; } print "\n"; print ""; if ($check_host == 1) { print "\n"; } else { print "\n"; } if ($check_host == 0) { print "\n"; } else { print "\n"; } print "\n"; print "\n"; print ""; print "\n"; print ""; print "\n"; print ""; print "\n"; print ""; print "\n"; print ""; print "\n"; print ""; print "\n"; print "\n"; print "
    A = aktivieren / D = deaktivieren
    OptionAD
    Zeitanzeige - A Datum und Uhrzeit / D nur Datum
    HTML-Tags
    Bad Word Check
    IP Check
    Logfile
    Host-Check prüft ob der Aufruf des Skriptes vom eigenen Server kommt.
    "; print "Wenn keine Einträge möglich sind, deaktivieren Sie diese Option.
     
    Zeitzone - Wert in Stunden (Bsp. 6 oder -6)
    Beiträge pro Seite - 0 zeigt alle Beiträge auf einer Seite an
    Suchformular - 0 kein Formular / 1 stetig / n ab n Threads
    Autolöschfunktion - 0 deaktiviert / n autom. nach n Tagen
    Max. Wortlänge eines Wortes im Kommentar - 0 deaktiviert
    Post-Sperre in Minuten - 0 deaktiviert
    "; print "
    \n

    $hr

    "; restadmin(); print "$html_footer"; exit; } ########################################################################################### sub save_setup { check_passwd(); print "$html_header\n$html_body\n"; print "

    Setup

    $hr

    \n"; if ($query{'time_zone'} !~ /^\-?\d\d?\Z/ || $query{'time_zone'} =~ /^0\d/ || $query{'time_zone'} > 12 || $query{'time_zone'} < -12) { print "

    FEHLER:

    \nSie haben eine ungültige Zeitzone angegeben!\n"; print "$html_footer"; exit; } if ($query{'maxentries'} !~ /^\d+?\Z/ || $query{'maxentries'} =~ /^0\d/) { print "

    FEHLER:

    \nSie haben einen ungültigen Wert bei "Threads pro Seite" angegeben!\n"; print "$html_footer"; exit; } if ($query{'show_search'} !~ /^\d+?\Z/ || $query{'show_search'} =~ /^0\d/) { print "

    FEHLER:

    \nSie haben einen ungültigen Wert für das Suchformular angegeben!\n"; print "$html_footer"; exit; } if ($query{'autodel'} !~ /^\d+?\Z/ || $query{'autodel'} =~ /^0\d/) { print "

    FEHLER:

    \nSie haben einen ungültigen Wert bei der Autolöschfunktion angegeben!\n"; print "$html_footer"; exit; } if ($query{'max_word'} !~ /^\d+?\Z/ || $query{'max_word'} =~ /^0\d/) { print "

    FEHLER:

    \nSie haben einen ungültigen Wert für die max. Wortlänge angegeben!\n"; print "$html_footer"; exit; } if ($query{'post_break'} !~ /^\d+?\Z/ || $query{'post_break'} =~ /^0\d/) { print "

    FEHLER:

    \nSie haben einen ungültigen Wert zur Post-Sperre angegeben!\n"; print "$html_footer"; exit; } open(STP,">$book_path/$setup_file") || die error(no_setupfile); if ($windows == 0) { flock (STP, 2); } print STP "\# Diese Datei darf NICHT ge”ndert werden. F¸hren Sie Setup in der Administration aus!\n"; print STP "\$show_time = $query{'show_time'}\;\n"; print STP "\$html = $query{'html'}\;\n"; print STP "\$check_bw = $query{'check_bw'}\;\n"; print STP "\$check_ip = $query{'check_ip'}\;\n"; print STP "\$print_log = $query{'print_log'}\;\n"; print STP "\$time_zone = $query{'time_zone'}\;\n"; print STP "\$maxentries = $query{'maxentries'}\;\n"; print STP "\$show_search = $query{'show_search'}\;\n"; print STP "\$autodel = $query{'autodel'}\;\n"; print STP "\$max_word = $query{'max_word'}\;\n"; print STP "\$post_break = $query{'post_break'}\;\n"; print STP "\$check_host = $query{'check_host'}\;\n"; print STP "1\;"; close(STP); print "Die Änderungen wurden erfolgreich gespeichert.\n"; restadmin(); print "$html_footer"; exit; } ########################################################################################### sub bugrep { check_passwd(); $bugrep_is = 1; print <Bug Report

    $hr

    Informieren Sie uns über Bugs oder senden Sie uns Ihre Verbesserungsvorschläge.

    An:Webmaster GEOsWEB <admin\@geosweb.de>
    Von:Webmaster $title <$mail_addr>
    Betreff:
    Nachricht:

    $hr EOF restadmin(); print "$html_footer"; exit; } ########################################################################################### sub sendbug { check_passwd(); unless ($query{'bugsubject'} && $query{'bugcomment'}) { print "$html_header\n$html_body\n

    FEHLER:

    \n"; print "
    Sie haben das Formular nicht vollständig ausgefüllt.
    \n"; print "$html_footer"; exit; } $title =~ s/ä/”/g; $title =~ s/Ä/Ÿ/g; $query{'bugcomment'} =~ s/\r\n/\n/g; open (SENDMAIL, "| $mail_path -t"); print SENDMAIL "To: Webmaster GEOsWEB \n"; print SENDMAIL "From: Webmaster $title <$mail_addr>\n"; print SENDMAIL "Subject: $query{'bugsubject'}\n\n"; print SENDMAIL "$query{'bugcomment'}\n"; close (SENDMAIL); print <Administrator
    Bug Report

    $hr

    Danke für Ihre Nachricht.
    Jeder Bug Report oder Verbesserungsvorschlag hilft uns weiter und Ihnen zu einem noch besseren Skript.

    $hr EOF restadmin(); print "$html_footer"; exit; } ########################################################################################### sub set_passwd { open(PASSWD, "$passwd_file") || die error(no_passwd_file); if ($windows == 0) { flock (PASSWD, 2); } my $passwd_line = ; close(PASSWD); if ($passwd_line =~ /:/) { error(passwd_exist); exit; } my $salt = substr($aname,0,2); my $en_apass = crypt($apassword,$salt); my $test_apass = crypt($apassword,$salt); if ($en_apass eq "$test_apass") { open(PASSWD, ">$passwd_file") || die error(no_passwd_file); if ($windows == 0) { flock (PASSWD, 2); } print PASSWD "$aname:$en_apass:1"; close (PASSWD); } else { open(PASSWD, ">$passwd_file") || die error(no_passwd_file); if ($windows == 0) { flock (PASSWD, 2); } print PASSWD "$aname:$apassword:0"; close (PASSWD); } return(alogin); exit; } ########################################################################################### sub chpasswd { check_passwd(); $chpasswd_is = 1; print < $html_body

    Login ändern

    $hr

    Name:
    Passwort:
    Neuer Name:
    Neues Passwort:
    Passwort wiederholen:

    $hr EOF restadmin(); print "$html_footer"; exit; } ########################################################################################### sub change_login { unless ($query{'newname'} && $query{'newpasswd'} && $query{'newpasswd'} eq "$query{'reppasswd'}") { print "$html_header\n$html_body\n"; print "

    FEHLER:

    \nÜberprüfen Sie Ihre Angaben und füllen Sie das Formular vollständig aus.\n"; print "$html_footer\n"; exit; } check_passwd(); open(PASSWD,"$passwd_file") || die error(no_passwd_file); $passwd_line = ; chomp($passwd_line); close(PASSWD); ($username, $passwd, $crypt_pass) = split(/:/,$passwd_line); if ($crypt_pass == 1) { $salt = substr($query{'newname'}, 0, 2); $new_password = crypt($query{'newpasswd'}, $salt); } else { $new_password = $query{'newpasswd'}; } open(PASSWD,">$passwd_file") || die error(no_passwd_file); if ($windows == 0) { flock (PASSWD, 2); } print PASSWD "$query{'newname'}:$new_password:$crypt_pass"; close(PASSWD); $aname = $query{'newname'}; $apassword = $query{'newpasswd'}; print <Login erfolgreich geändert $hr

    Bitte notieren Sie sich das neue Admin-Login:
    Name:$query{'newname'}
    Passwort:$query{'newpasswd'}

    $hr EOF restadmin(); print "$html_footer"; exit; } ########################################################################################### sub about { $about_is = 1; print <$VER


    Copyright:
    Copyright (C) 1999 GEOsWEB - Georg Bartsch, Jörg von Livonius
    ALLE RECHTE VORBEHALTEN

    GEOs Gästebuch ist für private Nutzer kostenlos. Gewerbliche Nutzer bitten wir um Rücksprache (admin\@geosweb.de).
    Das Kopieren und Weitergeben des Dokuments ist NICHT erlaubt.
    Das Ändern des Skriptes ist NICHT erlaubt, mit Ausnahme des Suffix (anstelle .cgi z.B. .pl).
    Die Konfigurationsdatei darf mit Ausnahme dieser Passage geändert werden.
    Das wörtliche Übernehmen von einzelnen Passagen aus diesem Dokument in eigene Projekte ist NICHT erlaubt.
    Die Copyright-Angaben und Hinweise zu GEOsWEB dürfen aus keiner Datei entfernt werden und müßen stets lesbar sein.

    Bei Veröffentlichung dieses Dokuments ist es eine feine Geste, uns eine Nachricht zukommen zu lassen.


    Readme:

    LESEN SIE DIESEN ABSCHNITT GRÜNDLICH UND VOLLSTÄNDIG WENN SIE FEHLER VERMEIDEN MÖCHTEN !!!

    Ändern Sie zuerst NUR die notwendigen Angaben (Pfad, URL...). Wenn das Skript anschl. auf Ihrem Server läuft, können Sie sich die anderen Einstellungen durch den Kopf gehen lassen. Sollten Sie Probleme mit den Pfadangaben haben, installieren Sie einfach GEOs Server Info.
    WICHTIG !!!
    Alle Optionen die mit "EOF" beginnen und enden können Sie (fast) als normalen HTML-Code behandeln. Vor Sonderzeichen, wie z.B. \@, müssen Sie ein \ notieren. Bei den anderen Zeilen MÜSSEN Sie vor alle Sonderzeichen ein (\) Backslash setzen. ÄNDERN SIE IMMER NUR EINE OPTION UND TESTEN SIE DAS SKRIPT ANSCHLIESSEND !!! Wenn Ihr Browser nur ein weisses Bild anzeigt oder ewig versucht die Seite zu laden, dann handelt es sich wahrscheinlich um einen CGI-Fehler. Dies passiert z.B. bei einem vergessenen Semikolon (;) oder (") oder, oder... Bei dem "beliebten" ERROR 500 sind die Pfadangaben oder Zugriffsrechte schuld. Checken Sie diese zuerst.

    Erforderliche Dateien:
    /cgi-bin/gbook.cgiSkript
    /cgi-bin/gbook.cfgKonfigurationsdatei
    /gbook/gbadword.txtBadWord-Datei
    /gbook/gbook.cntZähldatei
    /gbook/gbook.datGästebuchdatei
    /gbook/gbook.stpSetupdatei
    /gbook/gbooklog.txtLogdatei
    /gbook/gip.txtIP-Sperre
    /gbook/passwd.txtPasswortdatei Administrator
    /gbook/today.gifImage

    SETUP:
    Editieren Sie die Konfigurationsdatei "gbook.cfg". Kopieren Sie alle Dateien auf Ihren Webserver. Wichtig ist, dass das Skript und die Konfigurationsdatei im ASCII-Modus übertragen werden. Chmoden (Zugriffsrechte) Sie das Skript mit 755, alle anderen Dateien sollten Sie auf Chmod 600 setzen, somit verhindern Sie das z.B. Dritte in Ihre Passwortdatei einsehen können. Editieren Sie nicht die Setupdatei! Das Setup wird in der Administration vorgenommen. Sollten unerwartete Fehler auftreten, ändern Sie zuerst die Zugriffsrechte.

    Aufruf Gästebuch:
    http://www.IhreDomain.de/cgi-bin/gbook.cgi
    Aufruf Admin:
    http://www.IhreDomain.de/cgi-bin/gbook.cgi?action=admin

    Für Verbesserungsvorschläge, Fragen, etc., steht Ihnen der "Bug Report" in der Administration zur Verfügung.


    Autor:
    Georg Bartsch und Jörg von Livonius - admin\@geosweb.de


    EOF restadmin(); print "$html_footer"; exit; } ########################################################################################### sub get_input { if ($ENV{'REQUEST_METHOD'} eq "GET") { $qstring= $ENV{'QUERY_STRING'}; } elsif ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $qstring, $ENV{'CONTENT_LENGTH'}); } @split = split (/&/, $qstring); foreach $split (@split) { ($query_key, $query_value) = split (/=/, $split); $query_value =~ tr/+/ /; $query_value =~ s/%([\dA-Fa-f][\dA-Fa-f])/ pack ("C", hex ($1))/eg; if ($query_key eq "bugsubject" || $query_key eq "bugcomment") { $query_value =~ s/ä/”/g; $query_value =~ s/ö/–/g; $query_value =~ s/ü/¸/g; $query_value =~ s/Ä/Ÿ/g; $query_value =~ s/Ö/÷/g; $query_value =~ s/Ü/Ð/g; $query_value =~ s/ß/þ/g; } else { $query_value =~ s/”/ä/g; $query_value =~ s/–/ö/g; $query_value =~ s/¸/ü/g; $query_value =~ s/Ÿ/Ä/g; $query_value =~ s/÷/Ö/g; $query_value =~ s/Ð/Ü/g; $query_value =~ s/þ/ß/g; $query_value =~ s/\|+?//g; unless ($query_key eq "comment") { $query_value =~ s/\"/"/g; $query_value =~ s/\s+$//g; $query_value =~ s/^\s+//g; $query_value =~ s//\>\;/g; } } push(@QUERY, $query_value); $query{$query_key} = $query_value; } $name = $query{'name'}; $email = $query{'email'}; $comment = $query{'comment'}; $url = $query{'url'}; $titleurl = $query{'titleurl'}; $linkup = $query{'linkup'}; $searchv = $query{'searchv'}; $aname = $query{'aname'}; $apassword = $query{'apassword'}; } ########################################################################################### sub check_form { unless ($check_host == 0) { if ($ENV{'HTTP_HOST'} && $ENV{'HTTP_REFERER'}) { if ($ENV{'HTTP_REFERER'} !~ /$ENV{'HTTP_HOST'}/) { return(error(wrong_host)); exit; } } } if ($html != 1) { $comment =~ s/

    /\n\n/g; $comment =~ s/
    /\n/g; $comment =~ s/<([^>]|\n)*>//g; } else { $comment =~ s///g; } $comment =~ s/\cM//g; $comment =~ s/\n\n+/

    /g; $comment =~ s/\r\n/
    /g; $comment =~ s/\n/
    /g; $comment =~ s/\n+$//g; $comment =~ s/\s+$//g; $comment =~ s/
    $//g; $comment =~ s/

    $//g; if ($name !~ /\w/) { return(error(no_name)); exit; } if ($email && ($email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/ || $email !~ /^.+\@\[?(\w|[-.])+\.[a-zA-Z]{2,3}|[0-9]{1,3}\]?$/)) { return(error(wrong_email)); exit; } if ($comment !~ /\w/) { return(error(no_comment)); exit; } if ($comment =~ /\<(\s+?)?meta|\<(\s+?)?script/i) { return(error(no_script)); exit; } unless ($max_word == 0) { my $word = $comment; $word =~ s/<\s//g; $word =~ s/<<+?\s//g; $word =~ s/\r\n/\n/g; $word =~ s/\s/\n/g; $word =~ s/\b/\n/g; $word =~ s/
    /\n/g; $word =~ s/

    /\n/g; $word =~ s/<([^>]|\n)*>//g; my @words = split(/\n/,$word); for (@words) { if (length($_) > $max_word) { error(too_long); exit; } } if (length($name) > 30 || length($subject) > 60 || length($titleurl) > 60) { error(too_long); exit; } } if ($url && ($url =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/ || $url !~ /(f|ht)tp:\/\// || $url !~ /\./)) { return(error(wrong_url)); exit; } if ($usemod == 1 && $url) { unless (get("$url")) { return(error(url_not_found)); exit; } } unless ($url) { $titleurl = ""; } if ($check_bw == 1) { shift(@QUERY); open(BW,"<$book_path/$badword_file") || die error(no_badwordfile); my @BW = ; close(BW); foreach $bwquery (@QUERY) { foreach $bw (@BW) { $bw =~ s/\s+?//g; if ($bwquery =~ /$bw/i) { return(error(bad_word)); exit; } } } } if ($check_ip == 1) { shift(@QUERY); open(IP,"<$book_path/$ip_file") || die error(no_ipfile); my @IP = ; close(IP); foreach $ip (@IP) { $ip =~ s/\s+?//g; if ($ip eq "$ENV{'REMOTE_ADDR'}") { return(error(bad_ip)); exit; } } } } ########################################################################################### sub restadmin { print "

    \n"; print ""; print ""; if ($alogin_is != 1) { print ""; } else { print ""; } print ""; print ""; if ($badword_is != 1) { print ""; } else { print ""; } print ""; print ""; if ($ipblock_is != 1) { print ""; } else { print ""; } print ""; print ""; if ($logfile_is != 1) { print ""; } else { print ""; } print ""; print ""; if ($setup_is != 1) { print ""; } else { print ""; } print ""; print ""; if ($bugrep_is != 1) { print ""; } else { print ""; } print ""; print ""; if ($chpasswd_is != 1) { print ""; } else { print ""; } print ""; print ""; if ($about_is != 1) { print ""; } else { print ""; } print "
    \n"; } ########################################################################################### sub error { print "$html_header\n$html_body\n

    \n"; $error = $_[0]; if ($error eq 'no_bookfile') { print "

    FEHLER:

    \n

    Die Gästebuchdatei wurde nicht gefunden.

    \n"; } elsif ($error eq 'no_countfile') { print "

    FEHLER:

    \n

    Die Zähldatei wurde nicht gefunden.

    \n"; } elsif ($error eq 'no_badwordfile') { print "

    FEHLER:

    \n

    Die BadWord-Datei konnte nicht gefunden werden.

    \n"; } elsif ($error eq 'no_ipfile') { print "

    FEHLER:

    \n

    Die IP-Datei konnte nicht gefunden werden.

    \n"; } elsif ($error eq 'no_logfile') { print "

    FEHLER:

    \n

    Die Log-Datei konnte nicht gefunden werden.

    \n"; } elsif ($error eq 'no_passwd_file') { print "

    FEHLER:

    \n

    Die Passwortdatei konnte nicht gefunden werden.

    \n"; } elsif ($error eq 'no_setupfile') { print "

    FEHLER:

    \n

    Die Setupdatei konnte nicht gefunden werden.

    \n"; } elsif ($error eq 'no_del') { print "

    FEHLER:

    \n

    Sie haben keine Auswahl getroffen.

    \n"; } elsif ($error eq 'no_login') { print "

    FEHLER:

    \n

    Bitte geben Sie Ihren Benutzernamen und Ihr Passwort ein.

    \n"; } elsif ($error eq 'passwd_exist') { print "

    FEHLER:

    \n

    Es wurde schon ein Login registriert.
    Löschen Sie den Inhalt der Passwortdatei.

    \n"; } elsif ($error eq 'no_name') { print "$error_no_name\n

    $hr"; restform(); } elsif ($error eq 'no_comment') { print "$error_no_comment\n

    $hr"; restform(); } elsif ($error eq 'wrong_email') { print "$error_wrong_email\n

    $hr"; restform(); } elsif ($error eq 'wrong_url') { print "$error_wrong_url\n

    $hr"; restform(); } elsif ($error eq 'url_not_found') { print "$url_not_found\n

    $hr"; restform(); } elsif ($error eq 'no_script') { print "$error_no_script\n

    $hr"; restform(); } elsif ($error eq 'block_post') { print "$error_block_post"; } elsif ($error eq 'no_searchv') { print "$error_no_searchv"; } elsif ($error eq 'bad_word') { print "$error_bad_word\n

    $hr"; restform(); } elsif ($error eq 'bad_ip') { print "$error_bad_ip"; } elsif ($error eq 'too_long') { print "$error_too_long\n

    $hr"; restform(); } elsif ($error eq 'bad_combo') { $title =~ s/ä/”/g; $title =~ s/Ä/Ÿ/g; open (SENDMAIL, "| $mail_path -t"); print SENDMAIL "To: Webmaster $title <$mail_addr>\n"; print SENDMAIL "From: $title <$mail_addr>\n"; print SENDMAIL "Subject: Falsche Passworteingabe\n\n"; print SENDMAIL <FEHLER

    Es ist ein unbekannter Fehler aufgetreten.
    Bitte informieren Sie den Webmaster. EOF } print "

    $html_footer\n"; exit; } ########################################################################################### sub by_number { if ($b < $a) { return -1; } elsif ($b == $a) { return 0; } elsif ($b > $a) { return 1; } } ########################################################################################### sub check_passwd { unless ($aname && $apassword) { error(no_login); exit; } open(PASSWD, "$passwd_file") || die error(no_passwd_file); if ($windows == 0) { flock (PASSWD, 2); } my $passwd_line = ; chomp($passwd_line); close(PASSWD); ($username, $passwd, $crypt_pass) = split(/:/, $passwd_line); if ($crypt_pass == 1) { my $salt = substr($aname, 0, 2); my $test_passwd = crypt($apassword, $salt); if (!($test_passwd eq $passwd && $aname eq $username)) { return(error(bad_combo)); } } else { if (!($apassword eq $passwd && $aname eq $username)) { return(error(bad_combo)); } } }