//$username = "******"; //$password = "******"; unset($arr); unset($errorLogin); $Loginflag = -1; //If password is wrong value = -1 else 0 $errorUsername = -1; $errorpwd = -1; $errorsetcookie = -1; $authent = new authentification(); $xmlhandler = new xmlhandler(); $userpwdarray = $authent->getuserpwd($username, "userdata.xml"); if ($userpwdarray['userflag']) { $errorUsername = 0; } if ($authent->verifypwd($password, $userpwdarray['password_hash'])) { $errorpwd = 0; } if ($errorUsername == 0 && $errorpwd == 0) { $_SESSION['username'] = $username; $Loginflag = 0; } if ($rememberlogin == 1 && $errorpwd == 0 && $errorUsername == 0) { //generate random cookie_ID to store on clients browser $cookiearray = $authent->Cookie_remember_code(); $username_hash = $authent->hash_sha256($username); $cookie = $username_hash . ":" . $cookiearray['cookie_ID_hash']; setcookie("rem", $cookie, time() + 60 * 60 * 24 * 30); //store unhashed cookie identifier in userdata if ($xmlhandler->set_rem_cookie($username, $cookiearray['cookie_ID'], 'userdata.xml')) { $errorsetcookie = 0;