/    Sign up×
Community /Pin to ProfileBookmark

I need a banner free guestbook with no links to other pages, just mine. So if anyone knows of a guestbook script let me know.. maybe i should ask PHP, but i need a guestbook… maybe a generator would be better.

to post a comment
PHP

23 Comments(s)

Copy linkTweet thisAlerts:
@pyroJun 10.2003 — Here's a simple guestbook. It shouldn't be too hard to change the way it looks.... You can see it at http://www.infinitypages.com/temp/guestbook.php

You will need a file named guestbook.txt CHMODed to 666 (read/writeable).

[code=php]<?PHP

$filename = "guestbook.txt"; #CHMOD to 666
$text = "";

if (isset($_POST["submit"])) {
$name = htmlspecialchars($_POST["name"]);
$message = htmlspecialchars($_POST["message"]);

$date = date ("l, F jS, Y");
$time = date ("h:i A");

$value = $message."<br>n<span style="font-family: verdana, arial, sans-serif; font-size: 70%; font-weight: bold;">Posted by $name at $time on $date.</span>n<break>n";

##Write the file##

$fp = fopen ($filename, "a");
if ($fp) {
fwrite ($fp, $value);
fclose ($fp);
}
else {
echo ("Your entry could not be added.");
}
}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Guestbook</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action="<?PHP echo $_SERVER["PHP_SELF"]; ?>" method="post">
<p>Your Message:<br>
<textarea name="message" rows="7" cols="50"></textarea><br>
Your Name: <input type="text" name="name">
<input type="submit" name="submit" value="submit"></p>
</form>

<?PHP

$contents = @file($filename) or die("No files in guestbook.");

foreach ($contents as $line_num => $line) {
$text .= $line;
}

$text = split("<break>", $text);

for ($i=0; $i<count($text)-1; $i++) {
echo "<div style="border: gray 1px solid; padding: 5px; font-family: arial, sans-serif; background-color: #eeeeee;">";
echo $text[$i];
echo "</div>";
}

?>
</body>
</html>[/code]
Copy linkTweet thisAlerts:
@JonathanauthorJun 10.2003 — What do I need to type in the Guestbook.txt and what is the CHMOD thing... not familiar...
Copy linkTweet thisAlerts:
@pyroJun 10.2003 — You don't type anything in guestbook.txt... just upload the blank file. To CHMOD, you will need to FTP to your site, and check the documentation on how to CHMOD files...
Copy linkTweet thisAlerts:
@JonathanauthorJun 10.2003 — So do I make the CHMOD blank and with notepad? Can you tall me how to create one

?
Copy linkTweet thisAlerts:
@pyroJun 10.2003 — No, sorry. Let me explain what CHMOD is. CHMOD is the Unix/Linux way to change the permissions of a file. Basically, it is just a Unix command to tell the file to be able to be written to.

Anyway, the script should create the file if it does not exist, so try just running guestbook.php without even uploading guestbook.txt... It should create it for you.
Copy linkTweet thisAlerts:
@JonathanauthorJun 10.2003 — So I don't have to do anything, just copy&paste the php script into a "Guestbook.php"...

Are you sure.. how will it keep track of the signatures?
Copy linkTweet thisAlerts:
@brendandonhueJun 11.2003 — It will save them in guestbook.txt.

Are you sure your server supports PHP?
Copy linkTweet thisAlerts:
@Dark_DragonOct 14.2003 — I am a bit confused as well.

This code you gave Pyro, I copied it into notepad...so can I just upload that notepad file into my host directory then as well as the blank guestbook.txt file?

Or do I need to paste the code you gave us onto a web page document then save it? I know this sounds painfully simple but I am unfamiliar with PHP.

Secondly if I do have to paste the code into a web page document..do I have to save it as a PHP or just save it as I would any other web page?

Thanks.
Copy linkTweet thisAlerts:
@pyroOct 14.2003 — Basically what you do is take all the code in the PHP block above and copy it into any HTML/plain text editor. Then, save the file with a .php extention (for PHP to be processed, it must have a .php extention). So yes, just copy the code into notepad, and save with a .php extention. Now, make a .txt file named guestbook.txt and upload that to the server as well. Once it is on the server, CHMOD the guestbook.txt file to 666 (so the PHP script can write to it).
Copy linkTweet thisAlerts:
@Dark_DragonOct 14.2003 — Oh..okay..that sounds easy enough. Thanks Pyro!
Copy linkTweet thisAlerts:
@Dark_DragonOct 14.2003 — Okay..here is another inquery..I would like the newest entry to appear at the top..what do I need to alter in order to make this happen?

Please keep in mind I am a complete idiot when it comes to PHP so don't get too techy on me. ?
Copy linkTweet thisAlerts:
@pyroOct 14.2003 — Ok, try changing the ##Write the file## section to look like this (untested):

