Jump to content

$session->language not set : is there a way to detect a browser can't accept cookies ?


Doc
 Share

Recommended Posts

Hi guys,

I'm hitting a "too_many_redirect" problem on a test I was doing by forcing my browser to not accept any cookies :

if (!$session->lg) {
    echo "session not set<br>";
    $lg = 'en';
    $session->lg = $lg;
    echo $session->lg; // I see 'en'
    
    $url = $page->localHttpUrl("$lg");
    echo $url; // I see the good URL : http://www.mywebsite.com/en
    $session->redirect("$url");
} else {
    echo "session set<br>";
    exit;
}

I never hit the 'else' case and my browser eventually stops working and display a too_many_redirection error.

How can I detect the $session->lg hasn't been saved correctly ?

Thanks

 

Link to comment
Share on other sites

Thanks @LostKobrakai

Well, I'm ok with that, but I'd like to catch that case (browser doesn't accept cookies) rather than displaying a too_many_redirect error message on the user's browser. Perhaps there is a way to do so ?

Otherwise, for that particular case, I could use the url variable we were talking about yesterday, but the session solution was more elegant :(

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...