hi there,
got a (I guess...) very simple problem:
I want to set a session within a function. Simple situation:
I got a login form. After subimitting the form, I call a function "login" which checks if user has authenticated. If yes, a session should be set.
Here some very simple code:
session_start();
function login() {
$SESSION['login'] = true;
}
if (isset($_REQUEST['doLogin'])) {
login();
// is session is set here, it works...
}
if ($SESSION['login'] === true) echo 'you are logged in';
But this doesn't work. Why? Thanks alot!