-function cookie_hash($user) {
- return(hash("sha256", get_config("system", "site_prvkey").
- $user["uprvkey"].
- $user["password"]));
-}
-
-function new_cookie($time, $user = array()) {
-
- if ($time != 0)
- $time = $time + time();
-
- if ($user)
- $value = json_encode(array("uid" => $user["uid"],
- "hash" => cookie_hash($user),
- "ip" => $_SERVER['REMOTE_ADDR']));
- else
- $value = "";
-
- setcookie("Friendica", $value, $time, "/", "",
- (get_config('system', 'ssl_policy') == SSL_POLICY_FULL), true);