Vivid Lust Posted July 18, 2008 Share Posted July 18, 2008 Hi! This doesn't seem to be working ??? <?php $x = $_POST['user']; $y = $_POST['pass']; $a = "admin"; $b = "123"; if ($x == $a && $y == $b){ $_SESSION['admin'] = $y; header("Location:*****/admin/"); } else{ header("Location:******/admin.php"); } ?> <?php session_start(); if(isset($_SESSION['admin'])) echo "<a href=logout.php>Log Out</a>"; else{ echo "<br>"; } ?> The problem is, is that when the script finds that the username and password combination is correct and directs to the admin/index.php it always shows the "echo "<br>"; so therfore it doesnt recognise the session!! Please help Thanks in advanced Link to comment https://forums.phpfreaks.com/topic/115392-solved-sessions-help/ Share on other sites More sharing options...
Orionsbelter Posted July 18, 2008 Share Posted July 18, 2008 first thing you should do is make your viarable more descriptive Link to comment https://forums.phpfreaks.com/topic/115392-solved-sessions-help/#findComment-593219 Share on other sites More sharing options...
Orionsbelter Posted July 18, 2008 Share Posted July 18, 2008 session_register('admin'); $_SESSION['admin'] = $y; try that! tell me if it works Link to comment https://forums.phpfreaks.com/topic/115392-solved-sessions-help/#findComment-593221 Share on other sites More sharing options...
Vivid Lust Posted July 18, 2008 Author Share Posted July 18, 2008 It works now!, Thanks! Link to comment https://forums.phpfreaks.com/topic/115392-solved-sessions-help/#findComment-593223 Share on other sites More sharing options...
Orionsbelter Posted July 18, 2008 Share Posted July 18, 2008 No worries, just remember you need to register each season that was the function to register the session Link to comment https://forums.phpfreaks.com/topic/115392-solved-sessions-help/#findComment-593242 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.