Admin panel is not working due to session
<p>Sudden my website admin panel no longer works and i've tired many ways to edit it and all are faild.</p>

<p>Please show me where the error should be</p>

<p><strong>Database</strong></p>

<pre><code>CREATE TABLE `egadmin` (
`AdminID` int(10) NOT NULL auto_increment,
`username` varchar(50) NOT NULL default '',
`password` varchar(50) NOT NULL default '',
PRIMARY KEY  (`AdminID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

INSERT INTO `egadmin` VALUES (1, 'admin', 'pass');
</code></pre>

<p><strong>conn.php [connection file]</strong></p>

<pre><code>&lt;?php
$db_host = "localhost";
$db_username = "root";
$db_password = "mypass";
$db_name = "dbname";
$connection = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error());
$db = mysql_select_db($db_name, $connection);
?&gt;
</code></pre>

<p><strong>index.php [Login Form]</strong></p>

<pre><code>&lt;form action="validate.php" method="post"&gt;
ID &lt;input type="text" name="userid" id="userid" /&gt;
Password &lt;input type="password" name="password" id="password" /&gt;
&lt;input type="submit" name="submit" value="Submit" /&gt;
&lt;/form&gt;
</code></pre>

<p><strong>validate.php [Login form send it to validate.php]</strong></p>

<pre><code>&lt;?php
require_once("conn.php");

$user = $_POST["userid"];
$pass = sha1($_POST["password"]);

$query = "SELECT * FROM egadmin WHERE username = '$user' AND password = '$pass'";
$result = mysql_query($query);

if (mysql_fetch_row($result)) {
  session_start();
  header("Cache-control: private");
  $_SESSION["access"] = "granted";
  header("Location: secure.php");
} else
  header("Location: index.php");
?&gt;
</code></pre>

<p><strong>secure.php [Should be the protected file]</strong></p>

<pre><code>&lt;?php
session_start();
header("Cache-control: private");
if ($_SESSION["access"] == "granted")
echo "blah blah blah";
else
header("Location: index.php");
?&gt;
</code></pre>

<p><em><strong>The problem</em></strong></p>

<p>every time i enter correct login informations (username,password) it keep resend me to login form (index.php) so it looks like it can not create $_SESSION at all.</p>

<p>Any help please how to fix it or why that error</p>

<p>Note : PHP Version 5.2.17 | register_globals = On (also not working if it Off)</p>
