Thanks.... I am now using the sessions (as i got VERY onfused with the whole $REMOTE_USER thing??)...
I now have a new problem!... I have created a login page (login.php) with a form. This puts the user's username and password into session vars ($SESSION[username] and $SESSION[password]) and checks the password for validity etc.
This works fine! I think, I have used this code to debug:
if(session_start()){
echo 'Session Started';
}
// Put $_POSTed vars into $_SESSION[].....
// Connect to DB etc...
if({password is correct}){
echo 'Logged in as ' . $_SESSION[username];
}
this always shows all the correct info!
Now, when I go to the index page, i have this code to check if a user is logged in:
// Do session stuff
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
header("Location: login.php");
}
else{
// Do everything
}
The trouble is, I am ALWAYS forwarded to login.php! I have tried header() forwarding to index.php when you are logged in (in login.php) but it just forwards to back!
I'm sure that this problem is easily solved (I have never used sessions before)...
Thanks