jo: SESSION username setzen

Beitrag lesen

Ich probiere $_SESSION['username'] zu setzen. Ich sehe, dass ich ein Cookie mit password habe, aber keines mit username.

Hier ein Auszug aus dem Login Script:

if ($_POST['Submit']=='Login')  
{  
$md5pass = md5($_POST['password']);  
$sql = ("SELECT userid,username,password FROM users WHERE  
            username = '".$_POST['username']."' AND  
            password = '".$md5pass."'  
   AND user_activated='1'");  
  
$result = mysql_query($sql) or die (mysql_error());  
$num = mysql_num_rows($result);  
$fetch = mysql_fetch_object($result);  
$userid = $fetch->userid;  
$username = $fetch->username;  
  
  
    if ( $num != 0 ) {  
        // A matching row was found - the user is authenticated.  
    list($userid,$password,$username) = mysql_fetch_row($result);  
  
    // this sets variables in the session  
    setcookie('userid', $userid, strtotime("+1 month"));  
    setcookie('password', $md5pass, strtotime("+1 month"));  
    setcookie('username', $username, strtotime("+1 month"));  
 $_SESSION['username']= $username;  
 $_SESSION['password']= $md5hash;  
 $_SESSION['userid']= $userid;  
  
  
...  
}