Thank you Stephen, tried it on localhost, although i would not get the email, the only warning messages i got were tell me just that.
"Stephen Edmonds" <[EMAIL PROTECTED]> wrote in message 006a01c2a535$9910f3f0$6d00a8c0@q">news:006a01c2a535$9910f3f0$6d00a8c0@q... > Here is your problem: > > Warning: fopen("guestbook.txt", "w") - Permission denied in > /home/.sites/112/site154/web/guestbook_post.php on line 15 > > Whats happening is for some reason your file, guestbook.txt, is not writable > by php. Two things could be causing this. Firstly, you may need to specify > the full path to the file, e.g. c:/dir/dir/guestbook.txt. Note the foreward > slashes instead of backwards ones. > > The second problem could be your webserver/php isn't set up to allow you to > edit the file guestbook.txt. There are methods of restricting access to a > file, but I am not familiar with them since I use my own windows host (no > restrictions). Good luck > > Stephen > > P.S. Try calling phpinfo(32) and look for the _SERVER["COMSPEC"] or > something similar. That should tell you the path to your file where the .php > file lies, then its just a matter of figuring out where the guestbook is! > > ----- Original Message ----- > From: "Andy" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, December 16, 2002 6:54 PM > Subject: Re: [PHP-WIN] Warning messages > > > > Here is the code and warning messages > > > > <? > > if (($email=="") || ($name=="") || ($phone=="")) > > { > > echo "Please fill out the guestbook completely before submitting."; > > } > > else > > { > > $fp = fopen("guestbook.txt", "w"); //w will append or create a new file > > flock ($fp, LOCK_EX); //lock the file > > > > fwrite($fp, "$name signed the guestbook. \nHis e-mail address was $email > > \nHis phone number was $phone\n\n"); > > > > flock ($fp, LOCK_UN); //unlock the file > > fclose($fp); > > > > mail("[EMAIL PROTECTED]", "Guestbook entry added", wordwrap("$name > > signed the guestbook. \nHis e-mail address was $email \nHis phone number > was > > $phone", 72, "\n", 1), "Return-Path: > > <[EMAIL PROTECTED]>\nForm: Andrew Davey"); > > > > mail("$email", "Thank you for signing my Guestbook", wordwrap("Thank you, > > $name, for signing my Guestbook.", 72, "\n", 1), "Return-path: > > <[EMAIL PROTECTED]>\nForm: Andrew Davey"); > > echo "<font face=Verdana size=1>Thank you, " . $name . ", for signing my > > Guestbook."; > > } > > ?> > > > > Which give me the following errors: > > > > Warning: fopen("guestbook.txt", "w") - Permission denied in > > /home/.sites/112/site154/web/guestbook_post.php on line 15 > > > > Warning: flock(): supplied argument is not a valid File-Handle resource in > > /home/.sites/112/site154/web/guestbook_post.php on line 16 > > > > Warning: fwrite(): supplied argument is not a valid File-Handle resource > in > > /home/.sites/112/site154/web/guestbook_post.php on line 18 > > > > Warning: flock(): supplied argument is not a valid File-Handle resource in > > /home/.sites/112/site154/web/guestbook_post.php on line 20 > > > > Warning: fclose(): supplied argument is not a valid File-Handle resource > in > > /home/.sites/112/site154/web/guestbook_post.php on line 21 > > > > The code i used was copied directly from a book, as i am a complete > > beginner, so answers need to be idiot proof > > :o) > > > > Andy > > > > > > "Stephen Edmonds" <[EMAIL PROTECTED]> wrote in message > > 005501c2a532$17a348c0$6d00a8c0@q">news:005501c2a532$17a348c0$6d00a8c0@q... > > > That means you have an error in your use of fwrite.... its not a proper > > > 'file pointer'. Its not a setting you can change in your php.ini, as it > is > > > cause by a problem with your script. In fact, your script should not > work > > > because of the error. > > > > > > If you paste the code and what your script does, I may be able to help > > > > > > Stephen > > > > > > ----- Original Message ----- > > > From: "Andy" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Monday, December 16, 2002 6:19 PM > > > Subject: [PHP-WIN] Warning messages > > > > > > > > > > what do I change in my php.ini file to stop these annoying warning > > > notices? > > > > I have looked at the ini file but I am unsure what to change. I still > > > want > > > > to see error messages but the warning notices are doing my head in. > > > > > > > > An example would be: > > > > Warning: fwrite(): supplied argument is not a valid File-Handle > resource > > > in > > > > /home/.sites/112/site154/web/guestbook_post.php on line 18 > > > > > > > > Thank you > > > > > > > > > > > > > > > > -- > > > > PHP Windows Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > > > > > > -- > > PHP Windows Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php