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