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 <? } ?> 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() ? 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? Link to comment https://forums.phpfreaks.com/topic/103463-session-echo/#findComment-529812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.