I "DID" get it working but for some reason I didn't change anything, that I know of, and it doesn't work. I was sitting here and then I just closed I might have changed something but I don't know what is wrong now. It keeps getting "You are not logged in" when I click the "home" link to come back to this page, even if I"m on that page to begin with
<HTML>
<HEAD>
<TITLE> Admin - Add News </TITLE>
<link rel="stylesheet" href="stylesheet.css">
</HEAD>
<BODY>
<?
session_start();
//Include fuctions
require_once("functions.php");
db_connect();
//if not logged in already
if (!(isset($_SESSION['valid_user'] )))
{
//Get username and password
$username = $_POST['username'];
$password = $_POST['password'];
if($username && $password)
{
$query = "SELECT * FROM users WHERE username = '$username' and password = password('$password')";
$result = mysql_query($query);
if(!$result)
echo "Error running query";
$num_found = mysql_num_rows($result);
if($num_found > 0)
{
$valid_user = $username;
session_register('valid_user');
echo "You are logged in as: <b><i>";
echo $username;
echo "</i></b>";
?>
<br><br>
<TABLE align="left" border=0 cellspacing="20" width="100%">
<TR>
<td valign="top" width="20%">
<? display_sitelinks(); ?>
</td>
<td valign="top" width="*">
<div align=center>
Please choose a link to the left to add something to the site.
<br><br>
<IMG SRC="siteimages/avatar.gif" WIDTH="64" HEIGHT="64" BORDER="0" ALT="">
</div>
</td>
</TR>
</TABLE>
<?
}
else
{
echo "You are not logged in";
echo "<br>Please go <a href='login.html'>here</a> to login";
exit;
}
}
else
{
echo "You are not logged in";
}
}
else
{
//Display admin stuff
echo "You are logged in as: <b><i>";
echo $_SESSION['valid_user'];
echo "</i></b>";
?>
<br><br>
<TABLE align="left" border=0 cellspacing="20" width="100%">
<TR>
<td valign="top" width="20%">
<? display_sitelinks(); ?>
</td>
<td valign="top" width="*">
<div align=center>
Please choose a link to the left to add something to the site.
<br><br>
<IMG SRC="siteimages/avatar.gif" WIDTH="64" HEIGHT="64" BORDER="0" ALT="">
</div>
</td>
</TR>
</TABLE>
<?
}
?>
</body>
</html>