phpbeginner Posted September 29, 2009 Share Posted September 29, 2009 Hi I have a session code I use on a clients website. If they elect to pay for more benefits they are redirected to paypal. When they are done they are then redirected to a confirmation page which will update their membership. Some are being redirected back fine, others are having the session end and sent back to a login page where they aren't confirmed and have to be added manually. Is this a browser issue or my code? Can anyone help? <?php session_start(); if(!session_is_registered("userId") || !session_is_registered("subscriber")) { echo("<script language='javascript'>location.href='login.php'</script>"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/175976-solved-session-start-error/ Share on other sites More sharing options...
inquisitive Posted September 29, 2009 Share Posted September 29, 2009 I would debug the problem. You are evaluating if they are registered as a UserID or subscriber... I would put an else condition on there for one and see if you can get the else to hit. I would also try setting the session for a longer time interval. I would guess that one of the reasons this error is happening is because the session is timing out. Your clients are probably just walking away from the computer or doing extra stuff and then going back to the site after the session has expired. Quote Link to comment https://forums.phpfreaks.com/topic/175976-solved-session-start-error/#findComment-927279 Share on other sites More sharing options...
phpbeginner Posted September 29, 2009 Author Share Posted September 29, 2009 For that reason I did not use a session expire.....or is there an automatic session expire if I put nothing in? I walked through it with the client, and it did also fail on theirs. Was maybe 5 minutes max and session ended. Quote Link to comment https://forums.phpfreaks.com/topic/175976-solved-session-start-error/#findComment-927287 Share on other sites More sharing options...
cags Posted September 29, 2009 Share Posted September 29, 2009 Do you have access to the php.ini? There is a session.cookie_lifetime setting. Quote Link to comment https://forums.phpfreaks.com/topic/175976-solved-session-start-error/#findComment-927290 Share on other sites More sharing options...
phpbeginner Posted September 29, 2009 Author Share Posted September 29, 2009 It is set to 0 Quote Link to comment https://forums.phpfreaks.com/topic/175976-solved-session-start-error/#findComment-927316 Share on other sites More sharing options...
MatthewJ Posted September 29, 2009 Share Posted September 29, 2009 Have you tried using a php redirect instead of javascript? Maybe the browser does not like the javascript? Probably not, but just a thought. Quote Link to comment https://forums.phpfreaks.com/topic/175976-solved-session-start-error/#findComment-927326 Share on other sites More sharing options...
mikesta707 Posted September 29, 2009 Share Posted September 29, 2009 echo("<script language='javascript'>window.location.href='login.php'</script>"); try that Quote Link to comment https://forums.phpfreaks.com/topic/175976-solved-session-start-error/#findComment-927332 Share on other sites More sharing options...
phpbeginner Posted September 29, 2009 Author Share Posted September 29, 2009 That would cause a session to end? I don't get it. Quote Link to comment https://forums.phpfreaks.com/topic/175976-solved-session-start-error/#findComment-927333 Share on other sites More sharing options...
phpbeginner Posted September 29, 2009 Author Share Posted September 29, 2009 I actually just thought of something and can someone tell me if this may be it. This account has 2 domains, 1 of which is parked. When the pay I have them redirected back to domain1.com......would it kill the session if they happen to be on the website domain2.com, paid and were redirected back to domain1.com? Quote Link to comment https://forums.phpfreaks.com/topic/175976-solved-session-start-error/#findComment-927341 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.