Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder hedbanger's Avatar
    Join Date
    Jun 2002
    Location
    vallejo, ca
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php conditional referrer event

    i have a remote knowledge base application that i call into several different websites. the stylesheet used should depend on the website. i used the referrer to determine which one. but the session doesn't persist once one clicks onto a second page.
    an example is at http://www.circulon.com/customer_support_redirect.html
    can someone help me tweak my code to get the style to persist?

    PHP Code:
    <? ob_start();

    if(!isset(
    $_SESSION['theme_selection'])) {
        
    $_SESSION['theme_selection'] = 'http://www.meyer.com/csenduser.css';
    }

    if(isset(
    $_SERVER['HTTP_REFERER']) && !strpos(@$_SERVER['HTTP_REFERER'],'meyer.custhelp.com')) {
            if(
    strpos(@$_SERVER['HTTP_REFERER'], 'anolon.com') !== false)
        {
            
    $_SESSION['theme_selection'] = 'http://www.meyer.com/A.css';
        }
        else if(
    strpos(@$_SERVER['HTTP_REFERER'], 'bonjourproducts.com') !== false)
        {
            
    $_SESSION['theme_selection'] = 'http://www.meyer.com/B.css';
        }
        else if(
    strpos(@$_SERVER['HTTP_REFERER'], 'circulon.com') !== false)
        {
            
    $_SESSION['theme_selection'] = 'http://www.meyer.com/C.css';
        }
        else if(
    strpos(@$_SERVER['HTTP_REFERER'], 'kitchenaidcookware.com') !== false)
        {
            
    $_SESSION['theme_selection'] = 'http://www.meyer.com/K.css';
        }
             else if(
    strpos(@$_SERVER['HTTP_REFERER'], 'farberwarecookware.com') !== false)
        {
            
    $_SESSION['theme_selection'] = 'http://www.meyer.com/F.css';
        }

       else if(
    strpos(@$_SERVER['HTTP_REFERER'], 'meyer.com') !== false)
       {
            
    $_SESSION['theme_selection'] = 'http://www.meyer.com/M.css';
       }
       else if(
    strpos(@$_SERVER['HTTP_REFERER'], 'silverstone.com') !== false)
       {
            
    $_SESSION['theme_selection'] = 'http://www.meyer.com/M.css';
       }
        else if(
    strpos(@$_SERVER['HTTP_REFERER'], 'potsandpans.com') !== false)
       {
            
    $_SESSION['theme_selection'] = 'http://www.meyer.com/P.css';
        }
    else if(
    strpos(@$_SERVER['HTTP_REFERER'], 'thepotrack.com') !== false)
       {
            
    $_SESSION['theme_selection'] = 'http://www.meyer.com/P.css';
        }

        else
        {
            
    $_SESSION['theme_selection'] = 'http://www.meyer.com/csenduser.css';
        }
    }
    if(isset(
    $_SESSION['theme_selection']))
    echo 
    '<link rel="stylesheet" href="'.htmlspecialchars($_SESSION['theme_selection']).'" />';
    ?>
    <? ob_end_flush
    (); ?>
    jf~ if you're not part of the solution, you're part of the precipitate.

  • #2
    New Coder
    Join Date
    Mar 2007
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts
    from my knowledge $_SESSION variables require a session_start(); statement on the page so they can persist. Otherwise they'll be set for the current page and will have to be set again for the next.

    If I'm wrong feel free to correct me. I'm just trying to help.

  • #3
    New Coder hedbanger's Avatar
    Join Date
    Jun 2002
    Location
    vallejo, ca
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks krokador,
    that sounds reasonable. do you see a way to target the subsequent pages? they're dynamic, but there are a handful of templates that are used that i could specify by name, maybe. there's only the one header that i have access to. is there a way to specify the referrer's referrer? :-}



    meantime, i'm going to try taking out that final else statement.
    jf
    Last edited by hedbanger; 03-29-2007 at 05:36 PM.
    jf~ if you're not part of the solution, you're part of the precipitate.

  • #4
    New Coder
    Join Date
    Mar 2007
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm trying to think about how you could manage this. I always worked with some kind of global file that had session_start(); as the first statement and was included first thing in all my pages. I imagine your referrer is included in these pages, right? So probably by just adding the session_start(); at the top of your code, it would work.

    My head isn't at it's best right now for that kind of thinking, but from what I remember if I didn't put it at the very beggining of my php code, the statement caused an "headers already sent" kind of error. If that doesn't work, then someone else might be better than me in helping you. ^^

  • #5
    New Coder hedbanger's Avatar
    Join Date
    Jun 2002
    Location
    vallejo, ca
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks again.
    i 'm pretty sure that the same header is included in all files. it's just that once a link within the remotely hosted iframe is followed, the domain of the referrer changes. using sessions, or cookies and php or possibly javascript might solve this, but i'm stymied. i'd really like to fix this and hope someone can help me.
    jf
    jf~ if you're not part of the solution, you're part of the precipitate.

  • #6
    New Coder hedbanger's Avatar
    Join Date
    Jun 2002
    Location
    vallejo, ca
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i am calling the starting page by using the url after selecting the brand line that i want to display. that is, i use a selection box to search for all of the answers for a particular product line and use that url for the results page that i call into my iframe. a typical example would be:
    http://meyer.custhelp.com/cgi-bin/me...p_new_search=1
    however, clicking on one of the search result detail links results in a url that doesn't have the product id. but there is a session id.
    http://meyer.custhelp.com/cgi-bin/me...i=&p_topview=1
    can i get some help on figuring out how to utilize one of these to continue to access the correct style sheet?
    thanks.
    jf
    jf~ if you're not part of the solution, you're part of the precipitate.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •