Jump to content

[SOLVED] Potential problems with this code?


The14thGOD

Recommended Posts

Due to time and some server issues and the way the computer is set up I can not test this out till Monday, but I've read some posts about:

<?php
unset($_SESSION['variable1']);
?>

not working for some people, is this not the right way to unset session variables? i saw something with $_SESSION = array();

but wouldn't that wipe out the entire $_SESSION variable? I just want to target about 6 variables and clear them.

 

Also, is there some issue with making $_SESSION variables away from the intial start of the session?

Im calling a script that checks to see if an admin is logged in near the top of the page, but then later on in the script i have session variables being created if it gets down through the IF's etc. so for example:

 

<?php
include('somescript.php');//this checks to see if user is logged in and is where session_start() lies
//several
//lines
//down
if($something = true){
//things happen here
//another if or so
if($this=$this){
$_SESSION['variable'] = 'hi';
}
}
?>

Thanks for any help,

Justin

Ok, that's what I thought, but for some reason on another server I remember running into issues. But that really only applied to the new variable names, I didn't recall having issues with unset but I came across something the other day about it not working for session variables. Decided I should post and get it checked out.

 

Thanks again.

 

Jusitn

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.