<?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>
in the login.php file i placed that but it does nothing the user is still able to put in login.php within the browser navigation and still get to it. I want to stop them from doing so. I want that file to only call when i try to login on the login html page. Above is the ajax code used to display error message if any from php. when i combine it with the if post or http reffer, it redirects to a blank page with continuous loading.