So apparently my client has a secure server.. I have no idea how to utilize that. We're taking social security numbers, so it's a big deal that it is secure.
How do I make a page a HTTPS instead of a regular ol' HTTP?
HTTPS
Moderator: General Moderators
- SheDesigns
- Forum Commoner
- Posts: 42
- Joined: Tue Nov 18, 2008 9:51 am
- Location: Buffalo, NY
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: HTTPS
Mostly things are handled by the server. Not much to do with PHP. You have to ensure that the page is loaded in HTTPS, for instance:
That form will be forced to load in HTTPS.
Code: Select all
<?php
function force_ssl()
{
if ($_SERVER['SERVER_PORT'] != "443") // HTTPS
{
$url = "https://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING'] : '');
header("Location: $url");
exit;
}
}
force_ssl();
echo <<<HTML
<form method="post">
<input type="text" />
</form>
HTML;
?>- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: HTTPS
Yes. Just remember that on IIS through ISAPI, the value is "off" in case the connection is not HTTPS.arjan.top wrote:you have $_SERVER['HTTPS'] too