Mief: $_SESSION wird nach header("Location: ...") gelöscht

Beitrag lesen

Ich poste einfach mal meinen ganzen Code:

Nicht wundern!! Das ist beides die gleiche Datei!!

PHP-Teil~~~php <?php
session_start();
$_SESSION = array();
$t1=".";
if(isset($_POST["name"]) && isset($_POST["passwort"])){
    $user_data=simplexml_load_file($t1."/admin/data/user.xml");

for($i=0;$i<count($user_data->user);$i++){
        if($user_data->user[$i]["name"]==$_POST["name"]){
            if(md5($_POST["passwort"])==$user_data->user[$i]["passwort"]){
                $_SESSION["user_name"]=$user_data->user[$i]["user_name"];
                header("Location: admin");
            }else{
                header("Location: ./");
            }
        }
    }
}
?>

HTML-Teil~~~html
<!DOCTYPE html>  
<html>  
    <head>  
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />  
        <meta name="HandheldFriendly" content="True">  
        <meta name="MobileOptimized" content="320">  
        <meta http-equiv="cleartype" content="on">  
        <title>CMS - Login</title>  
    </head>  
    <body>  
        <h1>Login</h1>  
        <form method="post" action="./">  
            <table border="0">  
                <tr>  
                    <td>Name:</td><td><input type="text" name="name" /></td>  
                </tr><tr>  
                    <td>Passwort:</td><td><input type="password" name="passwort" /></td>  
                </tr>  
                <tr>  
                    <td colspan="2"><button type="submit" style="width:100px">Login</button></td>  
                </tr>  
            </table>  
        </form>  
    </body>  
</html>