X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fsecurity.php;h=05371f71ca55d1a44559480ffc2c350197cc3add;hb=85144908fa9cf12594b568f4f0b2d37fa21b6be1;hp=93df6ff2553266aca0d8f99011d26e6def9d3900;hpb=df6304cc423db5efceedfa4a523425e011f65d96;p=friendica.git diff --git a/include/security.php b/include/security.php index 93df6ff255..05371f71ca 100644 --- a/include/security.php +++ b/include/security.php @@ -21,15 +21,18 @@ function cookie_hash($user) { */ function new_cookie($time, $user = array()) { - if ($time != 0) + if ($time != 0) { $time = $time + time(); + } - if ($user) + if ($user) { $value = json_encode(array("uid" => $user["uid"], "hash" => cookie_hash($user), "ip" => $_SERVER['REMOTE_ADDR'])); - else + } + else { $value = ""; + } setcookie("Friendica", $value, $time, "/", "", (get_config('system', 'ssl_policy') == SSL_POLICY_FULL), true); @@ -52,7 +55,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive $a->user = $user_record; if($interactive) { - if($a->user['login_date'] === '0000-00-00 00:00:00') { + if ($a->user['login_date'] <= NULL_DATE) { $_SESSION['return_url'] = 'profile_photo/new'; $a->module = 'profile_photo'; info( t("Welcome ") . $a->user['username'] . EOL); @@ -141,9 +144,6 @@ function authenticate_success($user_record, $login_initial = false, $interactive new_cookie(604800, $user_record); unset($_SESSION['remember']); } - else { - new_cookie(0); // 0 means delete on browser exit - } }