PDA

View Full Version : Simple Html/Php Guestbook


Spiff
04-05-2004, 06:45 PM
Hi,
I'd like to have a simple html/php based guestbook at my site (tnd2004.com (http://www.tnd2004.com)).
There should just be an input line and the text would be posted automatically on the same page, directly on the body. And it should send me new posts to my e-mail.
A friend (from toyfon.com (http://www.toyfon.com)) sent me this example:

<html>
<head>
<title>toyfon Maja</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
@import url(stylesheets/tfstyle.css);
-->
</style>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<p align="left">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="900" height="600">
<param name="movie" value="flash/portfolio_maja.swf">
<param name="quality" value="high">
<embed src="flash/portfolio_maja.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="900" height="600"></embed></object>
<br>
<a href="javascript:history.go(-1)">back</a>&nbsp;&nbsp;&nbsp; <a href="#majadown"><img src="pictures/arrow_down.gif" width="11" height="10" border="0"></a>
<br>
<br>
<a name="majadown"></a>
<?php
// Init
require('script/comments.php');
// 'script/comments.php'
$page=$PHP_SELF;

if (!$page)
$page=$_SERVER['PHP_SELF'];
if (!$inComment)
$inComment = $HTTP_POST_VARS[inComment];
// Om någon skrivit något lägg till kommentaren
if ($inComment)
addComment($inComment, $page);
?>
</p>
<form method="post" action="<?=$page?>">
<p><span class="blue">Post comment</span>
<input type="text" name="inComment" size="98">
&copy; toyfon.com 2003</p>
</form>

<p><span class="dark">Comments</span><br>
<?php // Visa Kommentarerna
$comments=getComments($page);
if ($comments)
foreach ($comments as $oneComment ) {
list($outComment, $outDate) = $oneComment;
?>
<?=$outComment?>
<?=$outDate?>
<br>
<?php
}
?>
</body>
</html>

It should be something like that. The only thing to add is the e-mail notification feature.