JasperHope Posted April 17, 2010 Share Posted April 17, 2010 I need to know who the user is, so I have this running when the user types a password: <?php if ( htmlspecialchars($_POST['password']) == 'Password'){ $_SESSION['userid'] = "Admin"; header('Location: http://www.example.com'); } ?> It redirects you to this: <?php session_start(); if ($_SESSION['userid'] == "Admin") { echo "You are Admin"; } else { echo "You are not Admin"; } ?> However, it returns: "You are not Admin". Any suggestions ? Link to comment https://forums.phpfreaks.com/topic/198847-session-help/ Share on other sites More sharing options...
Pikachu2000 Posted April 17, 2010 Share Posted April 17, 2010 Do you have a session_start() in the first script as well? If not, it needs to have it. You can always print_r($_SESSION) to see if it has the values you would expect it to have, also. Link to comment https://forums.phpfreaks.com/topic/198847-session-help/#findComment-1043746 Share on other sites More sharing options...
JasperHope Posted April 17, 2010 Author Share Posted April 17, 2010 Thank you! That worked. Link to comment https://forums.phpfreaks.com/topic/198847-session-help/#findComment-1043770 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.