30) $shorturl = substr($url, 0, 30)."..."; return $shorturl; } function ReloadLock($reloadTicks) { $reloadLock = 0; $ip = $_SERVER['REMOTE_ADDR']; $time = time(); $file = file("gb_files/data/reload"); for($i = 0; $i < sizeof($file); $i++) { $item = explode("|", $file[$i]); if($item[0] > $time - $reloadTicks) { if(trim($item[1]) == $ip) $reloadLock = $reloadTicks - ($time - $item[0]); $newContent .= $file[$i]; } } if($reloadLock == 0) $newContent .= $time."|".$ip."\n"; $handle = fopen("gb_files/data/reload", "w"); fwrite($handle, $newContent); fclose($handle); return $reloadLock; } function Redirect() { $ref = basename($_SERVER["HTTP_REFERER"]); $url = basename($_SERVER["REQUEST_URI"]); if(empty($ref) || $ref == $url) $ref = "guestbook.php"; echo "\n"; echo "\n"; echo "Du wirst in 3 Sekunden weitergeleitet, falls nicht klick hier.\n"; echo "\n"; } function BB_Code($input) { $input = str_replace('\"', '"', $input); $input = str_replace("[b]", "", $input); $input = str_replace("[/b]", "", $input); $input = str_replace("[i]", "", $input); $input = str_replace("[/i]", "", $input); $input = str_replace("[u]", "", $input); $input = str_replace("[/u]", "", $input); $input = str_replace("[url]", "", $input); $input = str_replace("[/url]", "", $input); $input = str_replace("[img]", "", $input); $input = str_replace(":-)", "\":-)\"", $input); $input = str_replace("%-(", "\"%-(\"", $input); $input = str_replace("8-]", "\"8-]\"", $input); $input = str_replace(":-D", "\":-D\"", $input); $input = str_replace(":-z", "\":-z\"", $input); $input = str_replace(":-(", "\":-(\"", $input); $input = str_replace("|-|", "\"|-|\"", $input); $input = str_replace(":-o", "\":-o\"", $input); $input = str_replace(";-)", "\";-)\"", $input); return $input; } function CheckLogin() { if(!$_SESSION['login']) { echo "\n"; echo "Nicht eingeloggt! \n"; echo "Login\n"; echo "\n"; echo "\n\n\n\n\n"; die(); } } function InsertItem($newItem) { $filename = "gb_files/data/content"; $file = array_reverse(file($filename)); $count = sizeof($file); if($count == 0) { $handle = fopen($filename, "a"); fwrite($handle, $newItem); fclose($handle); } else { $key = explode("|@|", $newItem); for($i = 0; $i < $count; $i++) { $item = explode("|@|", $file[$i]); if($key[0] > $item[0]) { $entries = file($filename); $entries[$count - $i - 1] = $file[$i].$newItem; $newFile = fopen($filename, "w"); fputs($newFile, implode("", $entries)); fclose($newFile); break; } } } } function ShortWords($text) { $length = 50; $words = explode(" ", $text); for($i = 0; $i < count($words); $i++) { if(strlen($words[$i]) >= $length) { if(!preg_match("/(\[url\]|\[img\])/", $words[$i])) $words[$i] = chunk_split($words[$i], $length, " "); } $text = implode(" ", $words); } return $text; } session_start(); if(!isset($_SESSION['login'])) $_SESSION['login'] = false; echo "\n"; echo "\n\n"; echo "".$title."\n"; echo "\n"; echo "\n"; echo "\n\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n

".$title."

