X-Git-Url: https://dev.renevier.net/gitweb.cgi?p=syp.git;a=blobdiff_plain;f=api.php;fp=api.php;h=bb89c55d924e572ae048d443e89f739738683991;hp=9b268dcaf31beb8ac4bbc0e4e7b577c9d44909fc;hb=756e90840f47c110d346c863238375bb59a10475;hpb=bc6ff55fe2768cb38239e022a186bc47a9841b48 diff --git a/api.php b/api.php index 9b268dc..bb89c55 100644 --- a/api.php +++ b/api.php @@ -192,8 +192,14 @@ function setcookies ($user, $pwd) { // cookie will be valid for 2 weeks. I've chosen that value // arbitrarily, and it may change in the future. $time = time () + 14 * 60 * 24 * 60; - setcookie (sprintf ("%sauth", DBPREFIX), md5 ($pwd), $time, "" , "", false, true); - setcookie (sprintf ("%suser", DBPREFIX), $user, $time, "" , "", false, true); + if (version_compare (PHP_VERSION, '5.2.0', '>=')) { + setcookie (sprintf ("%sauth", DBPREFIX), md5 ($pwd), $time, "" , "", false, true); + setcookie (sprintf ("%suser", DBPREFIX), $user, $time, "" , "", false, true); + } else { + setcookie (sprintf ("%sauth", DBPREFIX), md5 ($pwd), $time, "" , "", false); + setcookie (sprintf ("%suser", DBPREFIX), $user, $time, "" , "", false); + } + } function check_auth ($con, $user, $pwd, $auth_only) {