labli
labli

Reputation: 15

redirect page to main link

Is there a way I can protect a page from being accessed unless it's from a particular referral URL? ie. if someone is on Page A and clicks a link to go to Page B, they would access it fine but if a person from anywhere else tries to access Page B, they get an error or possibly just redirected to Page A.

Thanks for the help

Upvotes: 0

Views: 77

Answers (1)

user557846
user557846

Reputation:

How to do this properly

page a:

<?php
session_start();
$_SESSION['accssed_a']='yes';
//rest of page

page b:

<?php
session_start();
if($_SESSION['accssed_a']!='yes'){
header('Location: http://example.com/a.php');
exit();
}
//rest of page

Upvotes: 1

Related Questions