Skip to content

Commit

Permalink
Switched to httpOnly cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Aug 8, 2017
1 parent 81146b4 commit c420e7d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion phpmyfaq/src/PMF/Session.php
Expand Up @@ -456,11 +456,18 @@ public function getLast30DaysVisits()
*/
public static function setCookie($name, $sessionId = '', $timeout = PMF_SESSION_EXPIRED_TIME)
{
$protocol = 'http';
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
$protocol = 'https';
}
return setcookie(
$name,
$sessionId,
$_SERVER['REQUEST_TIME'] + $timeout,
dirname($_SERVER['SCRIPT_NAME'])
dirname($_SERVER['SCRIPT_NAME']),
$protocol.'://'.$_SERVER['HTTP_HOST'],
('https' === $protocol) ? true : false,
true
);
}
}

0 comments on commit c420e7d

Please sign in to comment.