[code=php]##Read old file##

$contents = @file($filename);
$file = "";
foreach ($contents as $line) {
$file .= $line;
}

$post = $file.$value;

##Write the file##

$fp = fopen ($filename, "w");
if ($fp) {
flock($fp, LOCK_EX);
fwrite ($fp, $post);
flock($fp, LOCK_UN);
fclose ($fp);
}
else {
echo ("Your entry could not be added.");
}[/code]
Copy linkTweet thisAlerts:
@Dark_DragonOct 14.2003 — Thanks Pyro..I am gonna try that then

Here is what I have so far..tell me if this looks correct please.

P.S..I altered the background color and text color..so that is why there is CSS.

[code=php]<?PHP

$filename = "guestbook.txt"; #CHMOD to 666
$text = "";

if (isset($_POST["submit"])) {
$name = $_POST["name"];
$message = $_POST["message"];

$date = date ("l, F jS, Y");
$time = date ("h:i A");

$value = $message."<br>n<span style="font-family: verdana, arial, sans-serif; font-size: 70%; font-weight: bold;">Posted by $name at $time on $date.</span>n<break>n";
##Read old file##

$contents = @file($filename);
$file = "";
foreach ($contents as $line) {
$file .= $line;
}

$post = $file.$value;

##Write the file##

$fp = fopen ($filename, "w");
if ($fp) {
flock($fp, LOCK_EX);
fwrite ($fp, $post);
flock($fp, LOCK_UN);
fclose ($fp);
}
else {
echo ("Your entry could not be added.");
}

}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Guestbook</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body {background-color: rgb(24,24,24)}
</style>
</head>

<body text="#FFFFFF">
<form action="<?PHP echo $_SERVER["PHP_SELF"]; ?>" method="post">
<p>Your Message:<br>
<textarea name="message" rows="7" cols="50"></textarea><br>
Your Name: <input type="text" name="name">
<input type="submit" name="submit" value="submit"></p>
</form>

<?PHP

$contents = @file($filename) or die("No files in guestbook.");

foreach ($contents as $line_num => $line) {
$text .= $line;
}

$text = split("<break>", $text);

for ($i=0; $i<count($text)-1; $i++) {
echo "<div style="border: blue 1px solid; padding: 5px; font-family: arial, sans-serif; background-color: #000000;">";
echo $text[$i];
echo "</div>";
}

?>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@pyroOct 14.2003 — Yeah, it looks good -- does it work for you?
Copy linkTweet thisAlerts:
@Dark_DragonOct 14.2003 — I haven't really tried it yet..I suppose I need to upload it first don't I?

P.S..Thanks for the help Pyro...appreciate it...wish I had learned this in business college ?
Copy linkTweet thisAlerts:
@pyroOct 14.2003 — hehe... sure thing, man... ?
Copy linkTweet thisAlerts:
@Dark_DragonOct 14.2003 — Well..I uploaded it but I cannot view it.

Of course I got a site on Yahoo Geocities..so maybe that is the problem...I uploaded the PHP page but the txt file won't load so I may have to find another host I guess
Copy linkTweet thisAlerts:
@pyroOct 14.2003 — Yeah, Geocities probably is not the best bet, when it get's to things more complex than... well, anything... ?
Copy linkTweet thisAlerts:
@Dark_DragonOct 14.2003 — Well..I'd go back to Tripod but they have everything so hosed up it isn't funny so I am gonna have to look for another free host site that offers both FTP and web based uploads....

I just happen to like web based uploads..sometimes it is more reliable for me..anyways I guess I have to search for one that actually is good...
Copy linkTweet thisAlerts:
@The_CheatOct 16.2003 — check out http://www.spaceports.com , they're one of the better free hosts out there.

Sign up with Spaceports to get:

unlimited space

up to 5 GB of transfer for your site per month

your own cgi-bin

PHP scripting

MySQL database support

helpful user forums and real-time support chat rooms[/quote]
Copy linkTweet thisAlerts:
@Dark_DragonOct 16.2003 — Okay..thanks..I will check it out then. ?
Copy linkTweet thisAlerts:
@spufiOct 30.2003 — [i]Originally posted by The Cheat [/i]

[B]check out http://www.spaceports.com[/B][/QUOTE]


I went to their forum and the unlimited space thing isn't true. You get 20MB for a free account, and you can upgrade from there, but you will never actually get unlimited space.
Copy linkTweet thisAlerts:
@The_CheatNov 04.2003 — Yeah i guess its not Truely unlimited... When you use up your 20mb space, you hit the button in your control pannel that says "apply for additional space" and you get more though...
×

Success!

Help @Jonathan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...