Jump to content

Recommended Posts

What's wrong this this:

[code]<?php
if(isset($_SESSION[username]))  {
  echo "You are logged in as: <b>$_SESSION[username]</b>&nbsp;&nbsp;&nbsp;<input type='button' value='Log Out!' href='http://www.eliteguards.us/logout.php'>";
}
  else  {
  echo "<form action='http://www.eliteguards.us/login_check.php' name='login' method='post'>Username:<input type='text' name='username'>&nbsp;Password:<input type='password' name='password'>&nbsp;<input type='submit' value='Log In!'></form><br />";
}
?>[/code]

Darn those PHP white page errors!  >:(
Link to comment
https://forums.phpfreaks.com/topic/34456-session-checking/
Share on other sites

First of all: What you put as the key is a constant named 'username'. DO NOT DO THAT (I've seen that so many times). You need to encapsulate it in single or double quotes.

Now what the problem actually is, is that you have not run session_start() before trying to use sessions. A good idea is to place it at the top of your script.
Link to comment
https://forums.phpfreaks.com/topic/34456-session-checking/#findComment-162249
Share on other sites

Guest
This topic is now 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.