Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如果调用了中间页,则重定向到主页面_Php - Fatal编程技术网

Php 如果调用了中间页,则重定向到主页面

Php 如果调用了中间页,则重定向到主页面,php,Php,我的主页是 login.php 当用户进入这个页面时,他进行了身份验证,然后重定向到start.php页面 我将变量“userid”从login.php发布到start.php FB.api('/me?fields = movies,email,name', function(mydata) { $.post( function(data) {

我的主页是 login.php

当用户进入这个页面时,他进行了身份验证,然后重定向到start.php页面

我将变量“userid”从login.php发布到start.php

FB.api('/me?fields = movies,email,name', function(mydata)
                {
                    $.post( function(data)
                    {
                        var $form = $("<form id = 'form1' method = 'post' action = 'start.php'></form>");
                        $form.append('<input type = "hidden" name = "userid" value = "'+userid+'" />');
                        $('body').append($form);
                        window.form1.submit();
                    });
我会用

<?php
if(!isset($_POST['userid'])){
//redirection code goes here
}
?>
将其添加到页面顶部

isset函数正在检查userid元素是否已从上一页发送。 请记住,这并没有考虑像CSRF这样的安全性

<?php
if(!isset($_POST['userid'])){
//redirection code goes here
}
?>