Forums / General Questions / How do I determine whether I'm logged in using PHP?

How do I determine whether I'm logged in using PHP?

Views: 588

Results 1 to 3 of 3
2 Jul 2012, 7:38 PM
#1
bparker avatar

bparker

Zen Follower

Join Date:
Oct 2008
Location:
Rochester, NY
Posts:
232
Plugin Contributions:
0

How do I determine whether I'm logged in using PHP?

I would like to create an EZ-Page that has a particular section of content that changes depending on whether the user is logged in or not. What is the code to do this? I'll also accept a session variable that feeds the login information.

I'm good with PHP, but I wanted to know if there was a "Zen" way of doing this.

Thanks,
BP

2 Jul 2012, 8:51 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,110
Plugin Contributions:
56

Re: How do I determine whether I'm logged in using PHP?

if ( isset($_SESSION['customer_id']) && $_SESSION['customer_id'] ) {
  /* a customer is logged in */
}
2 Jul 2012, 9:42 PM
#3
get_em_fast avatar

get_em_fast

Totally Zenned

Join Date:
Dec 2006
Location:
Seligman, MO U.S.A.
Posts:
2,072
Plugin Contributions:
1

Re: How do I determine whether I'm logged in using PHP?

@ bparker. If you just need this content in a sidebox, you might try my "Mystery Sidebox" from the plugins section. That's EXACTLY what it does.

Hope this helps.

Teach them to shop and they will shop today;
Teach them to Zen and they will OWN a shop tomorrow!