Restrict Access...

Discussion in 'PHP' started by ECS Dave, Mar 23, 2008.

  1. #1
    I understand referral data is not the most secure way to restrict access to a page. However, it will do for me.

    How do I accomplish this:

    Access to a target page is granted ONLY from a certain other page.

    For example: Visitor A clicks a link to page B from page A, is allowed to access the page B.
    Visitor B types in the full link to page B, is NOT allowed access to page B, and is shown whatever...

    Can this be done?

    I appreciate, in advance, any direction to a resource for answers, or better yet - the answer.

    Be Well!
    ECS Dave
     
    ECS Dave, Mar 23, 2008 IP
  2. zerxer

    zerxer Peon

    Messages:
    368
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if($_SERVER['HTTP_REFERER'] != "site a") die("You're NOT allowed access");
     
    zerxer, Mar 23, 2008 IP
  3. ECS Dave

    ECS Dave Active Member

    Messages:
    244
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Thanks zerxer...

    I however, in between the time I posted this, and now, found out that I needed a cgi solution - and I found that solution.

    Thanks again though!

    ECS Dave
     
    ECS Dave, Mar 23, 2008 IP
  4. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #4
    Zerxer's solution will work fine, no need for CGI at all.....
     
    blueparukia, Mar 23, 2008 IP
  5. ECS Dave

    ECS Dave Active Member

    Messages:
    244
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #5
    The "way" that the originating page was/is being presented to the user appeared to prevent the php code from working "at all".

    Thanks again though!
    ECS Dave
     
    ECS Dave, Mar 23, 2008 IP