note 71051 added to reserved.variables
| From: | me at tommygeorge dot com | Date: | Thu, 09 Nov 2006 16:59:02 +0000 |
| Subject: | note 71051 added to reserved.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119564@lists.php.net to get a copy of this message | ||
I'm sure this is elsewhere, but since 'chris dot chaudruc at gmail dot com' posted
his example, I thought I would share a quick function I use to force HTTPS protocol on a page,
without having to know the scripts name...
<?php
function ForceHTTPS()
{
if( $_SERVER['HTTPS'] != "on" )
{
$new_url = "https://" . $_SERVER['SERVER_NAME']
. $_SERVER['REQUEST_URI'];
header("Location: $new_url");
exit;
}
}
?>
Correct me if part of this doesn't work right. I've always used *nix based servers for
PHP, so I might not be aware of certain windows limitations. Thanks.
----
Server IP: 216.194.113.175
Probable Submitter: 199.82.243.73 (proxied: 199.81.66.52)
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.php
Edit -- https://master.php.net/note/edit/71051
Del: integrated -- https://master.php.net/note/delete/71051/integrated
Del: useless -- https://master.php.net/note/delete/71051/useless
Del: bad code -- https://master.php.net/note/delete/71051/bad+code
Del: spam -- https://master.php.net/note/delete/71051/spam
Del: non-english -- https://master.php.net/note/delete/71051/non-english
Del: in docs -- https://master.php.net/note/delete/71051/in+docs
Del: other reasons-- https://master.php.net/note/delete/71051
Reject -- https://master.php.net/note/reject/71051
Search -- https://master.php.net/manage/user-notes.php