ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Session variables and cookies being lost for certain ISP

February 17, 2010 10:23am

Subscribe [3]
  • #1 / Feb 17, 2010 10:23am

    Stuart Whitman

    27 posts

    I’m running EE 1.6.8 with MSM.

    I’m having an issue with losing session data between pages. The site http://www.planyourcar.com checks the 1st segment of the URL and sets a cookie accordingly. This then changes the telephone number in the top right corner and directs form output to different email addresses.

    The segment is stored in a session variable ($branch) using the following code on the index template:

    <?php
    
    session_start();
    
    $branch_url = '{segment_1}';
    
    //set the referrer
    if (isset($_SERVER['HTTP_REFERER'])) {
        $referrer = $_SERVER['HTTP_REFERER'];
    }else{
        $referrer = "unknown";
    }
    
    if (!isset($_SESSION['exp_referrer'])) {
        $_SESSION['exp_referrer'] = $referrer;
    }
    
    //set the branch vars
    if (strlen($branch_url)==0) {
    if (!isset($_SESSION['exp_branch'])) {
           $branch = 'headoffice';
           $_SESSION['exp_branch'] = $branch;
    } else {
           $branch = $_SESSION['exp_branch'];
    }
    } else {
           $branch = $branch_url;
           $_SESSION['exp_branch'] = $branch;
    }
    
    // This catches an issue with google where sometimes favicon is passed as a parameter
    if ($branch=="favicon.ico") {
        $branch="headoffice";
        $_SESSION['exp_branch'] = $branch;
    }
    
    ?>

    This is then picked up by other templates and voila.

    The very strange problem I’m having is this won’t work for one of the main ISP’s here in the U.K (TalkTalk). I thought this may be related to having a server farm server dynamic IP’s (although the session ID is the same between pages) so I switched to cookies and still get the same problem.

    I know it’s related to the ISP as I’ve run hundreds of checks over the past week from multiple ISP’s and devices and setup a clean install PC with no anti-virus/security software and everyone who’s on the TalkTalk network doesn’t set the cookie/session variable.

    Has anyone get any idea on what might cause this or what I can do?

  • #2 / Feb 17, 2010 11:13am

    Sue Crocker

    26054 posts

    But it’s OK with other ISPs?

  • #3 / Feb 17, 2010 11:16am

    Stuart Whitman

    27 posts

    Yes.

    Tried with several other large ISPs here in the U.K (B.T and Virgin Media) on the same computer and it works fine. Also tried from my Blackberry and an iPhone on 2 different 3G networks and they all work fine.

  • #4 / Feb 17, 2010 3:39pm

    Ingmar

    29245 posts

    This does indeed point to an issue with this particular ISP. Since we probably won’t be able to reproduce, troubleshooting will be difficult.

    When you say “doesn’t work”, what exactly does that mean? Does the cookie get set at all? How does it differ from the cases where it’s working as expected?

  • #5 / Feb 17, 2010 4:04pm

    Stuart Whitman

    27 posts

    In either case when using session variables or cookies all the cookies are set but they contain a default value “headoffice”.

    On all the ISP’s that work (and indeed how it should work) the following will happen:

    If I go to http://www.plan-edinburgh.com this forwards to http://www.planyourcar.com/edinburgh. The PHP code above will pick up segment_1 = edinburgh and set $branch accordingly. This also performs a query to get the telephone number for the relevant branch based upon a custom field in a weblog (the phone number for the example is 0800 783 0499). If segment_1 is null, or $branch is null or the sql query returns no results then $branch is set to “headoffice” and the default phone number of 01992 890999 is displayed.

  • #6 / Feb 17, 2010 5:23pm

    Ingmar

    29245 posts

    I see what you mean. As expected, it’s working fine for me. Is there a way to add some debugging code, perhaps, to see where this ISP fails? It might be something trivial, like filtering out referrers, or some other such low level network issue. Sorry I can’t offer much more assistance here.

    Are you a customer? Have you opened a ticket with their support?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases