1. Weiterleitung zu NetzLiving.de
  2. Forum
    1. Unerledigte Themen
  3. zum neuen Forum
  • Anmelden
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Seiten
  • Forum
  • Erweiterte Suche
  1. Informatik Forum
  2. Webmaster & Internet
  3. Entwicklung

Php Gästebuch ohne mySQL

    • Frage
  • tigermilk
  • 3. April 2006 um 14:12
  • Unerledigt
Hallo zusammen,

das Informatik-Forum geht in den Archivmodus, genaue Informationen kann man der entsprechenden Ankündigung entnehmen. Als Dankeschön für die Treue bekommt man von uns einen Gutscheincode (informatikforum30) womit man bei netzliving.de 30% auf das erste Jahr sparen kann. (Genaue Infos sind ebenfalls in der Ankündigung)

Vielen Dank für die Treue und das Verständnis!
  • tigermilk
    Punkte
    45
    Beiträge
    6
    • 3. April 2006 um 14:12
    • #1

    kann mir jemand sagen, was bei diesem code nicht stimmt? wenn ich einen eintrag verfasse und auf sign klicke, wird weder ein neuer eintrag angelegt noch wird eine fehlermeldung ausgegeben.

    dankeschön.

    <?
    //******************>>EDIT HERE<<***************
    $gbfile = "gb.entrys"; // chmod 666 this file!
    $backgroundcolor = "black";
    $text = "white";
    $bordercolor= "";
    $link = "silver";
    $linkhover = "white";
    $gblogo = "./gb.gif";
    //******************>>END<<*********************
    ?>
    <html>
    <!--This Guestbook is made by Electron...pls don't ripp anything...!-->
    <!--Copyright (c) 2001-2002 by Electron - http://www.electron-net.org -->
    <head>
    </head>
    <style>
    td { font-family: Verdana; font-size: 8pt}
    textarea
    {
    font-family:tahoma;
    font-size:12;
    }
    A:visited {text-decoration: none; color: <?echo $link;?>}
    <!--A {text-decoration: none; color: <?echo $link;?>}-->
    <!--A:hover {text-decoration: underline; color: <?echo $linkhover;?>;}-->
    </style>
    <? echo "<body bgcolor=\"$backgroundcolor\" text=\"$text\">"; ?>
    <center>
    <img src=<?echo $gblogo;?>><p>
    <?
    if (!file_exists("$gbfile")) { echo "ERROR!<p><center>create file $gbfile and chmod 666 the file!<br><br><br><table border=0 width=100%><td bgcolor=gray><center></td></table>"; die(); }
    $formstyle = "STYLE=\"BORDER: gray 1px solid; WIDTH: 144px; height: 17px; color:silver; font-size: 10; background: #313131;\" size=25";
    ?>
    <table>
    <form action=<?$PHP_SELF?>?add=entry method=post>
    <td><font face=tahoma size=1>Name:</td>
    <td><input name="name" <? echo $formstyle; ?>></td><tr>
    <td><font face=tahoma size=1>E-Mail:</td>
    <td><input name="email" <? echo $formstyle; ?>></td><tr>
    <td><font face=tahoma size=1>URL:</td>
    <td><input name="url" <? echo $formstyle; ?> value=http://></td><tr>
    <td valign=top><font face=tahoma size=1>Comments:</td>
    <td>
    <textarea type="comment" name="comments" STYLE="overflow:hidden; BORDER: gray 1px solid; color: silver; WIDTH: 144px; height: 70px; font-size: 10; background: #313131"; cols=35 rows=5></textarea>
    </td><tr>
    <td></td><td>
    <input type=submit value="Sign" STYLE="BORDER: gray 1px solid; color: silver; font-size: 10; background: #313131; width:50px;">
    <input type=reset value="Reset" STYLE="BORDER: gray 1px solid; color: silver; font-size: 10; background: #313131; width:50px;">
    </td></table>
    <p><table border=0 cellspacing=0 width=550 height=100%><td valign=top>
    <?
    $today = getdate();
    $month = $today[month];
    $mday = $today[mday];
    $year = $today[year];
    $zeituhr = "$month $mday, $year";

    if($add == "entry") {
    if($name == "" || $comments == "") { echo "<center>Please enter your: name and comment.<p>"; }
    else {
    if($url == "http://" || $url == "") { $url = "</a>none"; }
    if($email == "") { $email = "</a>none";}
    $filesize = filesize($gbfile);
    $file = fopen("$gbfile","r");
    $buffer = fread($file,$filesize);
    fclose($file);

    $file = fopen("$gbfile","w");
    //$parsed_message = strip_tags($comments,"<a>,<i>");
    //$comments_br = str_replace("\n","<br>",$parsed_message);
    $comments = str_replace("<iframe","&ltimg src=",$comments);
    $comments = str_replace("<img src=","&lt;img src=",$comments);
    $comments = str_replace("<i>","",$comments);
    $comments = str_replace("<meta","&ltmeta",$comments);
    $comments = str_replace("<","&lt;",$comments);
    $comments = str_replace(">","&gt;",$comments);
    $comments = str_replace("|","&brvbar;",$comments);
    $comments = str_replace("\n","<br>",$comments);
    $today = date( "Ymd", time() );
    $index = date("YmdHis",time());
    $message_table ="$index | $zeituhr | $REMOTE_ADDR | $name | $email | $url | $comments";
    fputs($file,"$message_table\n$buffer");
    fclose($file);
    echo "<center>entry added!<p>";
    }
    }
    ?>
    <?
    //gb infos
    ;
    $data = file("$gbfile");
    $max = count($data);
    $pages = ($max / 10 + 1);
    $size = (filesize($gbfile) / 1024);
    if(filesize($gbfile) == 0) { $max = "1"; }
    echo "<center>entries: $max, pages: " . round($pages, 0) . ", size: " . round($size, 2) . "kB<p>";

    $msg = 10;
    $data = file("$gbfile");
    rsort ($data);
    $max = count($data);
    If(!$pg){$pg=0;}
    If($pg==0){print("<center>back");}
    else{$tmp = $pg -1; print("<center>< <a href=\"$PHP_SELF?pg=$tmp\">back</a>");}
    $tmp = $pg * $msg + $msg;
    print(" | ");
    if ($max > $tmp){$tmp = $pg +1; print ("<a href=\"$PHP_SELF?pg=$tmp\">next</a> ><p>");}
    else {print("next<p>");}
    $start = $pg * $msg;
    $end = $pg * $msg + $msg;;
    if ($end > $max){$end=$max;}

    if(filesize($gbfile) == 0) {
    print
    "<table border=1 width=100% cellspacing=0 cellpadding=0 bordercolor=\"$bordercolor\"><td><table border=0>
    <td>Date:</td><td>$zeituhr</td><tr>
    <td>Name:</td><td>Electron</td><tr>
    <td>Host:</td><td>127.0.0.1</td><tr>
    <td>E-Mail:</td><td><a href=\"mailto:electron@electron-net.org\">electron@electron-net.org</a></td><tr>
    <td>URL:</td><td><a href=\"http://www.electron-net.org%5c" target=_blank>http://www.electron-net.org</a></td><tr>
    <td valign=top width=85>Comment:</td><td>Hi, have a lot of fun with this guestbook ;) bye.<br><font size=1>(this entry becomes deleted automatically)</td>
    <table border=0 width=100%></td></table></table><p>\n";

    }

    for ($u=$start; $u<$end; $u++)
    {
    $info = explode("|",$data[$u]);
    if($info[7] != "") { $info[7] = "<p><i>Admin:<br>$info[7]</i>"; }
    $info[6] = wordwrap( $info[6], 50, "\n", 1);
    $info[3] = wordwrap( $info[3], 50, "\n", 1);
    $info[4] = wordwrap( $info[4], 50, "\n", 1);
    print
    "<table border=1 width=100% cellspacing=0 cellpadding=0 bordercolor=\"$bordercolor\"><td><table border=0>
    <td>Date:</td><td>$info[1]</td><tr>
    <td>Name:</td><td>$info[3]</td><tr>
    <td>Host:</td><td>$info[2]</td><tr>
    <td>E-Mail:</td><td><a href=\"mailto:$info[4]\">$info[4]</a></td><tr>
    <td>URL:</td><td><a href=\"$info[5]\" target=_blank>$info[5]</a></td><tr>
    <td valign=top width=85>Comment:</td><td>$info[6] $info[7]</td>
    </td></table></table><p>\n";
    }
    echo "</td></table><table border=0 width=100% ><td bgcolor=gray><center><font face=tahoma size=1>Copyright (c) 2001-2002 by <a href=\"http://www.electron-net.org%5c" target=_blank>Electron - http://www.electron-net.org</a></td></table>";
    ?>
    </body>
    </html>

  • Filz
    Punkte
    815
    Beiträge
    150
    • 3. April 2006 um 14:29
    • #2

    das direkte auslesen von Variablen aus POST und GET wurde in den letzten Jahren irgendwann mal deaktiviert...

    heißt jetzt:
    $_GET['add']
    $_POST['name']
    $_POST['email']
    $_POST['comments']
    $_POST['url']

  • beefy
    Punkte
    1.683
    Beiträge
    304
    • 3. April 2006 um 15:13
    • #3

    Bzw. $_REQUEST['blah']. Siehe Predefined variables im PHP-Manual.

  • Maximilian Rupp 27. Dezember 2024 um 12:06

    Hat das Thema aus dem Forum Programmieren nach Entwicklung verschoben.

  1. Datenschutzerklärung
  2. Impressum