GameYin Posted April 29, 2008 Share Posted April 29, 2008 Hello Dunno if sessions are working for me. I have session_start(); on both. Can someone help? I don't know if sessions are setting since my next code following this won't work. http://www.phpfreaks.com/forums/index.php/topic,194777.0.html Noone would respond there :-\ ??? <?php session_start(); include 'config.php'; $user = $_POST['username']; $pass = $_POST['password']; $query = mysql_query("SELECT * FROM Users WHERE Username = '$user' AND Password = '$pass' LIMIT 1") or die(mysql_error()); $row = mysql_fetch_array($query); if($user != "" && $pass != "" || mysql_num_rows($query) > 0 || $row['Activated'] > 0) { $_SESSION["status"] = "Logged"; $_SESSION['username'] = $user; $_SESSION['password'] = $pass; header("Location: index.php"); exit; } else { $_SESSION["status"] = "Not logged"; $_SESSION['username'] = Guest; echo "Something went wrong"; } ?> I have this on index.php to see if session is working. How would I go about echoing the session username? <? if (empty($_SESSION['username'])) { ?> blah ez <? }else{ ?> blah kewl <? } ?> Quote Link to comment https://forums.phpfreaks.com/topic/103463-session-echo/ Share on other sites More sharing options...
dezkit Posted April 29, 2008 Share Posted April 29, 2008 session_destroy() ? Quote Link to comment https://forums.phpfreaks.com/topic/103463-session-echo/#findComment-529809 Share on other sites More sharing options...
GameYin Posted April 29, 2008 Author Share Posted April 29, 2008 Why would I have session_destroy in my code? Quote Link to comment https://forums.phpfreaks.com/topic/103463-session-echo/#findComment-529812 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.