Georgezx9 Posted March 4, 2015 Share Posted March 4, 2015 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. <?php2. 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. EtcEtc 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 2Fatal 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 More sharing options...
Larry Posted March 5, 2015 Share Posted March 5, 2015 Thanks for the nice words! Where is your config.inc.php file located? According to your code, it should be in F:\Sites\GeorgesPhotos\includes. Link to comment Share on other sites More sharing options...
Georgezx9 Posted March 5, 2015 Author Share Posted March 5, 2015 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 More sharing options...
Larry Posted March 7, 2015 Share Posted March 7, 2015 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 More sharing options...
Georgezx9 Posted March 8, 2015 Author Share Posted March 8, 2015 many thanks again, I had just reached the same point Link to comment Share on other sites More sharing options...
Recommended Posts