login
Purpose: Authenticates and login a user.
Availability: IPB SDK 0.1
Attempts to authenticate the user username with the password password. A optional third argument can be provided. If this is set to 0, this function will just authenticate the details, and not set any cookies.
Returns an array with information on member, if successful in the same array structure as returned by get_info. FALSE is returned if the user could not be authenticated.
From IPB SDK Version 0.4 and onwards, you can specify an optional fourth argument anonlogin to be specified. If this is set to TRUE the user will be logged in anonymously. This will hide the member from the board's online list.
In order for a cookie to be sent successfully, this function must be called before any output is sent to the browser.
If you are having problems using this function, please check out the FAQ.
Attempts to login user with username and password values sent via a Form. This works
*/
if ($SDK->login($_POST['username'], $_POST['password'])) {
echo 'Login Successful';
}
/*
Attempts to login user with username and password values sent via a Form. This does not work because HTML output was sent before the loggedin() function call.
*/
echo 'foobar';
if ($SDK->login($_POST['username'], $_POST['password'])) {
echo 'Login Successful';
}
/*
This checks the user details are correct but does not actually set the cookie.
*/
if ($SDK->login($_POST['username'], $_POST['password'], 0)) {
echo 'Details Correct';
}
Information will be returned in the following array structure, if the login was successful:
(
[name] => cow
[id] => 1
[member_login_key] => d951dc0e16eee042f8024bac19c9ecbf
[email] => [email protected]
[title] => Administrator
[mgroup] => 4
[view_sigs] => 1
[view_img] => 1
[view_avs] => 1
[g_id] => 4
[g_view_board] => 1
[g_mem_info] => 1
[g_other_topics] => 1
[g_use_search] => 1
[g_email_friend] => 1
[g_invite_friend] => 0
[g_edit_profile] => 1
[g_post_new_topics] => 1
[g_reply_own_topics] => 1
[g_reply_other_topics] => 1
[g_edit_posts] => 1
[g_delete_own_posts] => 1
[g_open_close_posts] => 1
[g_delete_own_topics] => 1
[g_post_polls] => 1
[g_vote_polls] => 1
[g_use_pm] => 1
[g_is_supmod] => 1
[g_access_cp] => 1
[g_title] => Admin
[g_can_remove] => 0
[g_append_edit] => 1
[g_access_offline] => 1
[g_avoid_q] => 1
[g_avoid_flood] => 1
[g_icon] =>
[g_attach_max] => 50000
[g_avatar_upload] => 1
[g_calendar_post] => 1
[prefix] =>
[suffix] =>
[g_max_messages] => 50
[g_max_mass_pm] => 6
[g_search_flood] => 0
[g_edit_cutoff] => 5
[g_promotion] => -1&-1
[g_hide_from_list] => 0
[g_post_closed] => 1
[g_perm_id] => 4
[g_photo_max_vars] => 100:250:250
[g_dohtml] => 1
[g_edit_topic] => 0
[g_email_limit] => 10:15
[g_bypass_badwords] => 0
[g_attach_per_post] => 0
[g_can_msg_attach] => 0
[is_mod] => 1
)
User Contributed Notes
Documentation Generated at Sat, 16 Apr 2005 07:36:35 -0700
Find the latest version at http://ipbsdk.sourceforge.net
cow
Logging in and out can be a real monster to get working. The IPB SDK Support Forums have literally hundreds of threads on this matter alone. So here's how to sort it out. In the Cookie Settings section of the Admin CP, make sure the domain is set to .yourdomain.com where yourdomain.com is your domain. The other fields should be left blank.