Jump to content

PHP

icamelookingforbooty

Gday guys.

 

I need your help with a bit of code. I want to hide a page until a user has successfully logged in. I already have

 

if(isset($_SESSION['user_email']) && isset($_COOKIE['elegymember'])) { ...etc

 

working to see if a user is logged on in order to access information on a page. Now i want to hide an entire page. I mean on a menu level. If a user isn't logged in then they won't see the logout option on the navigation menu. Once they log in, then on the menu they will see the logout page. Any help is greatly appreciated, Thank you

Link to comment
Share on other sites

Link to post
Share on other sites

You can use a simple if statement in your menu to check if they're logged in, and then display the appropriate menu item.

if (isset($_SESSION['user_email'])) {     Echo 'link to logout';} else {      Echo 'link to login';}

15" MBP TB

AMD 5800X | Gigabyte Aorus Master | EVGA 2060 KO Ultra | Define 7 || Blade Server: Intel 3570k | GD65 | Corsair C70 | 13TB

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×