quickstopman Posted June 10, 2007 Share Posted June 10, 2007 i have a page that has multi actions but when it checks to see if your logged in it doesn't check it i don't know why when you logout then go to the main page your still in the welcome message but your name is blank here is the code <? ob_start(); session_start(); require 'config.php'; if (isset($_GET['action']) && $_GET['action'] == 'login') { if (isset($_GET['error']) && $_GET['error'] == 'login') { ?> <font color="red">Wrong Email or Password!</font> <form action='login.php' method='POST'> Username: <input type='text' name='email' class='words'><br> Password: <input type='password' name='password' class='words'><br> <input name='login' type='submit' value='Submit' class='words'><br> Not <a href="?action=register">registered</a>? </form> <? } else { ?> <form action='login.php' method='POST'> Username: <input type='text' name='email' class='words'><br> Password: <input type='password' name='password' class='words'><br> <input name='login' type='submit' value='Submit' class='words'><br> Not <a href="?action=register">registered</a>? </form> <? } } else if (isset($_GET['action']) && $_GET['action'] == 'register') { if (isset($_GET['message']) && $_GET['message'] == 'welcome') { echo "Thanks for Registering! <br> You can now login <a href='?action=login'>here</a>"; } } else if (isset($_GET['action']) && $_GET['action'] == 'home') { if (isset($_SESSION['username'])) { header("Location:index.php?action=login"); } else { echo "welcome back ". $_SESSION['knickname'] ."!"; } } else if(isset($_GET['action']) && $_GET['action'] == 'editprofile') { } else if(isset($_GET['action']) && $_GET['action'] == 'logout') { require 'logout.php'; } else { header("Location:index.php?action=home"); } ?> thanks Quote Link to comment https://forums.phpfreaks.com/topic/54975-simple-user-logged-in-problem/ 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.