my code

Snippet options

Download: Download snippet as gaestebuch_beitragphp.php.
Copy snippet: For this you need a free my code account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

//unbefugte zurück auf die login-seite:
if(!isset($_SESSION['angemeldet']) || $_SESSION['angemeldet'] == false)
//echo "angemeldet: {$_SESSION['angemeldet']}<br />";
$error = "";
  if(isset($_POST['benutzer'], $_POST['beitrag']))     {
      $benutzer = trim($_POST['benutzer']);
      $beitrag = trim($_POST['beitrag']);
      //echo "zahl1: $zahl1, zahl2: $zahl2 <br />";
            if(!(empty($benutzer) || empty($beitrag))) //beide felder ausgefüllt ?
    $zeitstempel = date("d.m.Y-H:i:s");
//zeilenumbrüche \n aus dem textfenster in <br /> umwandeln
$beitrag=preg_replace("/(\r\n|\n)/","<br />",$beitrag);
    $adresse = fopen("gaestebuch.txt", "a");
    fwrite($adresse, "$benutzer::$beitrag::$zeitstempel\n");
     $error .="Bitte beide Felder ausfüllen.<br />";
<title> Gaestebuch </title>
<h1>Neuer Beitrag</h1>
  if($error != "")
  echo ("<p style=\"color:red\")>$error</p>");
<form action="gaestebuch_beitrag.php" method="post">
  Benutzer: <br /><input type="text" size="25%" name="benutzer" /><p />
  Beitrag: <br /><textarea name="beitrag" cols="50" rows="10" /></textarea><br />
  <input type="submit" />

Create a free my code account now.

my code is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.