well if i change that it works in the page itself but not if i link to another page when the session stays open example:
first page (login.php):
<?php
session_start();
if (!empty($POST)){
$SESSION["username"] = $POST["username"];
$SESSION["wachtwoord"] = $POST["wachtwoord"];
header("Location: geheim.php");
}
?>
<html>
<body>
<form name="form1" method="post" action="<?php echo($SERVER["PHP_SELF"]);?>">
login: <input name="username" type="text"><br>
pass: <input name="wachtwoord" type="password"><br>
<input type="submit" name="Submit" value="Inloggen">
</form>
</body>
</html>
second page(geheim.php):
<?php session_start(); ?>
<html>
<body>
<?php
if (isset($SESSION["username"])){
echo("<h2>Permission granted; username :" .
$SESSION["username"] ."</h2>");
echo("and pass : ". $_SESSION["wachtwoord"]);
echo("<br><a href=\"logout.php\">Uitloggen</a>");
}else{
echo("<h2>Not logged in.;<br>U can login
<a href=\"login.php\">here</a>");
}
?>
</body>
</html>
I always get the message that he isn't logged in.
What am I doing wrong?