How to make page require a session variable?
| SitePoint Sponsor |

How to make page require a session variable?





say you wanna check if $_SESSION['userid'] does not exist then stop or redirect
first condition checks if the variable is set and second checks if variable set then is it empty?PHP Code:if(!isset($_SESSION['userid']) || (isset($_SESSIOn['userid'] && empty($_SESSION['userid']))
{
exit;//if you wanna stop loading page
header('Location: otherpage.php');//redirect the page
}
hope it helps you.
Bookmarks