HTTP_REFERE 取得進入本頁之前的網址
可以用來確認是否在本頁按下登入等
$protocol = isset($_SERVER["HTTPS"]) ? 'https' : 'http';
$thisurl = $protocol.'://'. $_SERVER["SERVER_NAME"]. $_SERVER["REQUEST_URI"];
if (isset($_SERVER['HTTP_REFERER'])) {
if ($thisurl == $_SERVER['HTTP_REFERER']) {
echo 'Enter in this page';
else
echo 'from'.$_SERVER['HTTP_REFERER'];
} else {
echo 'Direct going to here';
}
echo "
";
沒有留言:
張貼留言