Code: Select all
if (($active == 1) && ($powerlevel == 4)){
$_SESSIONї'user'] = $_POSTї'user'];
$_SESSIONї'powerlevel'] = $powerlevel;
$_SESSIONї'active'] = $active;
print("<br><div align="center">You have been authorized to work in the admin area, redirecting in 5 seconds...
<script type="text/javascript" src="http://www.bolt3.com/redirect.js"></script>
<script type="text/javascript">
var redirect = new Redirect("http://admin.bolt3.com/admin.php");
redirect.delay(5);
redirect.write();
redirect.go();
</script>
<br>
<a href="http://admin.bolt3.com/admin.php"> Click here to go to the Admin section immediately</a></div><br>");
} else {
print("You are not authorized to view this area.");
}This is my code for a login I'm trying to make (an Admin login) and this page is fine. It works and I can login if I have the right power level.
Thing is, I set the SESSION variables in this code as you can see and when it redirects to the admin page.. I want to make sure the person just didnt type in the admin url so I recheck to see if SESSION powerlevel is 4, if it isnt they dont get access.
It doesn't seem to be working though. I tried to go $user = $_SESSION['user']; to see if it's setting and I put $user on a page but it displays nothing.
So what am I doing wrong? I remember something about a startsession.
Basically when they login I want it to remember these 3 variables on all pages but not using cookies using sessions.
Thanks.