how do i write this include file using session?
session include file
Moderator: General Moderators
session include file
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?

how do i write this include file using session?
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:
Hope this helps!
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!
}
?>