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
https://forums.phpfreaks.com/topic/184556-failed-to-open-stream-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.