I have a Web app with a login form. When the user successfully logs-in, the app generates a session var containing his user ID. Then it displays a main menu, with several links towards .php pages, some of those pages are not the same for all the users, for instance a "user_profile.php" page...etc.
If a non-authenticated user knows the name of those pages, and tries to display them, I wonder how I can secure this stuff ?
So far, I have something like this :
//if the session is not set, forces the user to go back to the main page
if (!isset($_SESSION['auth'])) {
header("Location: index.php");
exit();
}
else {
//display the page, with PHP, HTML, JS...
}
Is the security level "acceptable" in this case ? If not, what can I do to improve the security ?