HTML
<a href="inter.php?target=1">Some page</a>
<a href="inter.php?target=2">Some page</a>
<a href="inter.php?target=something_else">Some page</a>
PHP:inter.php
<?php
session_start();
$link='#';
switch($_GET['target']) {
case 1:
$link = "http://nexttarget.com";
break;
case 2:
$link = "http://nexttarget2.com";
break;
case "something_else":
$link = "http://nexttarget3.com";
break;
}
$_SESSION['prev_link'] = "http://source_url";
?>
<form action="<?php echo $link; ?>" method="post">
<p>Your T&C here</p>
<input type="checkbox" name="agree" value="agreed" />
<input type="submit" value="go" />
</form>
PHP:目标.php
<?php
session_start();
if( !isset($_POST['agreed']) || $_POST['agreed'] != 'agreed' ){
header("Location: ".$_SESSION['prev_link']);
exit;
}
?>
Your target page content here
编辑:编辑显示 T&C 页面而不是直接重定向。
编辑 2:现在中间页面将在同意/单击复选框后自动重定向。
PHP:inter.php
<?php
session_start();
$link='#';
switch($_GET['target']) {
case 1:
$link = "http://nexttarget.com";
break;
case 2:
$link = "http://nexttarget2.com";
break;
case "something_else":
$link = "http://nexttarget3.com";
break;
}
$_SESSION['prev_link'] = "http://source_url";
?>
<form action="<?php echo $link; ?>" method="post" id="tc_form" >
<p>Your T&C here</p>
<input type="checkbox" name="agree" value="agreed" onclick="javascript: this.parentNode.submit();" id="check" />
<label for="check">I agree to the T&C.</label>
</form>