English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

This is whats on the logout.php page:
session_start();
session_destroy();
$message = "Successfully logged out";
include("Login.inc");
exit();
?>

This seems to work fine. Then when i go to a page that your meant to be logged in to to go to. e.g. Welcome.php
It as has this at the top of the page:
session_start();
if (@$_SESSION['auth'] != "yes")
{
header("Location Login.php");
exit();
}
Because all the sessions have just being destroyed $_SESSION['auth'] doesnt = yes so it SHOULD header them to Login.php
But instead this shows up on the page:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

2006-10-29 05:46:59 · 6 answers · asked by peter s 1 in Computers & Internet Programming & Design

6 answers

try this:

header("locaion: login.php");


another thing when log out, make sure you called session_unset();

2006-11-01 19:36:42 · answer #1 · answered by Huey L 3 · 0 0

I can't say that this is the problem because an internal server error means that something is wrong with your php installation, and/or apache with mod_php.

I will say however that this line:

header("Location Login.php");

Should be:

header("Location: Login.php");

Reference the header() function and you'll see that it allows you to add http headers to the http response. From there you need to understand the format of the various http responses. The Location: header is just one of those, but you need to get the format right if you have any hope of getting it to work.

2006-10-29 06:02:03 · answer #2 · answered by Gizmo L 4 · 0 0

Hello,

You want to remove the @ from the $_SESSION['auth'] IF statement.
New line: if ($_SESSION['auth'] != "yes")

You want to add a colon after Location on the header line.
New line: header("Location: login.php");

A 500 internal error occurs if the file permissions are incorrect, probably due to PHPsuexec; the following actions should resolve this problem:

- CHMOD all directories which hold PHP files to 0755;

- CHMOD all PHP files in a directory to 0700 (or 0755).

Thanks

2006-11-01 23:48:49 · answer #3 · answered by Scott 2 · 0 0

Where are your sessions being stored ? Hmmm...well the session distroy script i use is ...

// Initialize the session.
// If you are using session_name("something"), don't forget it now!
session_start();

// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}

// Finally, destroy the session.
session_destroy();
?>

Note that there's a bug with custom session handlers and when you want to start a session again after you have called session_destroy.

session_destroy disables the custom session_handler and this a call to session_start after it will fail with "Failed to initialize storage module".

See http://bugs.php.net/32330 for more information and a workaround.

2006-10-29 08:22:30 · answer #4 · answered by cuteniceprty 2 · 0 0

The obvious culprit seems to be this line:

header("Location Login.php");

This is not a valid header. Edit it like so:

header("Location: Login.php");

2006-10-30 05:26:42 · answer #5 · answered by NC 7 · 0 0

I'm just learning PHP, so I may be completely off, but what about removing the @ in the if statement? I dont' recognize it as PHP syntax.

2006-10-29 06:17:17 · answer #6 · answered by Ken H 4 · 0 0

fedest.com, questions and answers