How Do I Make A Blank Page If Someone Directly Visits A .php Url

- 1 answer

I have form validation setup and working as you can see (using javascript), the only problem is that when someone successfully logs in, I have it redirect to login.php but if someone directly visits they don't need a password to login. If there is any type of php code I need to add then that's fine, another option would be to change the function for the javascript on a successful login. Any info will help!

I have a password only form; here is my code:

<!doctype html>
<meta name="googlebot" content="noindex">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="js/account.js"></script>
<link rel="stylesheet" type="text/css" target="_blank" rel="nofollow noreferrer" href="css/main.css">
<meta charset="utf-8">
<title>The Order of Aztec</title>
<div id="page" align="center">
<br /><br /><br />
<div align="center"><img src="images/aztec-logo.png" width="256" height="198" alt="Aztec"/></div>
<br /><br /><br /><br /><br />
<div id="error-division"></div>
<br />
<form id="myForm" align="center">
<div align="center"><input placeholder="Password" name="pword" id="pword" type="password" /></div>
<br />
<div align="center" id="agree-box"><input id="agree-box-input" onClick="login();return false;" type="checkbox">Agree that you are part of the steam group "The order of aztec."</input></div>
<br />
<div align="center"><input id="submit" type="submit" /></div>
<div id="ack"></div>
<script type="text/javascript">
function login()
var pass = document.getElementById('pword');

var corpass = "t";

var agree = document.getElementById('agree-box-input');

if(pass.value == corpass && agree.checked == true)
window.location = "login.php"
} else {
document.getElementById("error-division").innerHTML = "Wrong password or             agreement not checked. Please try again.";


add if statement in your login.php


if(isset($_POST['your_username']) && isset($_POST['your_password'])){
   // do your activities
}else{ ?>
   <script type="Javascript">
      alert("Your username / password is incorrect");
      window.location = "your_validation_page.php";

<?php } ?>