javascript - 将页面重定向到主链接

标签 javascript php jquery

有没有办法可以保护页面不被访问,除非该页面来自特定的引用 URL? IE。如果有人在页面 A 上并单击链接转到页面 B,他们可以正常访问该页面,但如果其他地方的人尝试访问页面 B,他们会收到错误或可能只是重定向到页面 A。

感谢您的帮助

最佳答案

如何正确地执行此操作

页面a:

<?php
session_start();
$_SESSION['accssed_a']='yes';
//rest of page

页面b:

<?php
session_start();
if($_SESSION['accssed_a']!='yes'){
header('Location: http://example.com/a.php');
exit();
}
//rest of page

关于javascript - 将页面重定向到主链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25276915/

相关文章:

javascript - 带参数的 setTimeout

php mysql_fetch_assoc 转 json 编码

php - 从多个表填充表单 yii2 mysql

javascript - 在动态内容上按下后退按钮时遇到困难

javascript - If 语句给出不正确的结果。

javascript - Node 模块 - 导出变量还是导出引用它的函数?

javascript - 以 div margin-top 作为条件的 if 语句?

jquery - $.map - 返回元素未正确附加

javascript - 如何将 Google Maps InfoWindow 数据放入多个 HTML 文本框中

php - 通知: Unknown: file created in the system's temporary directory in Unknown on line 0