Using fudforum throughout a website [message #9565] |
Thu, 10 April 2003 04:01 |
philip
Messages: 21 Registered: December 2002
Karma: 0
|
Junior Member |
|
|
I'd like to use fudforum's authentication throughout a website but not include tons of fudforum code everywhere. Ideally it will involve a simple include, and keep visitors properly authenticated. Basically I need a simple auth function, and a way to get the sid. Cookies are properly set (path = '/', domain = .me.com).
Has someone else done this or must I spend some time staring at fudforum code until figured it out? :)
|
|
|
Re: Using fudforum throughout a website [message #9619 is a reply to message #9565] |
Sun, 13 April 2003 15:00 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Hmm...
Well, 1st thing you need to modify Cookie Path setting and make the path '/' so that the forum's cookie can be read from anywhere on your site.
Then you need to include
db.inc
err.inc
users.inc
cookies.inc
In your script, user will be automatically authenticated if they have a cookie or have a session passed via get, otherwise they will be 'initialized' as anon users. You can access the session id via a 'S' define.
FUDforum Core Developer
|
|
|
|
Re: Using fudforum throughout a website [message #9719 is a reply to message #9718] |
Tue, 15 April 2003 23:14 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Few issue with this code, GLOBALS.php will automatically include core.inc, so including it manually is not necessary.
core.inc has a nice function called fud_use() that can be used to include forum's .inc file.
users.inc will automaticall initialize the user and store the data inside $usr variable unless the 'forum_debug' constant is defined.
So the code could be simplified to:
<?php include_once '/path/to/your/GLOBALS.php'; fud_use('db.inc'); fud_use('err.inc'); fud_use('cookies.inc'); fud_use('time.inc'); fud_use('users.inc'); $userinfo = $usr;
if (!_uid) { fud_use('quicklogin.inc'); print $quick_login; } else { /* registered user stuff */ } ?>
FUDforum Core Developer
|
|
|
|
|
|
|
|
|