Limiting access to a specific page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bmccon79
Forum Newbie
Posts: 4
Joined: Tue Nov 13, 2007 3:58 am

Limiting access to a specific page

Post by bmccon79 »

Hi,
I'm fairly new to PHP and was wondering what the best way (or if there even is one?) to limit the access to a specific page depending on the page that the person has come from? I've tried using the $HTTP_REFERER variable but have read that this is unreliable as it can be spoofed and that many browsers and firewalls bl;ock this information from being sent.
Any help would be appreciated greatly!
sunilbhatia79
Forum Newbie
Posts: 24
Joined: Sun Nov 11, 2007 9:37 pm
Location: Mumbai, India

Post by sunilbhatia79 »

A secure way would be to store his current visit in a single record in a database and keep updating it as and when he visits different pages... update the same record - dont insert new records for each page (unless you want to capture clickstream)...

Then on the page where you want to check his previous page, you can refer to the table where is old page that he visited is stored.

Hope this helps
sunilbhatia79
Forum Newbie
Posts: 24
Joined: Sun Nov 11, 2007 9:37 pm
Location: Mumbai, India

Post by sunilbhatia79 »

A secure way would be to store his current visit in a single record in a database and keep updating it as and when he visits different pages... update the same record - dont insert new records for each page (unless you want to capture clickstream)...

Then on the page where you want to check his previous page, you can refer to the table where is old page that he visited is stored.

Hope this helps
bmccon79
Forum Newbie
Posts: 4
Joined: Tue Nov 13, 2007 3:58 am

Post by bmccon79 »

Thanks for the suggestions but unfortunately the visitors are coming from another site on a different server so I don't think I can use the methods you've suggested.
This was why I was looking at using the $_HTTP[REFERER] variable so i would supply me with an URL i could then match up to allow access.
Any other suggestions?
sunilbhatia79
Forum Newbie
Posts: 24
Joined: Sun Nov 11, 2007 9:37 pm
Location: Mumbai, India

Post by sunilbhatia79 »

Can you provide me the code to look into... i see no reason why the REFERER variable won't work.
Post Reply