I do have session_start() at the top of the page, and it still doesn't work. I switched the while() to a if(), and the same thing still happens. Here is my script from top to the bottom of the userpanel:
<?php
session_start();
// If not logged in, redirect to login.
if(!isset($_SESSION['uid'])){
header("Location: login");
}
?>
<?php
// Start Hit Counter
$c_ip = $HTTP_COOKIE_VARS["user_ip"];
$counter_file = "scripts/count.txt";
$counter_file_line = file($counter_file); if(!$c_ip) {
setcookie("user_ip", $REMOTE_ADDR, time()+360000); $counter_file_line[0]++;
$cf = fopen($counter_file, "w+");
fputs($cf, "$counter_file_line[0]"); fclose($cf);
}
elseif($c_ip != $REMOTE_ADDR){
$counter_file_line[0]++; $cf = fopen($counter_file, "w+");
fputs($cf, "$counter_file_line[0]");
fclose($cf);
}
// End Hit Counter
?>
<?php
// Include database connections.
include("scripts/config.php");
?>
<title>Association of Video Professionals Showcase - A Video Producers Portfolio</title>
<head>
<link rel="shortcut icon" href="favicon.ico"/>
<link rel="stylesheet" href="scripts/scripts?sid=2" type="text/css"/>
<script type="text/javascript" src="scripts/overlib.js"></script>
<script type="text/javascript" src="scripts/scripts?sid=1"></script>
<?php
// Start Browser Check Using Sessions
//If session variable browser is set, do nothing.
if($_SESSION["browser"] == "checked"){
}
// Else, implemement jscript browser check.
else{
$_SESSION["browser"] = "checked";
echo "<script type=\"text/javascript\">
if(navigator.userAgent.indexOf('Firefox')!=-1){
}
else{
if(confirm('You are using a internet browser other than Firefox. It is recomended that you use Firefox to view this website, for some elements may show up incorrect or not function at all. Click Ok to get the newest version of Firefox, or click cancel to hide this prompt.')== true){
changehref('http://www.mozilla.com/en-US/firefox/');
}
}
</script>
";
}
// End browser check.
?>
</head>
<body id="html">
<center><a href="http://avpshowcase.com/" title="Association of Video Professionals Showcase"><img src="images/header.png" alt="" border="0"/></a><br>
<div class="menu_back"><table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td class="menu_left"></td>
<td class="menu_middle">
<a href="index" title="Go to the Home page"><img src="images/home.png" alt="Home" border="0" title="Go to the Home page"/></a>
<a href="movies" title="Go to the Movie list"><img src="images/movies.png" alt="Movies" border="0" title="Go to the Movie list"/></a>
<a href="submit" title="Submit a Movie"><img src="images/submit.png" alt="Submit" border="0" title="Submit a Movie"/></a>
<a href="submissions" title="Edit, Delete, or View Movies you have submitted"><img src="images/submissions.png" alt="My Submissions" border="0" title="Edit, Delete, or View Movies you have submitted"/></a>
<a href="profile" title="Edit your Profile information"><img src="images/profile.png" alt="Profile" border="0" title="Edit your Profile information"/></a>
<a href="members" title="View a list of all registered Members and their Profiles"><img src="images/members.png" alt="Members" border="0" title="View a list of all registered Members and their Profiles"/></a>
<a href="register" title="Register as a Member"><img src="images/register.png" alt="Register" border="0" title="Register as a Member"/></a>
</td>
<td class="menu_right"></td>
</tr>
</table></div>
<!-- START MAIN TABLE asset -->
<table cellpadding="0" cellspacing="5" border="0" align="center">
<tr>
<td>
<div style="height:100%;">
<!-- START small TABLE asset -->
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="small_top"><center><br><?
if(isset($_SESSION['uid'])){
echo "User Panel";
}
else{
echo "Please Log In";
}
?></center></td>
</tr>
<td class="small_middle"><table align="center" border="0" cellpadding="0" cellspacing="0" width="140" height="100%"><tr><td><center><?php
// Start user panel
// If logged in, begin gathering info.
if(isset($_SESSION['uid'])){
// Get info on user from database where uid row in table is equal to session variable 'uid', set by the login.
$finduser=@mysql_query("SELECT * FROM members WHERE uid=" . $_SESSION['uid'] . "");
// Fetch the mysql data
$digit=mysql_fetch_array($finduser);
// Begin writing info.
if($digit){
// Define username
$myname = $digit['username'];
// The number of movies the user has submitted, in query form.
$mynumovies_query=@mysql_query("SELECT * FROM movies WHERE uid=" . $_SESSION['uid'] . "");
// The number of movies the user has submitted.
$mynumovies = mysql_num_rows($mynumovies_query);
// Welcome the User With His/Her Username
echo "Welcome, $myname<br><br>";
// If the number of movies is one, the end of "You have Submitted NUM Movie" will be singular.
if($mynumovies == 1){
$ender = ".";
}
// If it's not equal to 1, the ending is plural.
else{
$ender = "s.";
}
// Echo out how many movies the user has submitted.
echo "You have submitted $mynumovies Movie$ender<br>";
// Echo a link to view their profile.
echo "<a href=\"member?uid=$uid\" title=\"View Your Profile\">View My Profile</a><br>";
// Echo a link to edit their profile.
echo "<a href=\"profile\" title=\"Edit Your Profile\">Edit My Profile</a><br>";
// Echo a link to submit a movie.
echo "<a href=\"submit\" title=\"Submit a Movie\">Submit a Movie</a><br>";
// Echo a link to edit their submissions.
echo "<a href=\"submissions\" title=\"Edit, Delete, or View your Movie uploads\">My Submissions</a><br><br>";
// Echo a link to logout.
echo "Or <a href=\"logout\" onclick=\"return log_out();\" title=\"Logout Of AVP Showcase\">Logout</a>";
}
}
// If they aren't logged in and for some reason weren't re-directed, tell them they need to log in.
else{
echo "You Are Not Logged In, Please <a href=\"login\" title=\"Log In To AVP Showcase\">Log In.</a>";
}
?></center></td></tr></table></td>
<tr>
<td class="small_bottom"></td>
</tr>
</table>
<!-- END small TABLE asset -->