Not a good idea in general to do. After it logs in, create a session variable, isLogged. Set the value to true.
When working with PHP sessions, you need to have "session_start();" as your first line of code in the whole page.
Setting a Session Variable:
This goes in a conditional that is executed when you logged in successfully.
Code:
$_SESSION['isLogged'] = true;
In your second page, you can check to see if this session variable exists.
Checking the Sesson Variable:
Code:
if ($_SESSION['isLogged']==true) {
//run script
} else {
echo "You must be logged in to view this page!"; //if the session date is invalid
}