Jump to content

simple user logged in problem


quickstopman

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/54975-simple-user-logged-in-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.