Prevent direct access of a fancybox iframe content

2019-08-20 10:08发布

问题:

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");
}