PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
session_start();
echo "<font size=1 face=Verdana color=#CCCCCC>Welcome ". $_SESSION['first_name'] ." ". $_SESSION['last_name'] .". You are now signed in.</font><br /><br />";
What I need is for this script to be applied if the user is signed in. If they are not signed in I need it to say that they arent signed in. So I think it needs an 'else' php term. But I am a beginner to PHP.
Is there any chance that anyone can show me what I need to do?
<?php
if(!empty($_SESSION['firstname'])){
echo "<font size=1 face=Verdana color=#CCCCCC>Welcome ". $_SESSION['first_name'] ." ". $_SESSION['last_name'] .". You are now signed in.</font><br /><br />";
}else
{
echo "<font size=1 face=Verdana color=#CCCCCC>Please sign in.</font><br /><br />";
//or redirect to log in screen or whatever you want to do
}
?>
But I would do something in the log in script like set a $_SESSION[loggedin'] boolean to check rather than the firstname
Well when you login on the login page, it uses checkuser.php against the db.
The whole point of the this script I want is to go at the top so it would say Welcome name name, you are signed in, when you have signed in. And if you are logged out it would say please sign in, or register here