<?php
function httpscheck($url = '')
{
if($_SERVER['HTTPS'] != "on" || $_SERVER['HTTP_PORT'] != 443)
{
if(strlen($url) == 0)
{
$url = $_SERVER['REQUEST_URI'];
}
if(headers_sent())
{
trigger_error('SSL redirect failed as HTTP headers were previously sent to the browser', E_NOTICE);
}
else
{
die(header('Location: ' . $url));
}
}
}
Easy way to check if HTTPS / SSL is being loaded (PHP)
Comments On This Entry
I'm out of league here. Too much brain power on dpislay!
Vinnie @ 08:54:11 AM, Sunday, October 23, 2011