Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi I have used Larrys excellent login, to act as a login for a photo gallery. I have used the session ID check.
 
The gallery code is HTML, but have used the session ID check to see if a person is logged in and saved it as a php file (in this case GYindex.php)
 
I am using XAMPP, and my root folder is sites, I have the usual includes and js folders, but now have new folder called photogallery, this is where the photos and php/HTML code sits.
 
The code is:

1. <?php
2. require ('includes/config.inc.php');
3. $page_title = 'Logout';
4. include ('/includes/header-pgallery.html');
5.
6. //If no first_name session variable exists, redirect the user:
7. if (!isset($_SESSION['first_name'])) {
8. $url = BASE_URL . 'index.php'; // Define the URL.
9. $url='http://localhost/index.php';
10. echo '<h3>You are not logged in.</h3>';
11. ob_end_clean();// Delete the buffer.
12. header("Location: $url");
13. exit(); // Quit the script.
 
Etc
Etc
 
I get the following error:

Warning: require(includes/config.inc.php): failed to open stream: No such file or directory in F:\Sites\GeorgesPhotos\GYindex.php on line 2

Fatal error: require(): Failed opening required 'includes/config.inc.php' (include_path='.;C:\xampp\php\PEAR') in F:\Sites\GeorgesPhotos\GYindex.php on line 2

 

thanks in advance

Link to comment
Share on other sites

thanks, it is sites/includes, when I change the referencing to

require ('/includes/config.inc.php');

with the extra backslash I get the same error

 

Or have I missed something fundamental about folder references

 

thanks again

Link to comment
Share on other sites

If you use the original code, where GYindex.php is in F:\Sites\GeorgesPhotos, and the require line is require ('includes/config.inc.php');, then you just need to move config.inc.php to F:\Sites\GeorgesPhotos\includes.

 

With the config.inc.php in F:\Sites\includes, you would instead use require('../includes/config.inc.php');

 

The use of require('/includes/config.inc.php') says to look for the includes folder in the root directory. 

Link to comment
Share on other sites

 Share

×
×
  • Create New...