user_id of admin: why 2 ?

The 2.0.x discussion forum has been locked; this will remain read-only. The 3.0.x discussion forum has been renamed phpBB Discussion.
Locked
StijnH
Registered User
Posts: 65
Joined: Sun Jul 30, 2006 10:53 am
Location: Roeselare, West-Vlaanderen, Belgium

user_id of admin: why 2 ?

Post by StijnH » Tue Aug 01, 2006 8:49 pm

Why isn't it 1?

espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Post by espicom » Tue Aug 01, 2006 9:11 pm

The reason doesn't really matter - you could make a user with ID 1 if you want (I have many times). Some boards consider user ID 1 to be an automatic admin, but PHPBB doesn't.
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer

ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Post by ckwalsh » Tue Aug 01, 2006 10:18 pm

I had heard last time this question came up that in the original plans there was another account that was supposed to be 1, but it didn't go into the phpbb2 release.

Don't know if it's true though ;)
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.

Newfie
Registered User
Posts: 221
Joined: Mon Feb 20, 2006 12:08 am
Location: A Canadian Province - guess which one?

Post by Newfie » Tue Aug 01, 2006 11:44 pm

The mysterious user number 1... 8O

Vic D'Elfant
Former Team Member
Posts: 6203
Joined: Sun May 02, 2004 6:21 pm
Location: NL, Maastricht
Contact:

Post by Vic D'Elfant » Wed Aug 02, 2006 7:51 am

Newfie wrote: The mysterious user number 1... 8O

User ID 1 is reserved for Bertie :mrgreen:

Vic
midd.ag • DTP, web development & printing
http://www.midd.ag

StijnH
Registered User
Posts: 65
Joined: Sun Jul 30, 2006 10:53 am
Location: Roeselare, West-Vlaanderen, Belgium

Post by StijnH » Wed Aug 02, 2006 8:33 am

Brainy wrote: I had heard last time this question came up that in the original plans there was another account that was supposed to be 1, but it didn't go into the phpbb2 release.

Don't know if it's true though ;)

I guess that's the right one :)

But I won't change it, as many mods use the user_id to check if the user is the board admin. And if I'd have to check that for every mod I install it would be too much work.

espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Post by espicom » Wed Aug 02, 2006 3:46 pm

If a MOD checks for the permissions by looking at the user_id, it's written wrong. user_id 2 is not "magic", it's just the one that was chosen, and you can remove its admin privileges the same way you do any other user... Some do that specifically to make it less likely that someone will find the admin account using the tools script kiddies play with.
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun » Wed Aug 02, 2006 4:55 pm

As already stated, "2" is not used for any specific purpose. You can set up a new account with a user_id of 42093 and make them an admin, delete the original account and your board will still function.

As to why they don't use auto-increment, well, that feature of MySQL does not support negative numbers, and the -1 value reserved for the "anonymous" user prevents that. Why not use 0 or 1 as the anonymous user? Don't know. :-) 0 is not a good idea because checking for zero (as opposed to false) requires special logic. So it was probably just easier to use a -1 value.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

User avatar
Ptirhiik
Registered User
Posts: 7411
Joined: Mon Jan 06, 2003 10:36 pm
Contact:

Post by Ptirhiik » Wed Aug 02, 2006 5:12 pm

Or maybe during the phpBB 2.0.0RC or dev stage, the admin profile was moved from 1 to 2, and when building the final package, it remains 2. Maybe also the anonymous user was originaly planed to be 1, but with the upgrade of phpBB 1 to 2, the devs have prefered set -1 for anonymous to prevent a comflict with an existing user, and so have freed the id 1 in new install.

Locked

Return to “2.0.x Discussion”