SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Allowing access to a page from a certain referrer

    Hi,

    I have a page on my website and I want it to be accessible only by people who visit it from a certain referring site.

    Let's say my page is this:

    http://www.mysite.com/my-page.php

    And the referring site is this:

    http://www.allowedsite.com/

    I want my page to be accessible only by visitors coming from the allowed site. Is there a way to do this with PHP?

    Thanks.
    Last edited by nayen; Jul 19, 2012 at 07:12. Reason: removed links

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,134
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    The first thing I would do is put a dummy page up with the following
    PHP Code:
    <?php var_dump($_SERVER); ?>
    Then navigate to that page from allowedsite.com

    You will see the variables that were developed with this request on the page (better formatted if you do a view source)

    I believe there is a HTTP_REFERER_URL variable inside $_SERVER, but it has been my past experience that the field isn't always populated.


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
  •