From 00e4e0294f36f8e4a0c5926efdc16b31fcb4c788 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 11 Aug 2011 16:31:25 +0200 Subject: Use secure and httponly session cookies As discussed on the mailing list, enable "secure" and "httponly" for session cookies to prevent them from being transferred over insecure connections. Signed-off-by: Lukas Fleischer --- web/lib/aur.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/lib/aur.inc.php') diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php index 474ebee..f432697 100644 --- a/web/lib/aur.inc.php +++ b/web/lib/aur.inc.php @@ -47,7 +47,7 @@ function check_sid($dbh=NULL) { # clear out the hacker's cookie, and send them to a naughty page # why do you have to be so harsh on these people!? # - setcookie("AURSID", "", 1, "/"); + setcookie("AURSID", "", 1, "/", null, !empty($_SERVER['HTTPS']), true); unset($_COOKIE['AURSID']); } elseif ($failed == 2) { # session id timeout was reached and they must login again. @@ -56,7 +56,7 @@ function check_sid($dbh=NULL) { $q.= mysql_real_escape_string($_COOKIE["AURSID"]) . "'"; db_query($q, $dbh); - setcookie("AURSID", "", 1, "/"); + setcookie("AURSID", "", 1, "/", null, !empty($_SERVER['HTTPS']), true); unset($_COOKIE['AURSID']); } else { # still logged in and haven't reached the timeout, go ahead -- cgit v1.2.3-54-g00ecf