I'm wondering what the most efficient way of preventing people accesing my admin page through direct links. What i'm currently doing is when the user logs in, a session will be set and on the page it checks if its set or not.
This is passed on logon:
$_SESSION['lo'] = 1;
This checks the session on admin page:
session_start();
if (!isset($_SESSION['lo']))
header("Location: ,./login.php");
Is this the most efficient way? Are there other ways? I can imagine that you can somehow misuse this session to gain unauthorised acces. Which is what i want to prevent.