| | |
session destroy problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2008
Posts: 13
Reputation:
Solved Threads: 0
hi
when i click the previous page button it was gng to logout page the sesion was not destroying when iwas using this code please help me
when i click the previous page button it was gng to logout page the sesion was not destroying when iwas using this code please help me
PHP Syntax (Toggle Plain Text)
<?php session_start(); session_unset($_SESSION['uname']); session_destroy(); header ("Location: login.php"); ?>
try this code:
php Syntax (Toggle Plain Text)
session_start(); session_unregister('uname'); session_destroy(); header ("Location: login.php");
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
all you need to do to destroy a session is call
you don't need to unset variables before then.
session_unregister is depreciated anyway.
if you want to remove something like the uname part of the session array just use
PHP Syntax (Toggle Plain Text)
session_destroy();
you don't need to unset variables before then.
session_unregister is depreciated anyway.
if you want to remove something like the uname part of the session array just use
PHP Syntax (Toggle Plain Text)
unset($_SESSION['uname']);
I've always just done
and that works fine for everything that I do.
BTW: session_unregister() is not forward compatible with php6
php Syntax (Toggle Plain Text)
function destroy_sess($sessname = "all sessions") { if($sessname == "all sessions") { $_SESSION = array(); } else { $_SESSION[$sessname] = NULL; unset($_SESSION[$sessname]); } }
BTW: session_unregister() is not forward compatible with php6
Last edited by R0bb0b; Aug 27th, 2008 at 7:46 pm.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
![]() |
Similar Threads
- Session destroy not working.... (PHP)
- session log out problem (PHP)
- Users management (PHP)
- Hijackthis log RE: Potentially rootkit-masked files (Viruses, Spyware and other Nasties)
- virus infection help, please? (Viruses, Spyware and other Nasties)
- Pop3 Mail Watcher (Part 1) (Visual Basic 4 / 5 / 6)
- help with pcOrion spyware scanner (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: Socket programming
- Next Thread: GoDaddy server timing out?
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code codingproblem cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select send server sessions sms snippet soap source space speed sql static structure syntax system table tutorial up-to-date update upload url validation validator variable video web wordpress xml youtube






