Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.