singhRahul34 Posted August 5, 2015 Share Posted August 5, 2015 hello sir, actually i have started session in a page and i want to know if i login from index.php it take me to home.php(where i have started a session ) if i give a url (index.php) it redirects me to that page but i want to use session which doesnot redirect me to that page unless until i dont logout from that page try to help me please Quote Link to comment https://forums.phpfreaks.com/topic/297638-regarding-some-problem-in-session/ Share on other sites More sharing options...
Ch0cu3r Posted August 5, 2015 Share Posted August 5, 2015 Make sure you are calling [m]session_start[m] on all pages that use sessions. Also make sure you are starting the session before using any $_SESSION variables. Without seeing your code I cant suggest a fix. Quote Link to comment https://forums.phpfreaks.com/topic/297638-regarding-some-problem-in-session/#findComment-1518055 Share on other sites More sharing options...
singhRahul34 Posted August 5, 2015 Author Share Posted August 5, 2015 hello sir, actually i have started session in a page and i want to know if i login from index.php it take me to home.php(where i have started a session ) if i give a url (index.php) it redirects me to that page but i want to use session which doesnot redirect me to that page unless until i dont logout from that page without clicking logout button it should not go to any url it should be at that page once we login from index.php it doesnot go to that page without logging out tha home.php page try to help me please home.php index.php login.php Quote Link to comment https://forums.phpfreaks.com/topic/297638-regarding-some-problem-in-session/#findComment-1518057 Share on other sites More sharing options...
Ch0cu3r Posted August 5, 2015 Share Posted August 5, 2015 Are you saying you want to login from index.php but do not want to be redirected to home.php when the form is submitted? Quote Link to comment https://forums.phpfreaks.com/topic/297638-regarding-some-problem-in-session/#findComment-1518061 Share on other sites More sharing options...
singhRahul34 Posted August 5, 2015 Author Share Posted August 5, 2015 Are you saying you want to login from index.php but do not want to be redirected to home.php when the form is submitted? yes exactly , i am trying to say this ... there is log out buton in home.php if i will click at that one then it should log out unless untill it should remain at the same page Quote Link to comment https://forums.phpfreaks.com/topic/297638-regarding-some-problem-in-session/#findComment-1518063 Share on other sites More sharing options...
Ch0cu3r Posted August 5, 2015 Share Posted August 5, 2015 Then move your code logic that processes the login to be in index.php there is log out buton in home.php if i will click at that one then it should log out unless untill it should remain at the same page I assume by that you want to stay on home.php when logging out, then change window.location="../zibika/index.html"; to point to home.php Quote Link to comment https://forums.phpfreaks.com/topic/297638-regarding-some-problem-in-session/#findComment-1518065 Share on other sites More sharing options...
singhRahul34 Posted August 5, 2015 Author Share Posted August 5, 2015 Then move your code logic that processes the login to be in index.php I assume by that you want to stay on home.php when logging out, then change window.location="../zibika/index.html"; to point to home.php no that is for log out function what i need to once i log in it goes to home.php but if give some other url it goes from that page if once session is establish then it should not go any other page i want the concept of session how to stop pages going to another url Quote Link to comment https://forums.phpfreaks.com/topic/297638-regarding-some-problem-in-session/#findComment-1518067 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.