View Full Version : Login echo array

08-26-2012, 05:41 AM
I have this in my website using it in my chat. I recommend it if you have a login system. and need to see if a user is or isnt logged in

if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
echo '<h4>You are not logged in. Please do so <a href="http://jays.netne.net/loginsystem/login.php">Login</a></h4>'; }

else {
echo "<h4>You are logged in </h4>";

08-26-2012, 06:37 AM
The problem with this though is you will echo out text before any DOCTYPE in your HTML because a session_start() needs to be called be any headers. It might be better to just setup a string with the message and then print it out later in the body of your HTML.