在移动设备上重定向页面不会重定向

时间:2013-08-19 14:50:33

标签: php redirect mobile verification

好的,所以我有maconbeercompany.com,它有一个年龄验证重定向。它适用于IE,Chrome,Safari和Firefox。唯一的问题是我无法使用移动设备。在iphone或android上时,除非我点击“否”,否则我不能离开年龄验证页面。我希望用户能够点击“是”并访问啤酒公司的网站。下面是代码。我做错了什么?

<?php
// This code, including the enclosing ?php tags, will require age verification for this page if included at the beginning of the associated HTML/PHP file.
session_start();
if (!isset($_SESSION['age_verified']) || $_SESSION['age_verified'] != true)
{
    // Direct them to the age verification page
    $redirect_url = urlencode("http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] );

    header('Location: http://maconbeercompany.com/age-verification.php?redirect=' . $redirect_url );
} 
?>

感谢您的帮助!

2 个答案:

答案 0 :(得分:0)

有时标题在会话中效果不佳所以我建议您尝试:

$redirect_url = urlencode("http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] );

echo "<meta http-equiv=refresh content='0; url=http://maconbeercompany.com/age-verification.php?redirect=". $redirect_url."'>";

答案 1 :(得分:0)

“; echo“window.open(``Location:http://maconbeercompany.com/age-verification.php?redirect =`。$ redirect_url`,`_ parent`,``)”; echo“”; } ?&GT;