note 43101 added to wrappers.http

From: Date: Wed, 09 Jun 2004 18:42:10 +0000
Subject: note 43101 added to wrappers.http
Groups: php.notes 
Request: Send a blank email to php-notes+get-70451@lists.php.net to get a copy of this message
I was trying to solve a problem on how to redirect the user to the same page but using HTTPS. After finding no examples, I wrote the following script which works and passes all the variables as well: //make sure we are using https, if not, redirect them to it if(!ISSET($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != "on") { //redirect page to https version $redirstr = "https://" . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"]; $first = true; //allow some special stuff to happen on the forst vcariable we add //copy over each variable into new redirect url foreach($_REQUEST as $k => $v) { if($first) //if furst time then copy a ? make instead of & { $redirstr .= "?"; $first = false; } else $redirstr .= "&"; echo "k=$k and v=$v\n"; $redirstr .= $k . "=" . $v; //copy over variable and value } //build javascript redirect echo "<script language=\"javascript\"> location.replace(\"" . $redirstr . "\"); </script>"; exit(); //make sure we dont do any more processing since redirecting } ---- Manual Page -- http://www.php.net/manual/en/wrappers.http.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43101 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43101&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43101&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#70451) next »