问题
Is there any solution that prevent an access to any content that is made to be called via fancybox iframe only?
I am using fancybox ver 2.0 and PHP as a server end programming.
Have a look for example.
<a href="feedback.php" class="feedback fancybox.iframe">Feedback</a>
Now generally when a user clicks on feedback link, fancybox will handle the request.
But I want to prevent users from accessing "feedback.php" page directly from the browser's address bar.
回答1:
if (!empty($_SERVER['HTTP_REFERER'])){
header("Location: ".$_SERVER['HTTP_REFERER']);}
else {
header("Location: index.php");
}
来源:https://stackoverflow.com/questions/13486643/prevent-direct-access-of-a-fancybox-iframe-content-via-url