Session

zenon80983

New Member
Messages
43
Reaction score
0
Points
0
Hi i have been searching google for a few days now and have been trying to get help from a website that i know of that helps under the website design catagory in the forums and seems no one is able to help so im going to try here.

I have a members only website area and the login works and all of that but i need a script that allows registered and logged in users to view the content of that page and when a user who is not logged in trys to access the page they get redirected back to the index page.

can anyone tell me a script to do this or make one???

please help i cannot continue with my member system until this problem is solved.

and please dont suggest Cookies because they dont work i have already tried it.
 

khopcraft77

New Member
Messages
80
Reaction score
0
Points
0
If cookies don't work for you, then either a) you are doing it wrong, or b) you have it disabled. Its probably a. I recommend looking up a tutorial on cookies because there a great way to do member stuff.
 

cybrax

Community Advocate
Community Support
Messages
764
Reaction score
27
Points
0
This tutorial should help with the basics...

http://www.tizag.com/phpT/phpsessions.php


Cookies of course would be the simpler way to do it, but some folk are overly paranoid about them and as a result block them as a matter of course. So using session to pass this tempory information is one of the few alternatives.
 
Last edited:

arradia

New Member
Messages
5
Reaction score
0
Points
0
you'd need to set a session variable - for example -

$_SESSION['valid_login'] = true

then test for it each page:

if(!$_SESSION['valid_login'])
{
header('Location:index.htm')
}

you need to put session_start() at the top of each page you want to use session variables on.
 
Top