On Tue, Feb 26, 2008 at 10:56 AM, tedd <[EMAIL PROTECTED]> wrote:
>
> So, let's say I wanted script "secure.php" to be forced to use https
> -- do I use something like what Dan provided, namely?
>
> <?
> if($_SERVER['SERVER_PORT'] != '443') {
> $url = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] :
> $_SERVER['SERVER_NAME'];
> header("Location:
> https://".$url.$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']);
> exit;
> }
> ?>
>
> I know I could test the code for myself, but this is quicker.
>
>
Yep. Use that or: if ($_ENV["HTTPS"] == "off"). Daniel's code is port
specific, this one checks for HTTPS being on or off.
--
-Dan Joseph
"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."