Allowing access only if valid referer ?

They have: 3 posts

Joined: Mar 2002

Hi,

I need to restrict access to a certain part of my site.

Basicly i want everyone to visit page A before being able to goto page B.

Someone told me this may be possible with htaccess ? .but i ain't sure how.

Any idea's ?

Thx
Vis

Busy's picture

He has: 6,151 posts

Joined: May 2001

not sure about the htaccess, but you could just do an if statement

if ($HTTP_REFERER == "the page you want to come from"){
//load page
} else {
//redirect
}

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

A sinister little side note:

Just last night I wrote a script that fakes HTTP Request headers to get around anti-leaching scripts. Laughing out loud

I have a framed interface. The top frame has a form which has (among other goodies) a textbox for the item to pull (or steal), and a textbox for the referer to fake. Clicking submit causes some javascript to redirect the bottom from to a PHP script I have on my server. The PHP script then creates some fake HTTP Request headers, downloads the specified source, then rebuilds it's own headers, and finally sends the content to the bottom frame. I've tested it on HTML documents and images.

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.