Return to the Forum Home
 Post New TopicNote: Polls are considered new topics.  If you post a poll, it will be created as a new subject in this forum, not as a reply within this topic.Topic Replies: PopIt!Post A Reply
MyPop™ | register | search | faq | forum home


PreviousGo to the next oldest topic in this forum Go to the next newest topic in this forumNext
 friends of ED » friends of ED forums » Dynamic Content » PHP Session Control

Rating:   Not yet rated
Author Topic:   PHP Session Control
watergirlflorida
friend of ED
Describes the mood or content of the topic posted Click Here to See the Profile for watergirlflorida   Reply With QuoteEdit or Delete MessageReport This Post
I need to figure out the code for deleting the session information in my tmp folder when a user logs out. The code I've generated ends the session successfully but it's not deleting the information.

Here is my code:

<?php

if (isset($_SESSION['MM_UserGroup'])){
//unset session variable
unset($_SESSION['MM_UserGroup']);
//end session
session_destroy();
}
if (isset($_SESSION['MM_Username'])){
//unset session variable
unset($_SESSION['MM_Username']);
//end session
session_destroy();
}
?>

I am using CS4 but used the Foundation PHP for Dreamweaver 8 as a reference to build my site.

Anyone's help is greatly appreciated.

Thanks!

Posts: 9 | Registered: 10-08-06
dexbarrett
new friend of ED
Describes the mood or content of the topic posted Click Here to See the Profile for dexbarrett   Reply With QuoteEdit or Delete MessageReport This Post
Hi, i was checking out some books and saw this topic.

I've been working with sessions lately and as far as i know the first thing you have to do is recover the current session with session_start() and also call to session_unset() and session_destroy() only once.

this is a sample code of what i use to script a log out:

 
<?php

if(isset($_POST['logout'])){
session_start();
session_unset();
session_destroy();
header("Location:../index.html");
}
?>
 


i use session_unset() alone to delete all the session variables but if you specify which data to delete it should work as well.

Cheers.

Posts: 2 | Registered: 11-03-09
watergirlflorida
friend of ED
Describes the mood or content of the topic posted Click Here to See the Profile for watergirlflorida   Reply With QuoteEdit or Delete MessageReport This Post
Thanks for the input. I really appreciate that!
Posts: 9 | Registered: 10-08-06
dexbarrett
new friend of ED
Describes the mood or content of the topic posted Click Here to See the Profile for dexbarrett   Reply With QuoteEdit or Delete MessageReport This Post
You're welcome
Posts: 2 | Registered: 11-03-09

All times are
Post New TopicNote: Polls are considered new topics.  If you post a poll, it will be created as a new subject in this forum, not as a reply within this topic.Post A Reply
Print Page
Printable
Email a Friend
Email a Friend
Topic Replies: PopIt!
PopIt!
MyPop™
MyPop™
Contacts
Contacts
Administrative Links:
Close Topic
Close
Manage Topic
Manage
Delete Topic
Delete
Admin Options
PreviousGo to the next oldest topic in this forum Go to the next newest topic in this forumNext

Rate Topic:

Hop To:

All content copyright 2001-2008 friends of ED. No reuse without permission.

OpenTopic 3.1.0