重定向基于提交的网关页面PHP


Redirection based on submission for a gateway page PHP

所以我有一个php页面,它的作用就像是根据用户对问题的回答进入实际网站的网关。你超过18岁了吗?但我的疑问是:

-如何存储用户对该问题的回答?

-cookie或会话变量如何记录用户是否已经确认甚至访问了网关页面?

-如果"actualpage.php"缓存在用户的web浏览器中,如果他们没有确认或访问该页面,我如何确保它不会跳过网关页面?

您实际上不需要在默认情况下将其设置为0,所以我没有在下面包含它。

question.php:

session_start();
// if they answered the question
$_SESSION['time'] = 1;

actualpage.php:

session_start();
if (!isset($_SESSION['time'])) {
     header("Location: redirectpage.php");
     exit();
}
// rest of the page code

就这么简单,如果你还有其他问题,就直接问吧。