forumnz Posted January 1, 2007 Share Posted January 1, 2007 On the server? Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 1, 2007 Share Posted January 1, 2007 By default, it gets saved in files where the session.save_path parameter points to - session.save_path = "/tmp" Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150838 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 If i am using an FTP can I find it on there? Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150839 Share on other sites More sharing options...
Hypnos Posted January 1, 2007 Share Posted January 1, 2007 Delends on how much access you have to the host machine. If it's just shared hosting, you probably don't have access to that folder. Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150853 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Im trying to get a text to say one thing if the session is 'set' and another if its not... Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150854 Share on other sites More sharing options...
kenrbnsn Posted January 1, 2007 Share Posted January 1, 2007 Use the [url=http://www.php.net/isset]isset()[/url] function.Example:[code]<?phpsession_start();if (isset($_SESSION['something'])) {//// do one thing//} else {//// do something else//}?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150861 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Thanks,I had this, should it work?[code]<?php session_start(); if (!$_SESSION['username']) { echo('Log In'); } else { echo('Log Out'); } ?>[/code] Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150864 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Help? Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150876 Share on other sites More sharing options...
PFMaBiSmAd Posted January 1, 2007 Share Posted January 1, 2007 The code you posted will work (it does generate a Notice level error if the session variable does not exist - which is why kenrbnsn gave code that used the isset(...) function.)When you tested it, what does it do? Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150882 Share on other sites More sharing options...
Orio Posted January 1, 2007 Share Posted January 1, 2007 Use the isset() function:[code]<?phpsession_start();if (!isset($_SESSION['username'])){ echo('Log In');}else{ echo('Log Out');}?>[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150883 Share on other sites More sharing options...
kenrbnsn Posted January 1, 2007 Share Posted January 1, 2007 Did you try it? The quickest way to determine if code is going to work is to actually try it, not ask on a forum.Ken Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150884 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Yes I have tried it...It always says "Login" - even if im logged in. Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150885 Share on other sites More sharing options...
PFMaBiSmAd Posted January 1, 2007 Share Posted January 1, 2007 Either sessions are not working or the session variable by that name is not being set. Add the following line of code after your opening <?php tag -[code]error_reporting(E_ALL);[/code]Also, post your code that starts the session and sets the session variable when you log in. Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150892 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Ok, I have managed to get it to say Logout when the user is logged in... but it comes up with this error..[code]Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/local/psa/home/vhosts/EXAMPLE/httpdocs/thing/area/index.php:7) in /usr/local/psa/home/vhosts/EXAMPLE/httpdocs/thing/area/index.php on line 53[/code] Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150895 Share on other sites More sharing options...
dcro2 Posted January 1, 2007 Share Posted January 1, 2007 You need to use that function before anything is output to the browser, preferably at the top of the script. Or use ob_start() and ob_end_flush() in your script.http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150902 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 oops it says Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/local/psa/home/vhosts/freshlook.co.nz/httpdocs/thing/area/index.php:7) in /usr/local/psa/home/vhosts/freshlook.co.nz/httpdocs/thing/area/index.php on line 53Log Out Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150905 Share on other sites More sharing options...
dcro2 Posted January 1, 2007 Share Posted January 1, 2007 Yes, put session_start() before line 7 of your script. You can't send any headers after you start outputting to the browser. Link to comment https://forums.phpfreaks.com/topic/32470-solved-where-does-session-data-get-stored/#findComment-150909 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.