Login - Does not want to redirect
<p><strong>SOLVED: There was a stupid mistake which caused this problem. In header.php i wrote $_SESSION["header"] (which doesnt even exist) instead of $_SESSION["logged"]. Thanks to everyone for your help.</strong></p>

<p>Login.php does not want to redirect after i enter correct login information.</p>

<p>The page just refreshes and clears the input fields. </p>

<p>(Also the session is created in /tmp folder )</p>

<p>Does anyone have any ideas? :S </p>

<p>Thanks in advance! :)</p>

<p><strong>login.php:</strong></p>

<pre><code>&lt;?php

$message = NULL;

if (isset($_POST["enter"])) {

    include 'cred.php';
    $newUser = $_POST["user"];
    $newPass = md5($_POST["pass"]);

  if ($newUser==$user AND $newPass==$pass) {

    session_start();
    $_SESSION["logged"]=1;
    $_SESSION["user"]=$newUser;
    header('Location: index.php');
    exit;

  } else {

    $message = 'failure';

  }

}



?&gt;
&lt;head&gt;
&lt;style type="text/css"&gt;

body {

    margin-top:120px;

}

&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;center&gt;
&lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" enctype="multipart/form-data"&gt;
Uporabnik:&lt;br /&gt; &lt;input type="text" name="user" /&gt;&lt;br /&gt;&lt;br /&gt;
Geslo:&lt;br /&gt; &lt;input type="password" name="pass" /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;input type="submit" value="submit" name="enter"/&gt;&lt;br /&gt;&lt;br /&gt;
&lt;?php if($message!=NULL) {echo $message;} ?&gt;
&lt;/form&gt;
&lt;/center&gt;
&lt;/body&gt;
</code></pre>

<p><strong>cred.php:</strong></p>

<pre><code>&lt;?php

$user = 'janeznovak';
$pass= md5('greek123');

?&gt;
</code></pre>

<p><strong>EDIT :</strong> Added the header.php file, which is part of every (index.php, second.php, third.php) page. Maybe the problem lies here:</p>

<pre><code>&lt;?php

session_start();

if(!isset($_SESSION["header"])OR $_SESSION["header"]!=1){

    header('Location: login.php');
    exit;


} else {

    $nuser = $_SESSION["user"];
}


?&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
&lt;a href="index.php"&gt;Prva&lt;/a&gt; | 
&lt;a href="second.php"&gt;Druga&lt;/a&gt; | 
&lt;a href="third.php"&gt;Tretja&lt;/a&gt; | 
&lt;a href="logout.php"&gt;Logout&lt;/a&gt; | 
Prijavljeni ste kot &lt;?php echo $nuser; ?&gt;
&lt;/div&gt; 
</code></pre>
