SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    May 2004
    Location
    London
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie help, How to get a referal and keep it?

    Hello guys!

    I want to keep the referal information in a session in my site but don't want to loose it everytime the visitor returns to my homepage from an internal page.

    What I mean is, I have this in my index.php:

    PHP Code:
    <?php 
    session_start
    (); 
    header("Cache-control: private"); 
    $visref $HTTP_REFERER;
    $_SESSION['visref'] = $visref
    ?>
    This way I will be able to know what page the user came from when he contact me. But the problem is that if he goes to my portfolio page and then goes back to my Home page the Session is registed with the interal page and not the actual referal site.

    How can I do this?

    Thanks!

  2. #2
    SitePoint Addict
    Join Date
    May 2005
    Location
    London, ON
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check if that session variable is already set. If it is, don't set it again. See this page: http://www.tizag.com/phpT/phpsessions.php and scroll down to the title "PHP Sessions: Using PHP's isset Function"

    Ryan Price
    Subscribe to my blog for regular tips and tricks


Bookmarks

Posting Permissions

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