session_start();
if(isset($_POST['name']) && !empty($_POST['name'])){ if($_POST['check']==$_SESSION['check']){ echo '正常访问';
} else {
echo '外部访问';
}
}
$token = md5(uniqid(rand(),true));
$_SESSION['check'] = $token;
?>
session_start();
if(isset($_POST['name']) && !empty($_POST['name'])){ if($_POST['check']==$_SESSION['check']){ echo '正常访问';
} else {
echo '外部访问';
}
}
$token = md5(uniqid(rand(),true));
$_SESSION['check'] = $token;
?>
本文标题:如何通过 php 程序防止外部页面提交表单?编写一段代码
本文链接:https://www.haomeiwen.com/subject/ndpdfxtx.html
网友评论