Question Regards Userdata Array

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
m3zzr
Registered User
Posts: 435
Joined: Tue May 18, 2004 8:53 pm
Location: St. Helens, UK
Contact:

Question Regards Userdata Array

Post by m3zzr » Fri Feb 17, 2006 7:40 pm

Hello.

I have used phpbb sessions throughout my website. One problem i have run into is that I want to limit a page down so you have to be registered to view it..

This is the code I have used..

Code: Select all

if( !$userdata['userlevel'] = -1)  

{ 
   message_die(GENERAL_MESSAGE, 'Sorry, You have to be registered to view this form. Please register or sign in.! '); 
} 
The problem, being.. it doesnt work.. so when a guest is on the site, does phpbb not set a userlevel value?

Doobdee
Registered User
Posts: 209
Joined: Wed Nov 10, 2004 6:43 pm
Location: DooBDee.net
Contact:

Post by Doobdee » Fri Feb 17, 2006 7:42 pm

Use this

Code: Select all

( !$userdata['session_logged_in'] )
As your condition.
DooBDee
Website Ninja
DooBDee.net

User avatar
jwunderly
Registered User
Posts: 5740
Joined: Sun Mar 30, 2003 2:18 pm
Location: Easton, PA (in the groove)

Re: Question Regards Userdata Array

Post by jwunderly » Fri Feb 17, 2006 7:43 pm

m3zzr wrote:

Code: Select all

if( !$userdata['userlevel'] = -1)  


The userlevel for guest is 0. You used the userid value.
John (A cranky old man. "Looking for an echo ...")
using any control-panel install/update is like shooting yourself in the foot. It won't kill you, but you're really going to hobble around until it heals.
Using the wrong tools (Front Page, DreamWeaver) gives the same results
Do not PM me for Support!

m3zzr
Registered User
Posts: 435
Joined: Tue May 18, 2004 8:53 pm
Location: St. Helens, UK
Contact:

Post by m3zzr » Fri Feb 17, 2006 7:45 pm

Doobdee wrote: Use this

Code: Select all

( !$userdata['session_logged_in'] )
As your condition.


Thanks,... thats sorted my problem.

Locked

Return to “2.0.x Support Forum”