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

Link to comment
Share on other sites

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

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.