ShaunO Posted August 1, 2008 Share Posted August 1, 2008 Ahh, well, in the C:\Program Files\EasyPHP1-8\php is there a sessions or temp folder? You also need to take the ; off the start of the line to uncomment it and have it take effect And then restart the webserver. Quote Link to comment https://forums.phpfreaks.com/topic/117766-solved-little-help-on-sessions-p/page/2/#findComment-605794 Share on other sites More sharing options...
harsh00008 Posted August 2, 2008 Author Share Posted August 2, 2008 hey I swirched over to a xampp server and the page1/page2.php thing is working... but one more question.. now i want my thing to be like this.. if it's a guest he'll see the login username/password text field below which are in body.php which is included in the index file.. if he logs in successfully the login username/password field should not be appear.. well i tried many session stuff but I'm still unsuccessfull.. and also include a link on header.php file which directs to logout only for successfully logged in members...guest can't view it any suggestions and a simple solution;D Quote Link to comment https://forums.phpfreaks.com/topic/117766-solved-little-help-on-sessions-p/page/2/#findComment-605927 Share on other sites More sharing options...
JasonLewis Posted August 2, 2008 Share Posted August 2, 2008 Well to show the login to the guest but not to someone who is logged in you would need an if statement. You would want to check if the session isn't set. If it's not set, then show the login form. Think about it. Quote Link to comment https://forums.phpfreaks.com/topic/117766-solved-little-help-on-sessions-p/page/2/#findComment-605929 Share on other sites More sharing options...
harsh00008 Posted August 2, 2008 Author Share Posted August 2, 2008 Well to show the login to the guest but not to someone who is logged in you would need an if statement. You would want to check if the session isn't set. If it's not set, then show the login form. Think about it. hey man i did the same thing but it doesn't work... it gives some error Quote Link to comment https://forums.phpfreaks.com/topic/117766-solved-little-help-on-sessions-p/page/2/#findComment-605932 Share on other sites More sharing options...
JasonLewis Posted August 2, 2008 Share Posted August 2, 2008 Please post what you did, along with the error. It'll help us help you. Quote Link to comment https://forums.phpfreaks.com/topic/117766-solved-little-help-on-sessions-p/page/2/#findComment-605934 Share on other sites More sharing options...
harsh00008 Posted August 2, 2008 Author Share Posted August 2, 2008 Please post what you did, along with the error. It'll help us help you. hey it works like...wen u login it directs to login.php where ur account is verified and then it echoes succesfull login and in login.php a session is setted.. then i put session_start(); in the index.php and the if statement then error given on index.php is Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\new\index.php:3) in C:\xampp\htdocs\new\index.php on line 4 the forth line in index.php is session_start(); Quote Link to comment https://forums.phpfreaks.com/topic/117766-solved-little-help-on-sessions-p/page/2/#findComment-605942 Share on other sites More sharing options...
JasonLewis Posted August 2, 2008 Share Posted August 2, 2008 session_start() should always be at the top. Okay... Here is some sample code. //call session_start() up at the very top of the page, ABSOLUTE TOP! //Now lets check if the session isn't set. if(!isset($_SESSION['user_logged_in_session'])){ //Okay, the session isn't set. That means it must be a guest. echo "Show the login form!"; }else{ //Hey, it's a member! echo "Welcome back member!"; } Quote Link to comment https://forums.phpfreaks.com/topic/117766-solved-little-help-on-sessions-p/page/2/#findComment-605948 Share on other sites More sharing options...
harsh00008 Posted August 2, 2008 Author Share Posted August 2, 2008 session_start() should always be at the top. Okay... Here is some sample code. //call session_start() up at the very top of the page, ABSOLUTE TOP! //Now lets check if the session isn't set. if(!isset($_SESSION['user_logged_in_session'])){ //Okay, the session isn't set. That means it must be a guest. echo "Show the login form!"; }else{ //Hey, it's a member! echo "Welcome back member!"; } Ok now on logging in it says welcome back member... but now wat about logout? I tried these codes for logout <?php session_start(); session_destroy; include "header.php"; if(!isset($_SESSION['user_logged_in_session'])) { Echo "<h3><center>You are logged out.</h3></center>"; Echo "<br><center><h3>Click <a href=index.php>here</a> to goto index page</h3></center>"; header("location:index.php"); } Else { Echo "not logged out"; }; ?> and it everytimes echoes not logged out and the session isn't destroyed Quote Link to comment https://forums.phpfreaks.com/topic/117766-solved-little-help-on-sessions-p/page/2/#findComment-606148 Share on other sites More sharing options...
LemonInflux Posted August 2, 2008 Share Posted August 2, 2008 EDIT: nvm :] ---------------- Now playing: Linkin Park - Krwlng (Mike Shinoda ft. Aaron Lewis) via FoxyTunes Quote Link to comment https://forums.phpfreaks.com/topic/117766-solved-little-help-on-sessions-p/page/2/#findComment-606151 Share on other sites More sharing options...
harsh00008 Posted August 2, 2008 Author Share Posted August 2, 2008 hey i got some of my mistakes and now everything is working thnx everyone for their help Quote Link to comment https://forums.phpfreaks.com/topic/117766-solved-little-help-on-sessions-p/page/2/#findComment-606171 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.