Hi I am new at this. 😴
I am using the code below to prevent visitors to enter my members page skipping login. It works fine. Only if you login you access members area.
But I have more restricted links there and if I paste this code in each one of them when a member is logged in and hits the link to another page he is not allowed. it refreshes back to login page.
What should I do?
<?php
//members page
session_start();
if(empty($Username)){
//Unauthorized page
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head> <meta http-equiv="refresh" content="0;url=/">
</head>
<body>
<center><h1>Unauthorized Access!</h1></center>
<center><h1>Please Register... It is Totally Free!!!</h1></center>
</body>
</html>
<?php
exit;
}
?>
Thanks