...

View Full Version : problems unloading a session



DiarYofaMadmaN
05-02-2004, 05:40 AM
<?php
session_start();
echo phpversion();
header("Cache-control: private"); //IE6 Fix

if (($_SESSION['userstatus'] = 'admin')) {
echo 'Access Allowed';
$_SESSION['userstatus'] = FALSE; //or use = ''
} else {
echo 'Access Denied';
}
?>

My php version is 4.3.3. I'm prettying sure the syntax for unloading the session is correct but it's not unloading... I have no clue. I also tried: session_unregister('userstatus'); and unset($_SESSION['userstatus']); but none of them seem to want to work. Can anyone help me with the right syntax?

-Thanks,
Rich

Scrowler
05-02-2004, 07:10 AM
$_SESSION['userstatus'] = '';

mordred
05-02-2004, 10:15 AM
if (($_SESSION['userstatus'] = 'admin')) {


I think you have an error in there - don't you rather want to do a comparison than an assignment, like



if (($_SESSION['userstatus'] == 'admin')) {


? Because otherwise you always set the userstatus again.

DiarYofaMadmaN
05-02-2004, 12:48 PM
if (($_SESSION['userstatus'] = 'admin')) {


I think you have an error in there - don't you rather want to do a comparison than an assignment, like



if (($_SESSION['userstatus'] == 'admin')) {


? Because otherwise you always set the userstatus again.

I keep on forgetting if you need to check something you need two equal signs. Thanks!

-Rich



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum