SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Location
    Sheffield, UK
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    finding which URL the user typed

    Hi

    I have a web site which can be accessed by different URLs.

    The user can type in either www.thickgeezer.com or www.totallythickgeezer.co.uk. (I've made up these domain names BTW). Both domains run the same code (not a copy).

    My site uses a verification captcha on the register page which uses the domain name as part of the key. As both URLs are using the same register.php, one of the pages is not working correctly.

    Is there anyway that I can dynamically find the url that was used to access my site? $_SERVER['DOCUMENT_ROOT'] returns the directory on the server - not the url.

    I hope the above makes sense.

    Many thanks in advance

    Gordon

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    $_SERVER['HTTP_REFERER'] is what you mean

    Edit:


    to find out all the available SERVER variables, put the following code at the top of your page:

    <?php

    echo '<pre>';
    print_r($_SERVER);
    eco '</pre>';

    ?>

    This will print out ALL the available SERVER things and also the values it holds.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Member
    Join Date
    Feb 2007
    Location
    Sheffield, UK
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that. Just performed a test - seems to work.

    Cheers

    Gordon

  4. #4
    SitePoint Enthusiast dakine's Avatar
    Join Date
    Dec 2006
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Be aware of $_SERVER['HTTP_REFERER'].

    From the PHP Manual

    The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

  5. #5
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Yes, sorry - should have mentioned that. Cheers dakine
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


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
  •