I Had\have 3 sites running off of one computer (one IP address) with separate noip's.. this is basically what I do (names\links removed so it doesn't appear that I am advertising)
CODE
<?php
$dir = Index2.php;
$sn = strtolower($_SERVER['SERVER_NAME']);
if(strpos($sn, "firstsite") !== false) {
$dir = "/firstdir/index.php";
} else if (strpos($sn, "secondsite") !== false) {
$dir = "seconddir/index.php";
} else if (strpos($sn, "thirdsite") !== false) {
$dir = "/thirddir/index.php";
}
header( 'Location: ' . $dir );
?>
This can be changed to use $_SERVER['HTTP_REFERRER'] and full URLs pretty easily.
You have the basic Idea down, but you are basically pitting
if ("something") { /*go here*/ }
"something" != 0, therefore is true. you NEED:
if($something == "something") { /* go here */ }
define your variable in EACH conditional statement... or make a bool function to handle that and use that for each condition.
for example:
CODE
function C($s) { if($s == $_SERVER['HTTP_REFERRER']) { return true; } else { return false; } }
if( C("first_url") || C("second_url") || C("third_url") ) {
//goto the secure location!
}
which may work better in your situation