我有点不知道如何从2个按钮重定向到同一页面,但是在单击并重定向按钮时同时显示网站链接或演示链接。
所以我得到了那些效果很好的按钮
<a class="btn btn-info" href="<?php echo $row["siteurl"]; ?>pages/red.php?url=<?php echo $sitez['id']; ?>/<?php echo $sitez['Website']; ?>" role="button"><strong>Go to <?php echo $sitez["name"]; ?></strong></a>
<a class="btn btn-success" href="<?php echo $row["siteurl"]; ?>pages/red.php?url=<?php echo $sitez['id']; ?>/<?php echo $sitez['demo']; ?>/" role="button"><strong>Check <?php echo $sitez["name"]; ?> Demo Link</strong></a></center>
这是让他们重定向的地方,所以我需要显示演示或网站链接
setInterval(function() {
var div = document.querySelector("#timer");
var count = div.textContent * 1 - 1;
div.textContent = count;
if (count <= 0) {
window.location.replace("<?php echo $usez['Website']; ?>");
}
}, 3000);
<?php
if (isset($_GET['urlz'])) {
$urlz = ($_GET['urlz']);
$sql = "SELECT * FROM sites WHERE id='$urlz' AND approved='1' LIMIT 1";
$result = mysqli_query($link, $sql);
if( $result )
while($usez = mysqli_fetch_assoc($result)) {
?>
<strong>You are being redirected to an external site.</strong>
You will be redirected to <?php echo $usez['name']; ?>
You are going to <?php echo $usez['Website']; ?>
like to show demo here also but when only demo is clicked <?php echo $usez['demo']; ?>
in <a id="timer">30</a> Seconds
<strong>Please note that <?php echo $row['title']; ?> is not responsible for the content of the external site.</strong>
</tr>
</table>
</div>
</div>
</div>
<?php } } ?>
答案 0 :(得分:1)
首先,您可以将链接优化为:
<a class="btn btn-info" href="<?php echo $row["siteurl"].'pages/red.php?url='.$sitez['id'].'\'.$sitez["Website"]; ?>" role="button"><strong>Go to <?php echo $sitez["name"]; ?></strong></a>
您也可以使用<?=$site['url'].'xyz'.$otherVarible?>
它与<? php echo""; ?>
如果要区分后端的源按钮(例如用户单击的演示按钮或网站按钮),则始终可以传递一个额外的GET参数,使其成为两个不同的链接,路由到相同的路径:
www.example.com/red.php?isDemo=1 // for demo website
www.example.com/red.php?isDemo=0 // for actual website
然后您可以在后端将其检查为:
if (isset($_GET['isDemo']) && $_GET['isDemo'] == 1)