Previous Thread
Next Thread
Print Thread
Rate Thread
#312798 01/19/2007 3:59 PM
Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
Attached is the file. Rename it user_auth.inc.php and throw it in the includes directory of your forums.

Then just require the file and use it as follows
PHP Code
// Usage:

$userob = new user_auth();

// Am I logged in?
if( $userob->is_logged_in ) {
// I am logged in
}

// Am I in group 3?
if( $userob->in_group( 3 ) ) {
// Why, yes we are
}

// Who cares what group I'm in! I wanna know
// if I can read a topic from forum 7
if( $userob->check_access( 7, "read" ) ) {
// Apparently I can
}

// What if I want to know if I'm an administrator
if( $userob->fields['USER_MEMBERSHIP_LEVEL'] == "Administrator" ) {
// That means I'm teh uber user
}

// Want to create a welcome message?
if( $userob->is_logged_in ) {
if(
$userob->is_banned ) {
echo
"Go away, " . $userob->fields['USER_DISPLAY_NAME'];
} else {
echo
"Welcome, " . $userob->fields['USER_DISPLAY_NAME'];
}
} else {
echo
"Please register";
}


Note that $userob->fields is the same as the $user you've been using before, just wanted to not have two different variables hanging around

If you have any problems, it could be due to some paths being off, but the php error will explain that
Attachments
2389-user_auth.txt (7.45 KB, 184 downloads)

1 member likes this: Gizmo
Sponsored Links
Entire Thread
Subject Posted By Posted
User Authentication Class Ian Spence 01/19/2007 10:59 PM
Re: User Authentication Class AllenAyres 01/20/2007 1:00 AM
Re: User Authentication Class Gizmo 01/20/2007 1:59 AM
Re: User Authentication Class Calpy 01/20/2007 3:03 AM
Re: User Authentication Class AllenAyres 01/20/2007 3:29 AM
Re: User Authentication Class Gizmo 01/20/2007 3:44 AM
Re: User Authentication Class Calpy 01/20/2007 3:57 AM
Re: User Authentication Class Gizmo 01/20/2007 4:05 AM
Re: User Authentication Class JoshPet 01/20/2007 7:36 AM
Re: User Authentication Class blaaskaak 03/14/2007 4:08 PM
Re: User Authentication Class blaaskaak 04/17/2007 6:15 PM
Re: User Authentication Class Ian Spence 04/19/2007 11:16 PM
Re: User Authentication Class blaaskaak 05/21/2007 11:26 PM
Re: User Authentication Class Mark_S 08/09/2007 2:13 AM
Re: User Authentication Class Mark_S 08/10/2007 1:34 PM
Re: User Authentication Class AllenAyres 08/10/2007 8:36 PM
Re: User Authentication Class Mark_S 08/10/2007 9:01 PM
Re: User Authentication Class Mark_S 08/11/2007 2:09 PM
Re: User Authentication Class AllenAyres 08/11/2007 3:32 PM
Re: User Authentication Class Ian Spence 08/12/2007 3:49 AM
Re: User Authentication Class Gizmo 08/12/2007 5:46 AM
Re: User Authentication Class AllenAyres 08/13/2007 7:20 AM
Re: User Authentication Class Mark_S 08/16/2007 10:15 PM
Re: User Authentication Class sirdude 08/16/2007 10:23 PM
Re: User Authentication Class Mark_S 08/19/2007 11:13 AM
Re: User Authentication Class Mark_S 02/19/2008 10:39 PM
Chat Profile:Need convert user_name to user_number curiousguy 04/07/2008 10:31 AM
Re: Chat Profile:Need convert user_name to user_number blaaskaak 04/07/2008 6:38 PM
Re: Chat Profile:Need convert user_name to user_number AllenAyres 04/08/2008 4:09 PM
Re: Chat Profile:Need convert user_name to user_number blaaskaak 05/12/2008 2:46 PM
Re: User Authentication Class blaaskaak 05/12/2008 7:43 PM
Re: User Authentication Class swebs 07/19/2008 1:19 AM
Re: User Authentication Class Myke 07/21/2008 3:54 PM
Re: User Authentication Class swebs 07/21/2008 8:44 PM
Re: User Authentication Class Gizmo 07/22/2008 2:07 AM
Re: User Authentication Class intensity 11/06/2008 9:00 AM
Re: User Authentication Class Gizmo 11/06/2008 3:02 PM
Re: User Authentication Class intensity 11/06/2008 6:58 PM
Re: User Authentication Class blaaskaak 11/08/2008 12:59 PM
Re: User Authentication Class blaaskaak 11/09/2008 12:04 PM
Re: User Authentication Class intensity 11/11/2008 6:10 AM
Re: User Authentication Class swebs 05/31/2010 9:23 PM
Re: User Authentication Class Myke 07/08/2008 12:53 PM
Re: User Authentication Class Gizmo 07/08/2008 4:04 PM
Re: User Authentication Class blaaskaak 07/09/2008 12:40 AM
Re: User Authentication Class sirdude 07/09/2008 1:11 AM
Re: User Authentication Class swebs 07/18/2008 12:57 AM
Re: User Authentication Class sirdude 07/18/2008 6:50 PM
Re: User Authentication Class Gizmo 04/14/2011 11:48 PM
Re: User Authentication Class Gizmo 04/15/2011 12:38 AM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
JAISP
JAISP
PA
Posts: 449
Joined: February 2008
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)