Re: redirect http to https

From: Date: Tue, 10 Apr 2007 09:23:57 +0000
Subject: Re: redirect http to https
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-252400@lists.php.net to get a copy of this message
<?php if($_SERVER['SERVER_PORT'] !== $encport || $_SERVER['HTTPS'] !== "on") {header("Location: https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);exit;} ?>
Very bad solution.
Don't just tell us it's bad, explain why (even with an RTFM or URL to look at)... nobody learns from an answer like this. The only thing I can think of is that $_SERVER variables can be compromised (ie you can't rely on them, they can be changed via curl or some other method). But that's just a guess. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#252400) next »