Created
September 19, 2010 16:03
-
-
Save ritou/586865 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( isset($_REQUEST["done"]) && ($_REQUEST["done"] == "http" || $_REQUEST["done"] == "https") ){ | |
$toSecurepage = ( $_REQUEST["done"] == "https" ) ? true : false; | |
if($toSecurepage){ | |
quietredirector::redirection("https://r-weblife.sakura.ne.jp/php-quietredirection/test.php"); | |
}else{ | |
quietredirector::redirection("http://r-weblife.sakura.ne.jp/php-quietredirection/test.php"); | |
} | |
}else{ | |
print "error."; | |
} | |
class quietredirector{ | |
public static function redirection($url){ | |
$urlpart = parse_url($url); | |
if(isset($urlpart["scheme"])){ | |
if($urlpart["scheme"]=="https"){ | |
header("Location: ".$url); | |
}else{ | |
self::displayHtml($url); | |
} | |
} | |
} | |
private static function displayHtml($url){ | |
$html = <<<HTML | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<script language="JavaScript"> | |
<!-- | |
window.location.replace("$url"); | |
// --> | |
</script> | |
<meta http-equiv="Refresh" content="0; url=$url"> | |
</head> | |
<body> | |
<a href="$url">$url</a>へジャンプしようとしています。 | |
自動的にページが切り替わらない場合には、<a href="$url">こちら</a>をクリックしてください。</body> | |
</html> | |
HTML; | |
print $html; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment