57strat
07-07-2005, 05:40 AM
Hello, I am utilzing a flash / php to txt guestbook I got on the internet. I heavily modified it to my tastes....the problem is, it loads the entry at the bottom of the txt file....rather than the top...( oldest entries show at top, and newest entry sows at bottom...you have to scroll down to see the latest entry....( this is the way the guestbook worked originally, and I am trying to fix it to show the latest entry at the top )
Thanks to anyone that can help!!!
the php file is as follows:
<?
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, $website, $message);
function addentry($name, $email, $website, $message) {
$posted = strftime("%D");
$message = stripslashes($message);
$file = fopen('entry.txt', 'a+');
if (!$file) {
print "&result=Fail";
print "&errorMsg=" . urlencode("Could not open entry.txt file. Change CHMOD levels to 766.");
exit;
}
fputs($file, "<font color=\"#A4514D\">Name:</font> $name\n<font color=\"#A4514D\">Email:</font><font color=\"#666666\"><A href=\"mailto:$email\"> $email</A></font>
\n<font color=\"#A4514D\">Website:</font><font color=\"#666666\"><A href=\"http://$website\"target=\"_blank\"> $website</A></font>
\n<font color=\"#A4514D\">Posted:</font> $posted\n<font color=\"#A4514D\">Message:</font> $message\n\n");
fclose($file);
mailAdmin($name, $email, $website, $message);
}
function mailAdmin($name, $email, $website, $message) {
$mailTo = "myemail@mydomain.com";
$mailFrom = "From: <myemail@mydomain.com>";
$mailSubject = "Re: You have a new guestbook entry!";
$mailBody = "A visitor to your site has left the following information in your guestbook:\n
Name: $name
Email: $email
Website: $website
The visitor commented:
------------------------------
$message
------------------------------
You can view the message at:
http://mydomain.com";
mail($mailTo, $mailSubject, $mailBody, $mailFrom);
mail($email, "Re: Your recent guestbook entry!", "Thank you kindly, for your recent guestbook entry on mywebsite.com! Be sure to visit often for all the latest updates and news!", "From: myemail@mydomain.com");
}
print "&result=okay";
exit;
?>
Thanks to anyone that can help!!!
the php file is as follows:
<?
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, $website, $message);
function addentry($name, $email, $website, $message) {
$posted = strftime("%D");
$message = stripslashes($message);
$file = fopen('entry.txt', 'a+');
if (!$file) {
print "&result=Fail";
print "&errorMsg=" . urlencode("Could not open entry.txt file. Change CHMOD levels to 766.");
exit;
}
fputs($file, "<font color=\"#A4514D\">Name:</font> $name\n<font color=\"#A4514D\">Email:</font><font color=\"#666666\"><A href=\"mailto:$email\"> $email</A></font>
\n<font color=\"#A4514D\">Website:</font><font color=\"#666666\"><A href=\"http://$website\"target=\"_blank\"> $website</A></font>
\n<font color=\"#A4514D\">Posted:</font> $posted\n<font color=\"#A4514D\">Message:</font> $message\n\n");
fclose($file);
mailAdmin($name, $email, $website, $message);
}
function mailAdmin($name, $email, $website, $message) {
$mailTo = "myemail@mydomain.com";
$mailFrom = "From: <myemail@mydomain.com>";
$mailSubject = "Re: You have a new guestbook entry!";
$mailBody = "A visitor to your site has left the following information in your guestbook:\n
Name: $name
Email: $email
Website: $website
The visitor commented:
------------------------------
$message
------------------------------
You can view the message at:
http://mydomain.com";
mail($mailTo, $mailSubject, $mailBody, $mailFrom);
mail($email, "Re: Your recent guestbook entry!", "Thank you kindly, for your recent guestbook entry on mywebsite.com! Be sure to visit often for all the latest updates and news!", "From: myemail@mydomain.com");
}
print "&result=okay";
exit;
?>