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

Reply via email to