I'm a newbie to PHP, so this may just be a configuration issue.
I have a small sample application that I'm using to learn PHP and the use of sessions. At the top of each page I have:
.... // code...
I'm experiencing two problems:
(1) If I set a varaible into session, I can change the value of that variable on while on the same page that created the variable, however, changes to that variable are not visible once I get to another page - I can only see the original value that was set.
(2) my login page first clears prior session values with session_unset() then reinitializes session with session_start(). I can enter an ID and password that are posted to the main.php page. On main, I have:
// authenticate the user
if (( $_POST['user']=='myuserid') AND ($_POST['pass']=='12345'))
// valid user
// invalid user
echo "access denied";
This page work just fine if I don't provide the right credentials. If I login correctly, it also works fine. But then, if I go back to the login.php page and enter invalid ID or PW... I can still access the next page - the "valid user" portion of the if block gets excuted, even though the conditional test should have failed.
Please help! I'm trying to make the transition from JSP/Java to PHP, and what I'm running into should be easy to do, but is proving to be a real roadblock!