Jump to content

failed to open stream error


nomadrw

Recommended Posts

Hello Everyone:

 

I'm trying to do a book exercise and I'm getting this error message

 

Warning: include(/home/password.inc) [function.include]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/testing/10/ch22/logentry.php on line 3

 

Warning: include() [function.include]: Failed opening '/home/password.inc' for inclusion (include_path='.:/Applications/xampp/xamppfiles/lib/php:/Applications/xampp/xamppfiles/lib/php/pear') in /Applications/XAMPP/xamppfiles/htdocs/testing/10/ch22/logentry.php on line 3

 

I have full grant permission on the db and there are a couple entries in the fields.

If you need to see the db please let me know.

 

Below is the codes

login.php

<HTML>
<HEAD>
<TITLE>Weblog login screen</TITLE>
</HEAD>

<P><B>Supply a username and password.</B></P>
<FORM METHOD=POST ACTION="logentry.php">
<P>USERNAME:<INPUT TYPE=TEXT NAME="test_username" SIZE=20></P>
<P>PASSWORD:<INPUT TYPE=PASSWORD NAME="test_password" SIZE=20></P>
<P>BLOG ENTRY:<BR><TEXTAREA NAME="logtext" COLS=75 ROWS=20 WRAP="VIRTUAL"></TEXTAREA></P>
<P><INPUT TYPE="SUBMIT" VALUE="SUBMIT">
</FORM>
</BODY>
</HTML>

 

login.php

<?php
$date = date("Ymd");
include("/home/password.inc");

if($_POST['test_username'] == $username && $_POST['test_password'] == $password) {
  $fp = fopen("/entries/$date.txt", "w");
  $try_entry = fwrite($fp, $_POST['logtext']);
  if ($try_entry > -1) {
    print("Weblog entry for $date written to disk.");
  } elseif ($try_entry == -1) {
    print("Weblog entry write failed.");
  }
} else {
  mail("me@localhost", "Weblog snoop alert", "Someone from $REMOTE_ADDR is trying to get into your weblog entry handler.");
}
?>

 

password.inc I have this file in a directory called home

<?php
$username = "nomad";
$password = "nomad";
?>

 

For the entries directory I had a file called

20091208.txt

 

Any help would be great

Damon

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.