Problem when cookies are disabled.

Discussion in 'Troubleshooting' started by erald, Oct 29, 2009.

  1. erald

    erald aMember Pro Customer

    Joined:
    Jul 23, 2009
    Messages:
    20
    Just FYI.
    When a user has his cookies disabled in his browser and tries to login he will be returned to the login page without any error. If your users are not aware of this kind of behavior they will never be able to login.

    Since we are using our own login form in our pages I was not able to do any checking in the login.html so had to do the checking somewhere else.
    I found it working perfectly when the checking is done in login.php where I added the lines

    PHP:
    //testing cookies
    $myDomain ereg_replace('^[^\.]*\.([^\.]*)\.(.*)$''\1.\2'$_SERVER['HTTP_HOST']);
    $setDomain = ($_SERVER['HTTP_HOST']) != "localhost" ".$myDomainfalse;
    setcookie ("test"'just testing'0'/'"$setDomain");

    in login.php

    if (!isset($_COOKIE['test'])) {
        
    $redirect "/content/login-error";
        
    html_redirect("$redirect"0'Redirect'_LOGIN_REDIRECT);    
        exit();
    As you can see I redirect to a special page and this is hard coded.
    but it is a working solution and the user gets a page describing what the problem might be.

    The site I build has some heavy modifications for subscribing and to login. It took quite some work to get it working but looks fantastic.

    Be aware you have to load a new page after setting cookies before you can test them.. (see php manual how to set cookies)

    Quite happy to have found Amember.

    http://www.mistresst.net

Share This Page