Php gästebuch ohne mySQL

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Php gästebuch ohne mySQL

    kann mir jemand sagen, was bei diesem code nicht stimmt? wenn ich einen eintrag im gästebuch erstellen möchte 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 - 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\" 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\" target=_blank>Electron - www.electron-net.org</a></td></table>";
    ?>
    </body>
    </html>
    Angehängte Dateien

  • #2
    Php gästebuch ohne mySQL

    kann mir jemand sagen, was bei diesem code nicht stimmt? wenn ich einen eintrag im gästebuch erstellen möchte 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 - 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\" 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\" target=_blank>Electron - www.electron-net.org</a></td></table>";
    ?>
    </body>
    </html>
    Angehängte Dateien

    Kommentar


    • #3
      1. frag den -> This Guestbook is made by Electron...pls don't ripp anything...!
      2. register_globals, das script ist mindestens vier jahre alt. also mußt alles entsprechend umschreiben
      3. keine doppelpost

      gruß
      peter
      Nukular, das Wort ist N-u-k-u-l-a-r (Homer Simpson)
      Meine Seite

      Kommentar

      Lädt...
      X