You cannot set cookies for HTTP and HTTPS at the same time. You need to set two separate cookies: one for HTTP and one for HTTPS:
setcookie("login", base64_encode($email."::".md5($password)), 2840184012, "/", ".example.com");
setcookie("login", base64_encode($email."::".md5($password)), 2840184012, "/", ".example.com", true);
This only works if you set a cookie at https://secure.example.com , since you can set secure cookies via HTTPS.
Oh, and by the way: Do not store authentication information in a cookie! Use a valid validation token instead.
Gumbo source
share