我正在为我的网站www.listprice.us寻找一个两阶段重定向,它会在将用户重定向到新网站之前发出异地通知。我有一百万个异地重定向,需要他们转到一个单一的新页面,其中包含最终目的地链接并暂停,直到用户通过同意按钮同意离开我的网站。我半熟的html,java和php,没有偏好,除了显然越简单,越好解释越好。
答案 0 :(得分:1)
创建一个页面,例如 getpermission.php 。
通过GET将目标网址带到该网页。
使用从GET
或POST
拉出的链接创建“是,我同意”等链接。
希望这会有所帮助:)
修改强>
GET: www.mysite.com/getpermission.php?url=www.thesite.com
<a href="<?php echo $_GET['url']; ?>"> YES I Agree </a>
每个问题添加源:
$askconsent = false; //set to true to ask for consent
if ($_GET) { //url has been presented with a GET.
$url = isset($_GET['url']) ? $_GET['url'] : 'www.domain.com'; //lets make sure url is set. If null set to home.
//Make sure this has been sanitized before hitting your database if its in one.
if ($askconsent) { //do we require consent yet?
echo '<a href="' . $url . '"> Would you like to continue?</a>'; //Present the user with the option to move on.
} else { // no consent needed.
header('Location: ' . $url); //go to url from GET
}
} else { // if we are not presented with a get, we must assume the user got here without wanting or needing to.
header('Location: www.domain.com'); //Send them home!
}