Forum Moderators: coopster
I need a very customisable guestbook whose entries contain the following fields:
- name
- email
- homepage url
- homepage name
- date message posted
- referrer (found site through...)
If there is no way of doing it without mySQL, I'd need detailed instructions on how to set up the thing.
[edited by: jatar_k at 4:47 pm (utc) on Aug. 26, 2002]
[edit reason] snip url [/edit]
What I was hoping to get, was a pointer to a specific (free) guestbook which exactly matches my criteria and with whom somebody had positive experiences.
If it's forbidden to post URLs, then just tell me the name of such a free PHP guestbook and I'll look for it with Google.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><body bgcolor="#FFFFFF">
<form method="post" action="">
Name:
<input type="text" name="name" size="30">
<br>
E-mail:
<input type="text" name="email" size="30">
<br>
<br>
Message:
<textarea name="message" wrap="VIRTUAL" cols="30" rows="4"></textarea>
<br>
<br>
Homepage URL:
<input type="text" name="homepageurl" size="30" value="http://">
<br>
<br>
Homepage Name:
<input type="text" name="homepagename" size="30">
<br>
<br>
<input type="hidden" name="from" value="<? echo $HTTP_REFERER ?>">
<br>
<input type="submit" name="Submit" value="Submit">
</form>
<!-- start php code -->
<?
if ($message)
{
$name = strip_tags($name);
$email = strip_tags($email);
$homepageurl = strip_tags($homepageurl);
$homepagename = strip_tags($homepagename);
$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 -->
</body>
</html>
Copy the above and name it what ever you want with a .php extension
You can work on the layout :-)
[edited by: jatar_k at 7:42 pm (utc) on Sep. 1, 2002]
[edit reason] fixed code tag [/edit]
Warning: fopen("guestbook.txt", "w") - Permission denied in /usr/www/users/mysite/guestbook.php on line 63
Warning: Supplied argument is not a valid File-Handle resource in /usr/www/users/mysite/guestbook.php on line 64
Warning: Supplied argument is not a valid File-Handle resource in /usr/www/users/mysite/guestbook.php on line 65
Warning: Supplied argument is not a valid File-Handle resource in /usr/www/users/mysite/guestbook.php on line 66
Naming the script with .php was sufficient.
But there is one thing missing - the referrer input field ('found site through' with a pull-down menu).
Just change
<input type="hidden" name="from" value="<? echo $HTTP_REFERER ?>">
to
<select name="from" class="inputbox">
<option value="" selected>- Please Select -
<option value="foo">foo
<option value="foo2">foo2
<option value="foo3">foo3
<option value="foo4">foo4
<option value="foo5">foo5
</select>
foo = what ever you want the choices to be.
dhdweb
Notice: Undefined variable: message in c:\inetpub\wwwroot\dc\pu\guestbook\index.php on line 38
any help?