I have a PHP page called adminConnect.php, it has a session start as its first line, some includes and some functions. One of those functions is "ValidateLogin()", it will auto redirect the user to the homepage when the user does not have any sessions.

Here is the weird problem: Less then 1% of the time (when the page changes) my ValidateLogin wont detect the session and will redirect me to the homepage. If I hit back the page will load fine (the same function will be called) and ill be able to continue using my system.

Here is the start of the function that kicks me out < 1% of the time (ive confirmed it with the error_log line):

Here is the function (the echo should never be seen)
if (!(isset($_SESSION['csmsConnected'])))
			error_log("csmsConnected session not set trigged. It should of auto redirected the user to the home page");
			echo('<br/><h1 style="text-align: center">Error, you must be logged in to view this page.</h1>'); // user should never see this
			header('Location: login.php');
Ideas? Between it appearing to happen randomly + it happening so few times I haven't been able to figure this one out. Its almost like my session_start(); isn't registering.