PHP Login and Registration System - Show and Hide divs

Got an idea for a tutorial ? Share it here.
Post Reply
garret27
Posts: 4
Joined: Fri Jul 06, 2012 12:50 am

PHP Login and Registration System - Show and Hide divs

Post by garret27 »

I just got done with my custom registration system that I got here, the awesome tutorial.

I have an idea that is more of an extension to that tutorial. As you see in this forum, once a person signs in, at the top you see
Last visit was: Fri Jul 06, 2012 9:42 am

User Control Panel
0 new messages
View your posts
Logout [ garret27 ]

Somebody could create an awesome tutorial that teaches how to show or hide certain divs, if a person is logged in or not.
For example: Logged Out / Guest
Register - Login

Logged In
Garret27
(1) Message
View
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: PHP Login and Registration System - Show and Hide divs

Post by Temor »

[syntax=php]if(isset($_SESSION['user_id'])){
user is logged in. Show div.
}else{
user is not logged in. do not show div.
}[/syntax]

is this what you mean?
This same thing could probably be done with some basic Javascript too. Unfortunately though, I know about as much Javascript as I know astrophysics, so I can't help you there.
Post Reply