-
guestbook problem
I have setup my guest book and it works perfectly... BUT I want it so that when people post an entry it comes on top, and the older ones stay on the bottom, becuase right now when someone posts and entry it goes at the very bottom and the oldest entry stays ontop. It is php and its posting it to a txt file... and ideas?
-
FK's Giant
In the PHP file there should be a line somewhat similar to this:
PHP Code:
$data_to_write=fopen("file.txt", "a");
Try changing it to
PHP Code:
$data_to_write=fopen("file.txt", "r+");
The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...
-
Here is my php, I changed it to the r+ that you said but now it completely doesnt work
<?
if (!isset($name) || !isset($email) || !isset($message) || empty($name) || empty($email) || empty($message)) {
print "&result=Fail";
print "&errorMsg=" . urlencode("Input required for all fields.");
exit;
}
$email = strtolower($email);
addentry($name, $email, $message);
function addentry($name, $email, $message) {
$message = stripslashes($message);
$file = fopen('entry.txt', 'r+');
if (!$file) {
print "&result=Fail";
print "&errorMsg=" . urlencode("Could not open entry.txt file. Change CHMOD levels to 766.");
exit;
}
fputs($file,
"-----
Name:$name
Email:$email
Message:$message
");
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|