\n"; echo "\n"; echo "\n"; echo "\n"; if(!isset($_GET['p'])) $_GET['p'] = ""; switch($_GET['p']) { case "inscribe": echo "\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; if($captcha) { echo "\n\n\n\n"; } echo "\n"; echo "\n"; if($_POST['inscribe'] || $_POST['preview']) { $error = array(false, false, false, false, false, false, false); if(!preg_match("/^[a-zA-Z0-9äÄüÜöÖß -]{3,}$/", $_POST['name'])) $error[0] = true; if(!preg_match("/^([a-zA-Z0-9]+([-_\.]?[a-zA-Z0-9])+@[a-zA-Z0-9]+([-_\.]?[a-zA-Z0-9])+\.[a-z]{2,4}){0,}$/", $_POST['email'])) $error[1] = true; if(!preg_match("/^(http:\/\/)(www\.)?[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}[a-zA-Z0-9|_|-|+|.|\/]*$/", $_POST['homepage']) && $_POST['homepage'] != "http://www.") $error[2] = true; $entry = strip_tags($_POST['entry']); $entry = ereg_replace("\r\n\r\n\r\n*", "", $entry); $entry = str_replace("\r\n", "[ ]", $entry); $entry = str_replace("|@|", "", $entry); $entry = ShortWords($entry); $entry = str_replace("[ ]", "\\r\\n", $entry); if(strlen($entry) < 10) $error[3] = true; if($_POST['inscribe'] && $captcha && trim(strtoupper($_POST['securecode'])) != $_SESSION['securecode']) $error[4] = true; if($badWords != "") { $badWordsFound = ""; $badWordsArray = explode(",", $badWords); foreach($badWordsArray as $badword) { $badword = trim($badword); if(eregi($badword, $entry)) $badWordsFound .= $badword.", "; } if($badWordsFound != "") $error[6] = true; } if($_POST['inscribe'] && !$error[0] && !$error[1] && !$error[2] && !$error[3] && !$error[4] && !$error[6]) { $reload = ReloadLock($reloadTicks); if($reload > 0) $error[5] = true; } if($error[0] || $error[1] || $error[2] || $error[3] || $error[4] || $error[5] || $error[6]) { $errorString = ""; echo "\n"; } else { $entry = str_replace("\\r\\n", "
", $entry); if($_POST['inscribe']) { unset($_SESSION['securecode']); if($_POST['homepage'] == "http://www.") $_POST['homepage'] = ""; $file = "gb_files/data/content"; if($manualActivation) $file = "gb_files/data/content_new"; $key = time(); $input = $key."|@|".$_POST['name']."|@|".$_POST['email']."|@|".$_POST['homepage']."|@|".$entry."|@||@|\n"; $handle = fopen($file, "a"); fwrite($handle, $input); fclose($handle); if($mailInfo == 1) { $mailText = "Name: ".$_POST['name']."\nEmail Adresse: ".$_POST['email']."\nHomepage: ".$_POST['homepage']; $mailText .= "\nEintrag:\n".str_replace("
", "\n", $entry); $mailText .= "\n\nFreischalten: http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; $mailText .= "?p=unlockmail&pw=".$adminPass."&key=".$key; $mailText .= "\nLöschen: http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; $mailText .= "?p=unlockmail&pw=".$adminPass."&key=".$key."&a=del"; $mailHeader = "From: ".$mailAddress."\r\n"."X-Mailer: PHP/".phpversion(); mail($mailAddress, "Neuer Eintrag im Gästebuch", $mailText, $mailHeader); } if($manualActivation) echo ""; else echo ""; } elseif($_POST['preview']) { echo "\n"; echo "\n\n\n\n"; $entry = str_replace(array("
", "
"), "\\r\\n", $entry); echo "\n"; } } } break; case "login": echo "\n"; echo "\n\n"; echo "\n\n"; echo "\n"; echo "\n"; if($_POST['login']) { echo "\n"; } break; case "logout": $_SESSION['login'] = false; echo "\n"; Redirect(); break; case "sysinfo": CheckLogin(); echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; $gd_info = gd_info(); echo "\n\n"; break; case "settings": CheckLogin(); echo "\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n"; echo "\n"; if($_POST['settings_save']) { $file = "gb_files/data/config.php"; $input = ""; $handle = fopen($file, "w"); fwrite($handle, $input); fclose($handle); echo ""; } break; case "setpassword": CheckLogin(); echo "\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; echo "\n"; echo "\n"; if($_POST['password_save']) { $error = ""; if($_POST['password_old'] != $adminPass) $error .= "• altes Passwort nicht korrekt
\n"; if($_POST['password_new1'] == "") $error .= "• kein neues Passwort angegeben
\n"; if($_POST['password_new2'] == "") $error .= "• kein neues Passwort (Wiederholung) angegeben
\n"; if($_POST['password_new1'] != $_POST['password_new2']) $error .= "• neues Passwort und Wiederholung stimmen nicht überein
\n"; if($error == "") { $file = "gb_files/data/config.php"; $input = ""; $handle = fopen($file, "w"); fwrite($handle, $input); fclose($handle); echo ""; } else { echo "\n"; } } break; case "unlock": CheckLogin(); $file = array_reverse(file("gb_files/data/content_new")); $count = sizeof($file); if($count == 0) echo "\n"; else { echo "\n"; echo "\n"; for($i = 0; $i < $count; $i++) { $item = explode("|@|", $file[$i]); echo "\n\n\n\n"; if($i < $count - 1) echo "\n"; } echo "\n"; echo "\n"; echo "\n"; if($_POST['items_unlock']) { for($i = 0; $i < sizeof($_POST['itemsUnlock']); $i++) InsertItem($file[$_POST['itemsUnlock'][$i]]); $fileClear = fopen("gb_files/data/content_new", "w+"); fclose($fileClear); echo ""; } } break; case "unlockmail": if($_GET['pw'] == $adminPass) { $file = file("gb_files/data/content_new"); $count = sizeof($file); for($i = 0; $i < $count; $i++) { $item = explode("|@|", $file[$i]); if($item[0] == $_GET['key']) { if($_GET['a'] != "del") InsertItem($file[$i]); $file[$i] = ""; $fileDelete = fopen("gb_files/data/content_new", "w"); fputs($fileDelete, implode("", $file)); fclose($fileDelete); break; } } echo ""; } break; case "comment": CheckLogin(); if($_POST['inscribeComment'] || $_POST['deleteComment']) { if($_POST['deleteComment']) $comment = ""; else { $comment = strip_tags($_POST['comment']); $comment = ShortWords($comment); $comment = str_replace("\r\n", "
", $comment); } $entriesComment = file("gb_files/data/content"); $itemOld = explode("|@|", $entriesComment[$_POST['index']]); $itemNew = $itemOld[0]."|@|".$itemOld[1]."|@|".$itemOld[2]."|@|".$itemOld[3]."|@|".$itemOld[4]."|@|".$comment."|@|\n"; $entriesComment[$_POST['index']] = $itemNew; $fileComment = fopen("gb_files/data/content", "w"); fputs($fileComment, implode("", $entriesComment)); fclose($fileComment); echo ""; } break; case "edit": CheckLogin(); echo "\n"; echo "\n"; $file = file("gb_files/data/content"); $count = sizeof($file); $item = explode("|@|", $file[$_POST['index']]); echo "\n\n\n\n"; echo "\n"; echo "\n"; if($_POST['edit']) { $entriesEdit = file("gb_files/data/content"); $entry = strip_tags($_POST['entry']); $entry = ShortWords($entry); $entry = str_replace("\r\n", "
", $entry); $comment = strip_tags($_POST['comment']); $comment = ShortWords($comment); $comment = str_replace("\r\n", "
", $comment); $entriesEdit[$_POST['index']] = $_POST['time']."|@|".$_POST['name']."|@|".$_POST['email']."|@|".$_POST['homepage']."|@|".$entry."|@|".$comment."|@|\n";; $fileEdit = fopen("gb_files/data/content", "w"); fputs($fileEdit, implode("", $entriesEdit)); fclose($fileEdit); echo ""; } break; case "delete": CheckLogin(); if($_POST['deletePost']) { $entriesDelete = file("gb_files/data/content"); $entriesDelete[$_POST['index']] = ""; $fileDelete = fopen("gb_files/data/content", "w"); fputs($fileDelete, implode("", $entriesDelete)); fclose($fileDelete); echo ""; } break; default: $file = array_reverse(file("gb_files/data/content")); $count = sizeof($file); if($count == 0) echo "\n"; else { $pageHTML = "\n"; if($pages > 1) echo $pageHTML; $start = ($currentPage - 1) * $entriesPerPage; $end = $currentPage * $entriesPerPage; if($end > $count) $end = $count; for($i = $start; $i < $end; $i++) { $item = explode("|@|", $file[$i]); echo "\n\n\n\n"; if(!empty($item[5])) echo "\n"; if($_SESSION['login']) { $indexFile = ($count - $i - 1); echo "\n"; } if($i < $end - 1) echo "\n"; } if($pages > 1) echo $pageHTML; } echo "\n\n"; $file = file("gb_files/data/hits"); $hits = $file[0] + 1; $handle = fopen("gb_files/data/hits", "w"); fwrite($handle, $hits); fclose($handle); echo "\n"; echo "\n"; break; } echo "
\n"; echo "\n"; echo "\n"; echo "\n"; if($_SESSION['login']) { echo "\n"; echo "\n"; echo "\n"; if($manualActivation) echo "\n"; echo "\n"; echo "\n"; } echo "
\"Gästebuch\"
Gästebuch
\"Eintragen\"
Eintragen
Admin
Control
Panel
\"Einstellungen\"
Einstellungen
\"Passwort
Passwort ändern
\"Einträge
Einträge freischalten
\"Systeminformationen\"
Systeminfos
\"Logout\"
Logout
\n
 
Name
Email Adresse
Homepage
\nEintrag

\n"; echo "


\n"; echo "\":-)\" \n"; echo "\"%-(\" \n"; echo "\"8-]\" \n"; echo "\":-D\" \n"; echo "\":-z\" \n"; echo "\":-(\" \n"; echo "\"|-|\" \n"; echo "\":-o\" \n"; echo "\";-)\" \n"; echo "
\n"; echo "Fett \n"; echo "Kursiv \n"; echo "Unterstrichen \n"; echo "Link \n"; echo "Bild\n"; echo "
Sicherheitscode\n"; echo "\"Sicherheitscode\""; echo "
(Grafik klicken für neuen Sicherheitscode)"; echo "

\n\n"; echo "\n"; echo "
\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n".$errorString."
\n"; echo "

Vorschau
"; echo "#".(sizeof(file("gb_files/data/content")) + 1).": ".$_POST['name']."

\n"; if(!empty($_POST['email'])) echo "\"Email\" ".$_POST['email']."\n
\n"; if(!empty($_POST['homepage']) && $_POST['homepage'] != "http://www.") echo "\"Homepage\" ".TrimUrl($_POST['homepage'])."\n"; echo "
\n"; echo "
\"Kalendar\""; echo $weekday[date("w", time())].", ".date("d.m.Y - H:i:s", time())."
\n"; echo BB_Code($entry)."
Passwort
\n"; if($_POST['passwort'] == $adminPass) { $_SESSION['login'] = true; echo "Login erfolgreich.\n"; Redirect(); } else { echo "Login fehlerhaft. Falsches Passwort!\n"; } echo "
\n"; echo "Erfolgreich ausgeloggt.\n"; echo "
Betriebssystem".PHP_OS."
PHP Version".phpversion()."
GD Library
(für Sicherheitscode notwendig)
".$gd_info["GD Version"]."
Titel / Name des Gästebuchs
Einträge pro Seite
Reload- / IP-Sperre
(in Sekunden)
Manuelle Freischaltung der Einträge
Email bei neuem Eintrag
Email Adresse
(falls \"Email bei neuem Eintrag\" aktiv)
Badword-Filter
(Wörter mit Kommas trennen)
Sicherheitscode
(Captcha)
Breite in Pixel
Farbe:
Hintergrund
Hintergrund (Mitte)
Linke Zellen
Rechte Zellen
Schrift:
Farbe
Art
(z.B.: Arial, Helvetica, Sans-Serif, Verdana)
Größe
Link:
Farbe
Farbe (Hover)
Textdekoration
Textdekoration (Hover)
Rahmen:
Breite
Linienart
Farbe
\n"; echo "
altes Passwort
neues Passwort
neues Passwort wiederholen
\n"; echo "
\n"; echo "\n".$error."
\n"; echo "
Keine neuen Einträge vorhanden
alle auswählen
"; echo "\n"; echo "#".($count - $i).": ".$item[1]."

\n"; if(!empty($item[2])) { echo "\"Email\" "; $expMail1 = explode("@", $item[2]); $expMail2 = explode(".", $expMail1[1]); echo "\n".$expMail1[0]." [at] "; echo "".$expMail2[0]." [dot] ".$expMail2[1]."\n\n
\n"; } if(!empty($item[3])) echo "\"Homepage\" ".TrimUrl($item[3])."\n"; echo "
\n"; echo "
\"Kalendar\""; echo $weekday[date("w", $item[0])].", ".date("d.m.Y - H:i:s", $item[0])."
\n"; echo BB_Code($item[4])."
 
alle auswählen
\n"; echo "
Zurück
"; echo "#".($_POST['index'] + 1).":

\n"; echo "\"Email\" \n"; echo "\n
\n"; echo "\"Homepage\" \n"; echo "\n"; echo "
\n"; echo "
\"Kalendar\""; echo $weekday[date("w", $item[0])].", ".date("d.m.Y - H:i:s", $item[0])."
\n"; echo "
Kommentar:
\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n
Keine Einträge vorhanden
\n"; $pages = ceil($count / $entriesPerPage); $currentPage = $_GET['page']; if(!isset($currentPage)) $currentPage = 1; $pageHTML .= "Seite ".$currentPage." von ".$pages."   \n"; if($currentPage - 1 >= 1) $pageHTML .= "1 \n"; if($currentPage > 4) $pageHTML .= "« ... \n"; if($currentPage - 2 > 1) $pageHTML .= "".($currentPage - 2)." \n"; if($currentPage - 1 > 1) $pageHTML .= "".($currentPage - 1)." \n"; $pageHTML .= "".$currentPage." \n"; if($currentPage + 1 < $pages) $pageHTML .= "".($currentPage + 1)." \n"; if($currentPage + 2 < $pages) $pageHTML .= "".($currentPage + 2)." \n"; if($currentPage < $pages - 3) $pageHTML .= "» ... \n"; if($currentPage + 1 <= $pages) $pageHTML .= "".$pages."\n"; $pageHTML .= "
"; if($_SESSION['login']) { echo ""; } echo "#".($count - $i).": ".$item[1]."

\n"; if(!empty($item[2])) { echo "\"Email\" "; $expMail1 = explode("@", $item[2]); $expMail2 = explode(".", $expMail1[1]); echo "\n".$expMail1[0]." [at] "; echo "".$expMail2[0]." [dot] ".$expMail2[1]."\n\n
\n"; } if(!empty($item[3])) echo "\"Homepage\" ".TrimUrl($item[3])."\n"; echo "
\n"; echo "
\"Kalendar\""; echo $weekday[date("w", $item[0])].", ".date("d.m.Y - H:i:s", $item[0])."
\n"; echo BB_Code($item[4])."
Kommentar:
".$item[5]."
\n"; echo "\"Kommentar\"\n"; echo "\"Bearbeiten\"\n"; echo "\"Löschen\"\n"; echo "
\n"; if(!isset($_GET['page'])) $_GET['page'] = 1; echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n"; echo "
\n
\n"; echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n
\n"; echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n
\n"; echo "
 
\"Up\"\n"; echo "\n\n\n
\"Statistik\""; echo number_format($count, 0, ",", ".")." Einträge
"; echo number_format($hits, 0, ",", ".")." Aufrufe
\n
\n

\n"; echo "BaneCom © banecom.de\n
\n"; echo "
\n"; if($_SESSION['login']) echo "\"Login\" eingeloggt | Logout"; else echo "\"Login\"Login"; echo "
\n"; echo "\n\n";