![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Letzter Eintrag im Gästebuch: Helmuth FRIEDL - 20.11.2018
Das neueste Bild: CIMG3260a.jpg - 15.11.2012 in der Test-Bildergalerie |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ![]() |
<?php
/////////////////////////////////////////////////////////////////////// // Simple guestbook from http://www.dobsak.at - Vienna, Dec 2004 // // Allows visitors to your site to post a message of their own. // // Very simple setup, only requires you to change 4 settings. // // The entries will be checked and stored directly in the // // guestbook file gbook.htm below the line "<!--insert-->" // // You need: // // gbook.php (this file), gbook.htm (the guestbook), formate.css // // This script is freeware. You use this program at your own risk. // // No warranty and support is given. // /////////////////////////////////////////////////////////////////////// // configuration ##################################################### $gbook_file = "gbook.htm"; // located in same directory $formate_css = "http://www.mydomain.com/guestbook/formate.css"; $gbook_htm = "http://www.mydomain.com/guestbook/gbook.htm"; $gbook_php = "http://www.mydomain.com/guestbook/gbook.php"; // end of configuration ############################################## // parse from webform ############################################## reset ($_POST); $form = array(); while ( list($name, $value) = each ($_POST)) { $value = trim(preg_replace("/<([^>])*>/s","",$value));//strip all tags $value = str_replace("\"",""",$value);//double quoting to html if ($name == "comments") { $value = preg_replace("/(\r\n|\r|\n){2,}/","\r\n",$value);//strip empty lines $form[$name] = preg_replace("/\r\n|\r|\n/", "<br>", $value); } else { $form[$name] = $value; } } if (isset($form['name'])) { if ($form['name'] == "") no_name(); } else { sign(); // and exit } if (isset($form['email'])) { if ($form['email'] == "" || check_email($form['email'])) no_email(); } else { sign(); // and exit } if (!isset($form['city'])) { sign(); // and exit } if (isset($form['comments'])) { if ($form['comments'] == "") no_comments(); } else { sign(); // and exit } if (isset($HTTP_GET_VARS['edit'])) { myheader(); print "Willkommen! Welcome! Bitte tragen Sie sich in mein Gästebuch ein. Danke! Thanks!\n"; print "<hr>\n"; myform(); exit; } $gbook = ""; if (isset($HTTP_GET_VARS['insert'])) { // now we can file form data ######################################## if ( $fl = fopen($gbook_file, "r+") ) { if ( flock($fl, LOCK_EX) ) { while (!feof ($fl)) { $buffer = fgets($fl); $gbook .= $buffer; if (trim($buffer) == "<!--insert-->") { myposting(); } } fseek($fl, 0); ftruncate($fl, 0); fwrite($fl, $gbook); fflush($fl); flock($fl, LOCK_UN); fclose($fl); } else { echo "<h3>Fehler beim speichern in das Gästebuch!!</h3>\n</body></html>"; exit; } } else { echo "<h3>Fehler beim öffnen vom Gästebuch!</h3>\n</body></html>"; exit; } myheader(); print "Danke! Ihr Eintrag wurde zu meinem "; print "<A HREF=\"$gbook_htm\">Gästebuch</A> hinzugefügt.<br><br>\n"; // mail to me ####################################################### // here should be inserted a mail message print "</body></html>\n"; } else { // show posting ##################################################### myheader(); print "<P>Das haben Sie eingegeben:<P>\n"; myposting(); print $gbook; $action = "?insert"; insertform(); print "<input type=\"submit\" value=\"Eintrag im Gästebuch speichern\">\n"; print "</form>\n"; $action = "?edit"; insertform(); print "<input type=\"submit\" value=\"Eintrag ändern\">\n"; print "</form>\n"; print "</body></html>\n"; } // end of program ##################################################### function myposting() { global $gbook, $date, $form; $date = date("d") . "." . date("m") . "." . date("Y"); $gbook .= "<table style=\"width:600px;\">\n"; if ( $form['name']) { $gbook .= "<tr>"; $gbook .= "<td class=\"name\">Name: </td>"; $gbook .= "<td>".$form['name']." - $date</td>"; $gbook .= "</tr>\n"; } if ($form['email']) { $gbook .= "<tr>"; $gbook .= "<td class=\"name\">E-mail: </td>"; $gbook .= "<td><a href=\"mailto:".$form['email']."\"> ".$form['email']."</a></td>"; $gbook .= "</tr>\n"; } if ( $form['city'] ){ $gbook .= "<tr>"; $gbook .= "<td class=\"name\">Stadt/Land: </td>"; $gbook .= "<td>".$form['city']."</td>"; $gbook .= "</tr>\n"; } $gbook .= "<tr><td class=\"name\">Bemerkung: </td>\n"; $gbook .= "<td class=\"colored\">".$form['comments']."</td></tr></table>\n"; $gbook .= "<br>\n\n\n"; } function insertform() { global $action, $gbook_php, $form; print "<form method=\"post\" action=\"$gbook_php".$action."\">\n"; print "<input type=\"hidden\" name=\"name\" value=\"".$form['name']."\">\n"; print "<input type=\"hidden\" name=\"email\" value=\"".$form['email']."\">\n"; print "<input type=\"hidden\" name=\"city\" value=\"".$form['city']."\">\n"; print "<input type=\"hidden\" name=\"comments\" value=\"".str_replace("<br>","\n",$form['comments'])."\">\n"; } function sign() { global $form; myheader(); print "Willkommen! Welcome! Bitte tragen Sie sich in mein Gästebuch ein. Danke! Thanks!\n"; print "<hr>\n"; $form{'name'} = ""; $form{'email'} = ""; $form{'city'} = ""; $form{'comments'} = ""; myform(); exit; } function no_name() { global $form; myheader(); print "<p class=\"red\">Sie haben Ihren Namen vergessen!</p>\n"; myform(); exit; } function no_email() { global $form; myheader(); print "<p class=\"red\">Sie haben Ihre E-Mail Adresse nicht ausgefüllt<br>\n"; print "oder die Adresse ist ungültig!</p>\n"; myform(); exit; } function no_comments() { myheader(); print "<p class=\"red\">Sie haben die Bemerkung nicht ausgefüllt!</p>\n"; myform(); exit; } function myheader() { global $formate_css; print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n"; print " \"http://www.w3.org/TR/html4/loose.dtd\">\n"; print "<html>\n<head>\n"; print " <meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\">\n"; print " <meta name=\"description\" content=\"Das einfache Gästebuch in PHP von EDV Dienstleistungen Ing. Dobsak Herbert\">\n"; print " <link rel=stylesheet type=\"text/css\" href=\"$formate_css\">\n"; print "<title>Gästebuch</title>\n"; print "</head>\n<body>\n"; print "<h2> Gästebuch Formular</h2>\n"; } function myform() { global $gbook_htm, $gbook_php, $form; print "<form method=\"post\" action=\"$gbook_php\">\n"; print "<table cellspacing=3 cellpadding=2>\n"; print "<tr>\n"; print " <td align=right><b>Name:</b></td>\n"; print " <td><input type=\"text\" name=\"name\" value=\"".$form['name']."\" size=\"30\"></td>\n"; print "</tr>\n"; print "<tr>\n"; print " <td align=right><b>E-Mail:</b></td>\n"; print " <td><input type=\"text\" name=\"email\" value=\"".$form['email']."\" size=\"30\"></td>\n"; print "</tr>\n"; print "<tr>\n"; print " <td align=right><b>Stadt/Land:</b></td>\n"; print " <td><input type=\"text\" name=\"city\" value=\"".$form['city']."\" size=\"30\"></td>\n"; print "</tr>\n"; print "<tr>\n"; print " <td align=\"right\"><b>Bemerkung:</b></td>\n"; print " <td><textarea name=\"comments\" cols=\"50\" rows=\"7\">".str_replace("<br>","\n",$form['comments'])."</textarea>"; print "<br><br><input type=\"submit\" value=\"Eintrag senden\"></td>\n"; print "</tr>\n"; print "</table>\n"; print "</form>\n"; print "zurück zum <a href=\"$gbook_htm\">Gästebuch</a>\n"; print "</body>\n</html>\n"; } function check_email($em) { if ((preg_match("/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/",$em)) || (!preg_match("/^.+@((\w|-)+\.){1,3}[a-zA-Z]{2,6}$/",$em))) { // max 6 chars in TLD eg .museum return(1); } else { return(0); } } ?> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|