02-20-2008, 03:11 AM
|
#1 (permalink)
|
|
The Acquainted
Join Date: Jan 2008
Posts: 136
Thanks: 4
|
$_session - Ugh!
Hey.
Okay, its late so I thought I'd explain this in pictures :P
Here is logout.php:
PHP Code:
<?php
require_once("conf_global.php");
$_SESSION['is_logged_in'] = 0;
$_SESSION['username'] = "Guest";
session_destroy();
echo $_SESSION['is_logged_in'] ;
echo $_SESSION['username'];
?>
and the part of login.php specific to setting Session Vars:
PHP Code:
if($login){
$_SESSION['is_logged_in'] = 1;
$_SESSION['username'] = "$_POST[user]";
echo '<h1>Thank you for logging in</h1>';
echo '<div class="mainContent">';
echo 'Thank you, <strong class="orange">'. $username . ' </strong>you are now logged in. You are being redirected to your user panel.';
echo '<meta http-equiv="refresh" content="3;url=usercp.php">';
echo '</div>';
}
And the part in usercp.php
PHP Code:
<strong>Logged In As: </strong> <span class="orange"><?php echo $_SESSION['username']; ?></span>
I dont see what I'm doing wrong: do you?
Thanks a bunch :)
Gareth
|
|
|
|