fudapi login with out redirect [message #35127] |
Sun, 10 December 2006 23:46 |
bleak26
Messages: 7 Registered: December 2006
Karma: 0
|
Junior Member |
|
|
Is it possible to login using the external_fud_login, but with out it redirecting? is the redirecting important ? i wish to remove redirection ,so that i can use external_fud_login without disturbing my login process.
Also please could you tell me in which file i can find the redirect that takes place during the login using external_fud_login and if possible (cheeky) the line name or function name.
one last last thing. WOW THE API IS EXCELENT, WELL DONE. its the first time i have attempted anything like this in intergration terms and it has been much eaiser than any of the alternatives. also the fudforum support forum looks as though people actauly get help, which was the other element which helped me decide to use the forum.
Thank you
|
|
|
Re: fudapi login with out redirect [message #35130 is a reply to message #35127] |
Mon, 11 December 2006 05:12 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The api does not actually do any redirects, it only generates a "logged in" session id which it returns and sets a cookie for the user.
FUDforum Core Developer
|
|
|
|
|
Re: fudapi login with out redirect [message #35465 is a reply to message #35458] |
Sun, 14 January 2007 17:08 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
You shouldn't do this like this. I would suggest reading the session id from the FUDforum cookie, who's name is found in GLOBALS.php (already pre-loaded by FUDPAI) and then running the query on the FUDForum's session table.
FUDforum Core Developer
|
|
|
Re: fudapi login with out redirect [message #35476 is a reply to message #35465] |
Mon, 15 January 2007 17:41 |
maarten
Messages: 7 Registered: January 2007
Karma: 0
|
Junior Member |
|
|
Alright, changed to so:
function fud_get_current_uid()
{
$sess_id = $_COOKIE[$GLOBALS['COOKIE_NAME']];
if (empty($sess_id)) {
return 0;
}
$q_str =
'SELECT user_id'
. ' FROM ' . $GLOBALS['DBHOST_TBL_PREFIX']. 'ses'
. ' WHERE ses_id=' . _esc($sess_id);
$id = q_singleval($q_str);
if (null === $id || 2000000000 <= $id) {
return 0;
}
return $id;
}
Edit: Modified to filter out userids of anonymous users. Those will show up as not logged in.
[Updated on: Mon, 15 January 2007 19:58] Report message to a moderator
|
|
|
Odp: Re: fudapi login with out redirect [message #35956 is a reply to message #35476] |
Fri, 23 February 2007 14:00 |
Janek
Messages: 1 Registered: November 2006 Location: Warsaw, Poland
Karma: 0
|
Junior Member |
|
|
You can also try this one:
<?
function external_fud_get_current_user_id() {
__fud_login_common(1);
$ses_id = $_COOKIE[$GLOBALS['COOKIE_NAME']];
if(!empty($ses_id) && strlen($ses_id)==32) {
$sys_id = __ses_make_sysid(($GLOBALS['FUD_OPT_2'] & 256), ($GLOBALS['FUD_OPT_3'] & 16));
$r = q_singleval("SELECT user_id FROM ".$GLOBALS['DBHOST_TBL_PREFIX']."ses WHERE ses_id="._esc($ses_id)." AND sys_id="._esc($sys_id)." AND user_id<2000000000");
return $r?$r:0;
}
return 0;
}
?>
It's more safe, as it also checks sys_id.
|
|
|