error message for guestbook

Dr. GBooky is here to help you with your guestbook problems ...
nancy

error message for guestbook

Post 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.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post 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
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Nancy

Guestbook Notification email

Post 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
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post 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.
Nancy

Guestbook email notify

Post by Nancy »

Thanks, I'll check into that! But, I do believe I have the setting in the settings.php file changed. Hmmmm!
Guest

Post by Guest »

post the section opf code thats causing the problem and the few lines either side of it
Guest

Post 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???
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post 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
Guest

Post by Guest »

Yes, it is a Windows system.
Thanks Henrie, I'll check that!

Nancy
Guest

Post 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
Guest

Post by Guest »

If you mean the code in php.ini, I don't have access to it, unfortunately.
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post 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.
Nancy

Still not able to make it work!

Post 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>&nbsp;</p>
<p>&nbsp;</p>
<p><b>Your message was successfully added!</b></p>
<p><a href="gbook.php?page=1">Click here to continue</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
printCopyHTML();
printDownHTML();
exit();
} // END addEntry

function printSign() {
global $settings;
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post 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
Guest

Post 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/
Post Reply