boo_lolly Posted December 6, 2007 Share Posted December 6, 2007 so, i need to remove all data from my sessions but for some reason it's not working out. i've tried session_destroy() but for some reason that didn't work so i wrote a script. but the script doesn't work. error Fatal error: Cannot redeclare flush() in /var/www/piratebeachhouse/index.php on line 294 script <?php function flush($array) { foreach ($array as $key => $val) { if (is_array($val)) { flush($val); } else { $val = null; } } } //<-- line 294 ?> so what's the deal? i've written plenty of functions before that were repetitive. (i forgot the worf used when you call upon a function within the same function) what's wrong with my script? and what alternatives should i try? Quote Link to comment Share on other sites More sharing options...
trq Posted December 6, 2007 Share Posted December 6, 2007 There is a built in function in php called flush. I'm not sure why you don't simply use... <?php $_SESSION = array(); ?> anyway. Quote Link to comment Share on other sites More sharing options...
Stooney Posted December 6, 2007 Share Posted December 6, 2007 $_SESSION = array(); session_destroy(); setcookie ('PHPSESSED', '', time()- 300, '/', '', 0); Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted December 6, 2007 Author Share Posted December 6, 2007 thorpe, thanks for the advice. it's been a while since i've programmed in php and i find myself doing things the hard way. you da man. as usual. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.