|
Re: Protector Scrit - use FUDForum as Central Login Manager [message #25111 is a reply to message #25098] |
Wed, 25 May 2005 19:34 |
|
JamesS
Messages: 275 Registered: July 2002 Location: Atlanta, GA
Karma: 0
|
Senior Member |
|
|
The only way I have been able to determine if a user is logged in without copying a few functions from FUDforum's index.php is to check their cookie age. I am not going to write the wrapper right now but I can later if you are unable to do so. Here is what you would need to do:
1) Read the cookie set by FUDforum to get the user's session id. If it does not exist the user is not logged in to the forum.
2) Query the "forum_ses" table (it will probably have a prefix) in the database like so -- `"SELECT user_id FROM {$dbprefix}forum_ses WHERE ses_id='$sid' AND user_id < '2000000000' AND time_sec>'".($time['sec'] - 604800)."'"`. If you get a result then the user is logged in; if you get zero results then the user is not logged in.
3) If the user is not logged in then present them with a username and password form. Use the persons 'user_id' from the previous query to authenticate them. The password is stored as an MD5 hash. If the authentication succeeds, use external_fud_login() from scripts/forum_login.php to log the user in to the forum.
*Edit*
Here is a query to authenticate the user:
`"SELECT login FROM {$dbprefix}forum_users WHERE id = '$user_id' AND uname = '$uname' AND password = MD5('$passwd')"`
[Updated on: Wed, 25 May 2005 19:43] Report message to a moderator
|
|
|