note 12891 deleted from function.getenv by sander
| From: | sander@php.net | Date: | Sun, 07 Apr 2002 12:43:43 +0000 |
| Subject: | note 12891 deleted from function.getenv by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-28900@lists.php.net to get a copy of this message | ||
Here's a little bit of code to force a script to only be viewed using a secure connection.
This avoids people who know where the script is from typing in the URL and forgetting that it should
be secure:
$thispathfull = getenv(SCRIPT_URI);
$thispath = substr($thispathfull,0,5);
if(strcmp($thispath, "http:")==0)
{
$thispathend = substr($thispathfull, 5);
header ("Location: https:$thispathend");
exit;
}