I have 2 files, index.html and code.php.
In my html page, I have a form which posts to the code.php on submit like this:
<form method="post" action="code.php">
What I am trying to do is only make the code.php accessible to the public when the user clicks submit on the html form. The reason why I am trying to get this done is when the user types in sites.com/code.php it displays a page which isnt processed with the form data and it looks bad, so I want to limit the code.php access.
So basically what I want to do is, when the user goes to sites.com/code.php, they would get redirected to index.html but if they go through the form and hit submit, they'll be able to get to the processed code.php.
I thought of different ways to do this and one of the ways was to change the chmod of code.php with some php script. So by default code.php would not be readable but if the user clicks on submit, the chmod for the code.php wpuld be changed to readable hence displaying the page, but then there is no way to redirect the users to index.php when they just visit code.php.
If there is some fancy way of dong this, please let me know! Thanks.