Page 1 of 2
error message for guestbook
Posted: Tue Oct 04, 2005 3:38 am
by nancy
Script URL:
Version of script:
Version of PHP:
Hosting company:
Have you searched THIS FORUM for your problem:
(if not please do before posting)
If so, what terms did you try:
Write your message below:
I am having trouble getting the guestbook to work. I have gone over the installation instructions 4 times. I have tried chmod and it will not allow me to change it. I have tried moving everything to my cgi-bin; that doesn't work either. Everything works until I get to where I submit the post, then I get the following error message:
Warning: fopen(entries.txt) [function.fopen]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\pughcachets.com\www\gbook\gbook.php on line 438
Error
Couldn't open links file (entries.txt) for writing! Please CHMOD all entries.txt to 666 (rw-rw-rw)!
Any suggestions would be appreciated.
Posted: Tue Oct 04, 2005 10:06 am
by Klemen
Hi,
You seem to be on a Windows host?Chmod won't work there, you will have to contact your hosting company and ask them to set "world writable" permissions for entries.txt file.
Regards
Guestbook Notification email
Posted: Wed Oct 12, 2005 1:55 am
by Nancy
Thanks! It is now posting, but I can't seem to figure out why it is not notifying me of a new entry.
I am getting the following message when an entry is added:
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Inetpub\wwwroot\pughcachets.com\www\gbook\gbook.php on line 466
Posted: Wed Oct 12, 2005 11:15 am
by Henrie
The error message means that the sendmail_from option in the php.ini on your webserver is not set. If you have access to this file in the php directory you should open this file and set the sendmail_from option.
or
The other half of the error message suggests an error in line 466 of the gbook.php file. This could mean you have not properly changed the
$settings['admin_email']="you@yourdomain.com"; setting in the settings.php file of gbook.
Guestbook email notify
Posted: Wed Oct 12, 2005 12:13 pm
by Nancy
Thanks, I'll check into that! But, I do believe I have the setting in the settings.php file changed. Hmmmm!
Posted: Wed Oct 12, 2005 12:46 pm
by Guest
post the section opf code thats causing the problem and the few lines either side of it
Posted: Wed Oct 12, 2005 1:38 pm
by Guest
I changed the email address to post so I wouldn't be spammed. But the rest is exactly as it is in the file.
/* Send you an e-mail when a new entry is added? 1 = YES, 0 = NO */
$settings['notify']=1;
/* Your e-mail. Only required if $settings['notify'] is set to 1 */
$settings['admin_email']="
nancy@sbcglobal.net";
/* URL of the gbook.php file. Only required if $settings['notify'] is set to 1 */
$settings['gbook_url']="
http://www.pughcachets.com/www/gbook/gbook.php";
Any ideas???
Posted: Wed Oct 12, 2005 4:54 pm
by Henrie
The settings you posted seem to be good.
So i think it's in your php.ini
If i'm right you're on a windows system. On my windows system i have the following settings regarding to mail in php.ini
Code: Select all
[mail function]
; For Win32 only.
SMTP = 192.168.2.10
smtp_port = 25
; For Win32 only.
sendmail_from = locht005@home.nl
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
Maybe you can compare these with your settings to see if there's something wrong
Posted: Wed Oct 12, 2005 5:33 pm
by Guest
Yes, it is a Windows system.
Thanks Henrie, I'll check that!
Nancy
Posted: Wed Oct 12, 2005 7:15 pm
by Guest
hi, not that code
post the portion of code that is causing the error.
i.e error in line 466 and the lines of code either side of it
Posted: Thu Oct 13, 2005 12:04 am
by Guest
If you mean the code in php.ini, I don't have access to it, unfortunately.
Posted: Thu Oct 13, 2005 5:27 am
by Henrie
No, he means the code in gbook.php, line 466 en a few lines before and after that line.
I don't know if you have modified any code in gbook.php because the error could also be there.
In gbook version 1.33 line 466 is
Code: Select all
463 End of message
464 ";
465
466 mail("$settings[admin_email]","Someone has just signed your guestbook",$message);
467 }
468
469 /* Register this session variable */
470 $_SESSION['add']=1;
We would like to check if there is any change in the code that could cause the error.
Still not able to make it work!
Posted: Mon Oct 24, 2005 1:46 pm
by Nancy
I am still struggling to make it work. Here is the code on gbook.php. I haven't changed anything, but it doesn't look like what you posted!
The "from" option has been set in the ini file and I am still getting the same message as before.
$addline = "$name$delimiter$from$delimiter$email$delimiter$url$delimiter$comments$delimiter$added$delimiter$isprivate$settings[newline]";
$fp = @fopen($settings['logfile'],"rb") or problem("Can't open the log file ($settings[logfile]) for reading! CHMOD this file to 666 (rw-rw-rw)!");
$links = @fread($fp,filesize($settings['logfile']));
fclose($fp);
$addline .= $links;
$fp = fopen($settings['logfile'],"wb") or problem("Couldn't open links file ($settings[logfile]) for writing! Please CHMOD all $settings[logfile] to 666 (rw-rw-rw)!");
fputs($fp,$addline);
fclose($fp);
if ($settings['notify'] == 1)
{
$char = array('.','@');
$repl = array(".","@");
$email=str_replace($repl,$char,$email);
$message = "Hello!
Someone has just signed your guestbook!
Name: $name
From: $from
E-mail: $email
Website: $url
Message (without smileys):
$comments_nosmileys
Visit the below URL to view your guestbook:
$settings[gbook_url]
End of message
";
mail("$settings[admin_email]","Someone has just signed your guestbook",$message);
}
/* Register this session variable */
$_SESSION['add']=1;
?>
<p> </p>
<p> </p>
<p><b>Your message was successfully added!</b></p>
<p><a href="gbook.php?page=1">Click here to continue</a></p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<?php
printCopyHTML();
printDownHTML();
exit();
} // END addEntry
function printSign() {
global $settings;
Posted: Mon Oct 24, 2005 4:53 pm
by Henrie
Hi Nancy,
The code you have given seems to be correct.
Try changing the code from line 466
Code: Select all
mail("$settings[admin_email]","Someone has just signed your guestbook",$message);
to
Code: Select all
mail("$settings[admin_email]","Someone has just signed your guestbook",$message,"From: $name <$email>\r\n");
This sets a custom "From:" header for the mail() [function.mail]: to be used instead of the "sendmail_from" which seems to be not set in php.ini .
Let us know if this has solved your problem (or not).
Greetings,
Henrie
Posted: Mon Oct 24, 2005 4:54 pm
by Guest
Try setting up Apache 2.0.1 or later, its a damned sight easier and more secure.
this is a very simple guide to installing Apache.
You may want to do some more searching for apache security tutorials before unleashing your home server to the world, but its very good for a home testing server.
http://www.devshed.com/c/a/Apache/Insta ... Machine/1/