note 19080 added to ref.filesystem
| From: | webmaster at Pheeble dot com | Date: | Fri, 15 Feb 2002 03:21:29 +0000 |
| Subject: | note 19080 added to ref.filesystem | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26632@lists.php.net to get a copy of this message | ||
i've looked everywhere for guestbooks without advertisements on them and now that i know how to
make them myself i'll give some code out to people who are like i was.
so, create three files gbook.txt gbooksign.php and gbook.php
**gbooksign.php
<html>
<body>
<form action="gbook.php?action=post" method="post">
<input type="text" name="name" value="Name">
<input type="text" name="comments" value="Comments">
<input type="submit" value="Sign">
</form>
<BR>
<a href="gbook.php?action=view">View G-Book</a>
</body>
</html>
**gbook.php
<html>
<body>
<?php
if ($action=="post"){
$file=("gbook.txt");
$fp=fopen("$file", "a+");
$write=("Name:$name \n Comments:$comments \n");
fwrite($fp, "$write");
fclose($fp);
echo "<meta http-equiv='refresh' content='0;
url=gbooksign.php'>";
}
else if ($action=="view"){
echo "<pre><font face=tahoma>";
include ("gbook.txt");
echo "</font></pre>";
}
else {
echo "<meta http-equiv='refresh' content='0;
url=gbooksign.php'>";
}
?>
</body>
</html>
there you have it.... you dont need to do anything to gbook.txt, upload all three and have fun!
--
http://www.php.net/manual/en/ref.filesystem.php
http://master.php.net/manage/user-notes.php?action=edit+19080
http://master.php.net/manage/user-notes.php?action=delete+19080
http://master.php.net/manage/user-notes.php?action=reject+19080