forumnz Posted January 1, 2007 Share Posted January 1, 2007 On the server? Quote Link to comment 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" Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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... Quote Link to comment 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 Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Help? Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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] Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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. 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.