How to prevent direct access page through URL ?
prevent page direct URL access but access through button. let suppose I have a button with link "www.demo.com/example.html". someone click the button redirect this page "www.demo.com/example.html" but someone access through direct trough URL it show denied.
Use this code in source page means button page .
-----------------------------------------------------------------------------------
<form action="www.demo.com/example.html" method="POST">
<input type="submit" name="SubmitButton">
</form>---------------------------------------------------------
This code past in destination page means those who protect from direct access.
------------------------------------------------
if(!isset($_POST["SubmitButton"])){
header("Location: SourceFile.php");}
-----------------------------------------------In source file use submit button to redirect.
In destination file check "SubmitButton", If user try to access page using url then he/she will redirect to same page.
Tags
php