I have created a simple login page to access mail sending form. Login page works and redirects to sender.html. What I am trying to get is not to let others access sender.html or send.php without logging in. I have already tried putting
<?php
$referrer = $_SERVER['HTTP_REFERER'];
if ($referrer != "http://www.example.com/login.html") {
header('Location: http://www.example.com/login.html');
} ;
?>
into the beginning of the sender.html but it doesn't work. I also tried adding redirect rules to .htaccess but it would not allow access the page after login. I'm a beginner but already spent a while to sort this out, would appreciate your help guys.
</div>