Jump to content

Login Confirmation Help


dch27

Recommended Posts

I have a form on a page to login ( www.simpleteam.net ). 

 

If the login is successful, I want the index.php to reload, a session started, and the form to be replaced with "Welcome - 'userName' : Logout"

 

Is it just if/else?  I tried that and i can't get it to work.  Can somebody give me an example.

 

Thanks a bunch.  I've been ripping my hair out.  I find login scripts everywhere but none include login confirmation.

Link to comment
https://forums.phpfreaks.com/topic/109624-login-confirmation-help/
Share on other sites

<?php
if($_SESSION['LoggedIn'] == 1) {
echo "Welcome ".$_SESSION['Username']." : <a href=\"logout.php\">Logout</a>";
} else {
// Show the login form, this is if the user is not logged in
}
?>

 

Session vars used in this:

$_SESSION['LoggedIn'] Values: 0 or 1

$_SESSION['Username'] Value: Populated with username at login

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.