Anyway, I've been having some trouble getting the guestbook on my website ( http://www.fett1138.net ) to work properly. At first I used html, and got nowhere, then flash, also didn't work out for me, so now I'm trying to use php. I got some code for a guestbook that writes to a txt file at [ http://www.webmasterworld.com/forum88/1104.htm ] because I don't really want to use MySQL. Some people have made that code work, NOT ME.
I edited the code for my own use, which can be seen below...
<h5>Please type your comment and screen name below and press 'Submit' to add it.</h5>
<form method="post" action="">
Name: <br />
<input type="text" name="name" size="30">
<br>
E-mail: <br />
<input type="text" name="email" size="30">
<br>
Website: <br />
<input type="text" name="homepage" size="30" value="http://">
<br>
Comment: <br />
<textarea name="message" wrap="VIRTUAL" cols="50" rows="5"></textarea>
<br>
<input type="hidden" name="from" value="<? echo $HTTP_REFERER ?>">
<input type="submit" name="Submit" value="Submit"> <input type="reset" name="Reset value="Reset>
</form>
<div class="credits">
------------------------------------------------------------------------------------------------
</div>
<h3>Comments</h3>
<!-- start php code -->
<?
if ($message)
{
$name = strip_tags($name);
$email = strip_tags($email);
$homepage = strip_tags($homepage);
$message = strip_tags($message);
$message = ereg_replace("\r\n\r\n", "\n<P>", $message);
if (get_magic_quotes_gpc())
{
$message = stripslashes($message);
$name = stripslashes($name);
}
$date = date("l, F j Y");
$message = "<B>$name </B> -- $date -- <a href=mailto:$email>$email</a><br>$message<br><a href=$homepageurl>$homepagename</a><br>Refered by $from<br><br>\r\n";
$textfile = "guestbook.txt";
if ($fp = @fopen ($textfile, "r"))
{
$oldmessages = @fread($fp,filesize($textfile));
@fclose(fp);
}
$fp = fopen ($textfile, "w");
fwrite ($fp, $message);
fwrite ($fp, $oldmessages);
fclose ($fp);
}
@readfile("guestbook.txt");
?>
<!-- end php code --> I have uploaded "guestbook.txt" and set CHMOD on both "guestbook.php" and "guestbook.txt" to 777.
If anyone who has more php experience than me could tell me what the problem is, it would be greatly appreciated!
Thanks

Help
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.



Back to top










