<?php
if(isset($_SESSION['id'])==null){
header("Location: login.html");
}
?>
<script>
$(function(){
$(document).on("click", ".button", function(e) {
e.preventDefault();
{
//This will capture all the inputs from the form
var infom = $("#myform").serialize();
//$("#showresult").addClass('loader');
$.ajax({
beforeSend: function() { },
type: "POST",
url: "login.php",
data:infom,
success: function(result){
//$("#showresult").removeClass('loader');
$('#showresult').html(result);
}
});
e.preventDefault();
}
});
});
</script>
内的login.php过程文件中的文件的login.php我放置在,但它确实没有什么用户仍然能够把login.php中的浏览器导航内仍去实现它。我想阻止他们这样做。我希望该文件只在我尝试登录登录html页面时调用。以上是用于显示错误消息,如果有任何来自php的ajax代码。当我将它与if post或http reffer结合使用时,它会重定向到连续加载的空白页面。防止用户访问浏览器的导航栏
'if(isset($ _ SESSION ['id'])== null){'顺便提一句,是给你一个误报。你需要将它们分成两个不同的条件。很难说,如果你甚至在任何地方开始会议。 –
你无法阻止它。 – Barmar
是的,我确实开始了会话。 –