Jump to content

Include file not found?


rocky48
Go to solution Solved by rocky48,

Recommended Posts

I am coding some pages for a club website, where I want to restrict access to a members area.

I have got the logging in all working, but I have just introduced logout.php to logout of the restricted area.

When I run this file I get the following error:

 

 

( ! ) Warning: require_once(includes/config.inc.php): failed to open stream: No such file or directory in D:\wamp\www\MFC1066\includes\logout.php on line 4 Call Stack # Time Memory Function Location 1 0.0010 367672 {main}( ) ...\logout.php:0
( ! ) Fatal error: require_once(): Failed opening required 'includes/config.inc.php' (include_path='.;D:\wamp\www\LoginTest\includes;D:\wamp\www\lib\PHPMailer') in D:\wamp\www\MFC1066\includes\logout.php on line 4 Call Stack # Time Memory Function Location 1 0.0010 367672 {main}( ) ...\logout.php:0

This is wierd, as the file is certainly there, as I use this file in each header file.

Here is the logout.php file:

<?php # Script 16.9 - logout.php
// This is the logout page for the site.

require_once ('includes/config.inc.php'); 
$page_title = 'Logout';
include ('includes/header1.html');

// If no first_name session variable exists, redirect the user:
if (!isset($_SESSION['first_name'])) {

	$url = BASE_URL . 'index.php'; // Define the URL.
	ob_end_clean(); // Delete the buffer.
	header("Location: $url");
	exit(); // Quit the script.
	
} else { // Log out the user.

	$_SESSION = array(); // Destroy the variables.
	session_destroy(); // Destroy the session itself.
	setcookie (session_name(), '', time()-300); // Destroy the cookie.

}

// Print a customized message:
echo '<h3>You are now logged out.</h3>';

include ('includes/footer1.html');
?>

I'm wondering if it's anything to do with my session?

The seesion starts when the user logs in.

How do you maintain the session on all of the pages that I may add in the members area, until they logout?

 

Any advice would be appreciated!

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.