php forum
php mysql forum
php mysql smarty
 
Topic Options
#221871 - 07/30/02 03:10 PM Verify user by group
Aglavalin Offline
Enthusiast

Registered: 06/18/02
Posts: 394
Loc: Southern California
I am creating a page to be viewable only by members of a certain group, but am having problems finding the right info to check. Right now I can access the page as admin using this:<br /><br /><pre><font class="small">code:</font><hr><br /><br />if ($user['U_Status'] == 'Administrator') {<br />include "info.php";<br />} else {<br />echo "You are not authorized or not logged in.";<br />}<br /><br /></pre><hr><br /><br />Which works fine for me as admin, but I need it to work for an existing group called 'Members'. I'm still new to this stuff, but I bet this is an easy one for the gurus around here <img src="/forum/images/icons/smile.gif" alt="" /> <br /><br />Any help is appreciated!

Top
#221872 - 07/30/02 04:22 PM Re: Verify user by group [Re: neuron]
Dave_L_dup1 Offline
Addict

Registered: 04/23/02
Posts: 1929
Loc: Virginia, USA
1) Is there a call $user = $userob -> authenticate(...) before the code you provided above? If so, could you show me exactly what it looks like?<br /><br />2) I assume that you want the page to be accessible by both administrators and users in the 'Members' group?<br /><br />3) What's the ID of the 'Members' group? You can determine that with the query: SELECT G_Name,G_Id FROM w3t_Groups WHERE G_Name='Members'
_________________________
UBB.threads beta tester / threadsdev.com moderator
Software consulting services including UBB.threads problem resolution / installs / upgrades / customization.

Top
#221873 - 07/30/02 08:37 PM Re: Verify user by group [Re: joeuser]
Aglavalin Offline
Enthusiast

Registered: 06/18/02
Posts: 394
Loc: Southern California
The code up in the file is <br /><br /><pre><font class="small">code:</font><hr><br /> $userob = new user;<br /> $user = $userob -> authenticate();<br /></pre><hr><br /><br />That query returns:<br /><br />G_Name G_Id <br />Members 5 <br />

Top
#221874 - 07/30/02 09:25 PM Re: Verify user by group [Re: neuron]
Dave_L_dup1 Offline
Addict

Registered: 04/23/02
Posts: 1929
Loc: Virginia, USA
Change <br /><pre><font class="small">code:</font><hr>$user = $userob -> authenticate();</pre><hr> <br />to <pre><font class="small">code:</font><hr>$user = $userob -> authenticate('U_Groups');</pre><hr> <br /> <br />Then change the code in your first post to: <br /><pre><font class="small">code:</font><hr>if (($user['U_Status'] == 'Administrator') or strpos($user['U_Groups'],'-5-') !== false) { <br /> include 'info.php'; <br />} else { <br /> echo 'You are not authorized or not logged in.'; <br />}</pre><hr>
_________________________
UBB.threads beta tester / threadsdev.com moderator
Software consulting services including UBB.threads problem resolution / installs / upgrades / customization.

Top
#221875 - 07/31/02 12:18 AM Re: Verify user by group [Re: joeuser]
Aglavalin Offline
Enthusiast

Registered: 06/18/02
Posts: 394
Loc: Southern California
Works great! Many thanks! <img src="/forum/images/icons/smile.gif" alt="" />

Top



Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks