【发布时间】:2014-07-21 01:11:02
【问题描述】:
我正在为我的网站 www.listprice.us 寻找一个两阶段重定向,它会在将用户重定向到新网站之前发出异地许可通知。我有一百万个异地重定向,需要他们转到一个带有最终目标链接的新页面并在那里暂停,直到用户通过同意按钮同意离开我的网站。我对 html、java 和 php 半流利,除了显然越简单,解释得越好越好。
【问题讨论】:
-
像你一样,我们也喜欢更简单和更好解释的问题:)
我正在为我的网站 www.listprice.us 寻找一个两阶段重定向,它会在将用户重定向到新网站之前发出异地许可通知。我有一百万个异地重定向,需要他们转到一个带有最终目标链接的新页面并在那里暂停,直到用户通过同意按钮同意离开我的网站。我对 html、java 和 php 半流利,除了显然越简单,解释得越好越好。
【问题讨论】:
创建一个页面,例如getpermission.php。
通过 GET 将目标 URL 带到该页面。
使用从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!
}
【讨论】: