...

View Full Version : Only View Pages If Logged In



tomyknoker
02-15-2008, 12:04 AM
I am building a backend area on a website, which needs the user needs to be logged in to access... I have been able to make it so they login and then get re-directed to the page, but the individual pages can still be accessed directly by typing them into the browser... What would I need to put at the top of these page to stop that from happening?

Fumigator
02-15-2008, 12:06 AM
That's what sessions are for. Once a user logs in, you assign a value to a session variable and redirect. On the private page, the first thing you do is check that session variable and if it's missing, redirect to a public page, or display an error message.

tomyknoker
02-15-2008, 12:08 AM
Ok I'm not the greatest at php, any step by step you could tell me?

Fumigator
02-15-2008, 12:14 AM
Step 1 (http://www.google.com/search?hl=en&q=session+%2Bphp&btnG=Google+Search)

After you've spent a couple of hours on step 1, come ask about step 2.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum