// 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) {
header ('Location: index.php');
}
-setcookie (sprintf ("%sauth", DBPREFIX), "", time () - 3600, "" , "",false, true);
-setcookie (sprintf ("%suser", DBPREFIX), "", time () - 3600, "" , "",false, true);
+if (version_compare (PHP_VERSION, '5.2.0', '>=')) {
+ setcookie (sprintf ("%sauth", DBPREFIX), "", time () - 3600, "" , "",false, true);
+ setcookie (sprintf ("%suser", DBPREFIX), "", time () - 3600, "" , "",false, true);
+} else {
+ setcookie (sprintf ("%sauth", DBPREFIX), "", time () - 3600, "" , "",false);
+ setcookie (sprintf ("%suser", DBPREFIX), "", time () - 3600, "" , "",false);
+}
header ('Location: index.php');
?>