Previous Thread
Next Thread
Print Thread
Rate Thread
#271766 03/31/2004 3:58 PM
Joined: Mar 2004
Posts: 8
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 8
I am making a few other pages on our web site that I only want to provided certain people access to. I figured since everyone already has a board login I might just be able to use that and authenticate people based on if they have certain access on the boards.

Instead of going through a wild goose chase through all the files I was wondering if this functionality exists or maybe just give me the specific files/functions to look at.

Thanks in advance.

Sponsored Links
Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
gonna quote scream here..

[]Ok, the authenticate call is pretty basic. There are a few ways to call it and it takes 3 things, Username, Password and Query. If you were trying to plug it into another script you would need to do something like this:

---------------------------------------
require ("main.inc.php");
$userob = new user;

$user = $userob -> authenticate("$Username","$Password","");
---------------------------------------

Notice that I didn't send anything for the query. When you call it like this it returns every field from the user table. If you only wanted their U_Homepage field then you would call it like this:

$user = $userob -> authenticate("$Username","$Password","U_Homepage");

There is one catch to this. Even though only one field is specified, authenticate will always return a few other fields: U_StyleSheet, U_Status, U_Privates and U_FrontPage. It does this because these are needed by pretty much every script in UBBThreads and I didn't want to have to put these into the query each time.

Ok, so once you call authenticate, any fields you requested are going to be in the $user array. In the example above where U_Homepage was requested you could find out the value of their homepage by doing something like this:

$homepage = $user['U_Homepage'];

or

echo "{$user['U_Homepage']}";

That's the basic rundown on the authenticate function. If anyone needs more specifics on it, just let me know. [/]

Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
Not sure how secure you need it to be but a quick simple way to do this would be to use the Generic Threads Page mod and only apply the menu items in the registerednav.tmpl

Joined: Mar 2004
Posts: 8
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 8
Awesome... thanks for the quick response, just what I was looking for..

Is there also an easy way to find out which specific formuns/groups they have access to?

Joined: Mar 2004
Posts: 8
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 8
Actually now that I think about it, I can have the users just login through the boards first and then hit the page.

Is there something that I can use to check their session. Bascially, since they are already auth through the board.

Sponsored Links
Joined: Mar 2004
Posts: 8
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 8
for anyone interested where is what I found based on my last few questions.
Code
<br />Replace :<br />   $user = $userob -> authenticate();<br /><br />With this :<br />       $user = $userob -> authenticate("U_Totalposts,U_Laston,U_Sort,U_Display,U_View,U_PostsPer<br />,U_EReplies,U_TextCols,U_TextRows,U_Language,U_TempPass,U_TimeOffset,U_Groups,U_StartPage,U_Picture,U_Name,U_Title,U_Favorites,U_PicWidth,U_PicHeight,U_TimeOffset,U_FlatPosts,U_TempRead");<br />        list($totalposts,$laston,$sort,$display,$view,$postsper,$ereplies,$textcols,$textrows,$ubbt_language,$temppass,$offset,$groups,$startpage,$picture,$fullname,$title,$favorites,$picwidth<br />,$picheight,$timeoffset,$flatposts,$read,$CheckUser,$pass,$sessionid,$stylesheet,$status,$privates,$frontpage,$Uid) = $user;<br /><br />


and then you have access to all the above variables in your code.

Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
Are you looking to limit people based on what group they are in?

If so, post and reply, I already have that built and all you need to do is reference the Group_ID they are in...and boom, you are up and running.

Joined: Mar 2004
Posts: 1
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 1
Medar,

I would like to see what you have built for that.

Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
I use the Generic Threads Page that Josh wrote up, but you can actually put this in anywhere you auth (as everyone listed above).

My snippet is bolded, the rest is (I believe) standard out of Josh's Generic Threads Page. The only thing you need to do is put the correct group number (mine is -6- below) into the snippet of code, and change your NOT_RIGHT message.
__________________________________________

<?
// Generic UBB.Threads page by Joshua Pettit
// aka JoshPet of www.joshuapettit.com
// UBB.Threads Elements ©Infopop.com and Rick Baker

// Variables - Edit these As Needed

// What is the title of the page:
$pagetitle = "Add your Page Title";

// What is the PATH (not URL) to your threads install?
// You'll find this in your threads config file
// Do not include trailing slash
$threadspath = "/home/path/forums";

// DO NOT EDIT THIS SECTION
// Require the library
require ("$threadspath/main.inc.php");

$userob = new user;
$user = $userob -> authenticate(U_Groups);
$html = new html;
$html -> send_header($pagetitle,$Cat,0,$user);

// -----------------------------
// Make sure they should be on this page
if (!stristr($user['U_Groups'],"-6-")) {
$html -> not_right ("<br><B>You must be a member of the Moderation group to access this function.</b>",$Cat);
}


// ---------------------
// Grab the tablewrapper
list($tbopen,$tbclose) = $html -> table_wrapper();
// Now let's draw the table
echo "$tbopen";
// Now let's create a header with the page title in it
echo "<tr><td class="tdheader">$pagetitle</td></tr>";
// Now let's open the next table cell for the body of your page:
echo "<tr><td class="lighttable">";
// The rest of the page

// YOU CAN EDIT THIS SECTION
// Put the HTML of your page below this
__________________________________________

Joined: Mar 2004
Posts: 8
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 8
I used:

Code
<br />if ( (ereg ("-15-", $groups)) || (ereg ("-29-",$groups)) ) {<br />     Put your code here for people with access<br />} else {<br />     echo "I'm sorry but you do not have access";<br />}<br />

Sponsored Links
Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
That works too


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:
Shock Hosting
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Ruben Rocha
Ruben Rocha
Lutz,FL,USA
Posts: 253
Joined: January 2000
Forum Statistics
Forums63
Topics37,583
Posts293,955
Members13,824
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 666
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 3
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
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-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260108)