Page 1 of 1

session include file

Posted: Mon Feb 24, 2003 9:13 pm
by theclay7
hi, i am going to write a session check include file to put it into pages that needed to be in logon mode. Therefore, I need to have an include file to check if the user is already logon.

how do i write this include file using session?

:roll:

Posted: Mon Feb 24, 2003 9:39 pm
by Mr. Tech
So when someone logs on you put on a cookie so it remembers their username and password?

If so make a file called something like authcheck.php, include it into all your "protected" files and in it add something like:

Code: Select all

<?php
if (!$username == "username" && !$password =="password") {
header("location: login.php");
}
else {
// No probs! You're logged in!
}
?>
Hope this helps!

Posted: Mon Feb 24, 2003 10:24 pm
by theclay7
thanks...
but how does this page get the parameter username and passwd???

is there a way that I can use Session control?

say if i want to view 1.php to 2.php, but the content of 2.php is restricted to logon user...how do i keep his session and use session?

i am new to session...

Posted: Mon Feb 24, 2003 10:32 pm
by Mr. Tech
What do you have on your login page?