forumnz Posted December 31, 2006 Share Posted December 31, 2006 [code]Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in /usr/local/psa/home/vhosts/freshlook.co.nz/httpdocs/thing/area/logout.php on line 6[/code]I want the person logged in to be logged out by destoying the session but I dont know why this error comes up. Any ideas are greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/32354-solved-i-have-a-logout-page-tht-displays-this-error/ Share on other sites More sharing options...
fert Posted December 31, 2006 Share Posted December 31, 2006 you could do this[code]unset($_SESSION);[/code]or[code]$_SESSION=array();[/code] Link to comment https://forums.phpfreaks.com/topic/32354-solved-i-have-a-logout-page-tht-displays-this-error/#findComment-150234 Share on other sites More sharing options...
trq Posted December 31, 2006 Share Posted December 31, 2006 Have you got a call to session_start() prior to calling session_destroy()? Link to comment https://forums.phpfreaks.com/topic/32354-solved-i-have-a-logout-page-tht-displays-this-error/#findComment-150236 Share on other sites More sharing options...
forumnz Posted December 31, 2006 Author Share Posted December 31, 2006 Its not working... Yes I when the user logs in it starts a session.This is my logout code:[code]<html><body><?php$_SESSION=array();?>Thanks... url to index.php <a href="index.php">here</a></body></html>[/code] Link to comment https://forums.phpfreaks.com/topic/32354-solved-i-have-a-logout-page-tht-displays-this-error/#findComment-150237 Share on other sites More sharing options...
trq Posted December 31, 2006 Share Posted December 31, 2006 [code]<?php session_start(); session_destroy();?><html><body>Thanks... url to index.php <a href="index.php">here</a></body></html>[/code] Link to comment https://forums.phpfreaks.com/topic/32354-solved-i-have-a-logout-page-tht-displays-this-error/#findComment-150239 Share on other sites More sharing options...
forumnz Posted December 31, 2006 Author Share Posted December 31, 2006 Thanks sooo much!! Link to comment https://forums.phpfreaks.com/topic/32354-solved-i-have-a-logout-page-tht-displays-this-error/#findComment-150241 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.