PDA

View Full Version : Wed detection and redirection



Phatty2x4
10-10-01, 04:58 PM
Does anyone know if this exists?

I have a web site - let's say for this example it's mysite.com

in mysite.com - i have 5 pages
1) the home page
2) the login page
3) the content pages (3 of them)

so it might look like this


3a)<----+


3b)<------------ (2) <------ (1)


3c)<-----+

is there a script that I can place in the content pages such that:
1) Will detect where a user is coming from
2a) If they are not coming from (2) the login page, they are redirected to the login page.
2b) if a user is coming from login page - they can access the content pages

so, if a user attempts to goto

mysite.com/3a.htm (for example) they will be redirected to
mysite.com/login.htm


Does something like this exist? Please tell this does exist!!!

Philip
10-11-01, 07:42 PM
Here are some options you have:

1. There are some ready scripts for password protecting pages and directories you could use...

2. You could simply password-protect the directory with the contents, via .htaccess ...

3. You can write your own script to do exactly what you want... You'd need to read some environment variables, I believe the one you need is "HTTP_REFERER". However, consider the following:
a. user goes to your contents page but he gets redirected back to your login page.
b. user reenters your contents' page URL...
c. user accesses your contents page wityhout any problem, since he's refered by the login page, regardles of wether he actually logs in.