i have a login form:
<form method =POST action="/login.php">
...
</form>
i would like the login.php
page to redirect to using https
.
i don't want to send the user to https://.../login.php
because they might change the link. but i want to do a redirect on the server side before i parse the login form data and log the user in.
i found and example:
if($_SERVER["HTTPS"] != "on") {
header("HTTP/1.1 301 Moved Permanently");
header("Location: "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
exit();
}
but i don't have $_SERVER["HTTPS"]
if i var_dump($_SERVER);
i do have $_SERVER['SERVER_PORT']
witch is 80.
any ideas?
Thanks