I have a website project where the right hand side of each page is being called from the includes
folder that contains an input field and a button. Once the user clicks on the button a php script is run and depending on the result from the script the user is redirected to a thankyou-success.php
or a thankyou-failure.php
file. These files are located in the root folder. I would like to prevent the user from directly typing the url to these paths and seeing the success
or failure
message directly. How can the user be prevented from such direct access?
At the moment I am redirecting to the files as follows:
//if found this email in our database
if($count==1)
{
header('Location: thankyou-success.php');
}
else
{
//echo "Cannot send Confirmation link to your e-mail address";
header('Location: thankyou-failure.php');
}
The two php files being called are exactly the same except for the text message displayed. I have removed the <head>
tag to keep things simple and clear. The content of the file is as follows:
<body>
<!-- header start here -->
<?php include("includes/header.php") ?>
<!-- header end here -->
<!-- page title start here -->
<section id="pagetitle-container">
<div class="row">
<div class="twelve columns">
<div id="pagetitle-border">
<div id="breadcrumb">
<ul>
<i class="fa fa-caret-right"></i>
<li><a href="index.php">Home</a></li>
</ul>
</div>
<p> <br></p>
<div class="twelve columns">
<p>Unable to send the activation email to the email address provided. Please confirm and try again.</p>
</div>
</div>
</div>
</section>
<!-- page title end here -->
<!-- content section start here -->
<section id="content-wrapper">
<div class="row">
</div>
</div>
</section>
<!-- content section end here -->
<footer>
<?php include("includes/footer.php") ?>
</footer>
<script>$('#noscript').remove();</script>
<!-- pageloader part 2 start -->
<!-- pageloader part 2 ends -->
</body>
</html>