Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 09:28 am EST
Geeklog Forums
The modes of $_USER['uid']
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
To detect anonymous users, should I use
?
Supposedly yes, but then again some scripts check if it equals 1 instead (and Chatterblock, for example, checks if it equals 0).
So my question is really what are the modes (including empty) of $_USER['uid'] when it's not 2 and above (or in other words: what are the differences between its modes of empty, 0 and 1)?
Thanks!
Text Formatted Code
if (empty($_USER['uid']))?
Supposedly yes, but then again some scripts check if it equals 1 instead (and Chatterblock, for example, checks if it equals 0).
So my question is really what are the modes (including empty) of $_USER['uid'] when it's not 2 and above (or in other words: what are the differences between its modes of empty, 0 and 1)?
Thanks!
6
8
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The recommended way to check for a logged-in user is to do
While the uid of the anonymous user is 1, $_USER['uid'] is not always set for anonymous users.
It's not a bug, it's tradition
bye, Dirk
Text Formatted Code
if (!empty ($_USER['uid']) && ($_USER['uid'] > 1)) { ...While the uid of the anonymous user is 1, $_USER['uid'] is not always set for anonymous users.
It's not a bug, it's tradition
bye, Dirk
8
9
Quote
All times are EST. The time is now 09:28 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content