사용자 이름과 사용자 비밀번호가 md5 인 앱을 통해 _POST 요청을 보내야합니다. 사용자 이름 필드 이름은 "vb_login_username"이어야하며 암호 필드 이름은 "vb_login_md5password"여야합니다. 일단 그 사실을 알게되면 앱이 말한 사용자 정의 로그인 페이지를 만들 수 있습니다. 여기 내가 사용하는 것과 비슷한 것이 있습니다. 로그인 성공시 JSON 형식의 사용자 정보를 반환합니다.
require_once('./global.php');
require_once(DIR . '/includes/functions_login.php');
define("BADLOGIN" , "You have entered an invalid username or password.");
define("BADLOGIN_STRIKES" , "You have entered an invalid username or password. You have %s login attempts left, after which you will be unable to login for 15 minutes.");
define("BADLOGIN_STRIKES_ZERO" , "You have entered an invalid username or password and used up your failed login quota. Please wait 15 minutes before trying to login again.");
// ################################ start login #################################
if ($_POST['do'] == 'login') {
$vbulletin->input->clean_array_gpc('p', array(
'vb_login_username' => TYPE_STR,
'vb_login_password' => TYPE_STR,
'vb_login_md5password' => TYPE_STR,
'vb_login_md5password_utf' => TYPE_STR,
'cookieuser' => TYPE_BOOL,
));
// can the user login?
$strikes = verify_strike_status($vbulletin->GPC['vb_login_username']);
// make sure our user info stays as whoever we were (for example, we might be logged in via cookies already)
$original_userinfo = $vbulletin->userinfo;
if (!verify_authentication(
$vbulletin->GPC['vb_login_username'], $vbulletin->GPC['vb_login_password'],
$vbulletin->GPC['vb_login_md5password'], $vbulletin->GPC['vb_login_md5password_utf'],
$vbulletin->GPC['cookieuser'], true))
{
exec_strike_user($vbulletin->userinfo['username']);
// load original user
$vbulletin->userinfo = $original_userinfo;
if ($vbulletin->options['usestrikesystem'])
{
if ((5 - $strikes) == 0)
{
die(json_encode(array(
'hasErrors' => (int) 1,
'errorMsg' => BADLOGIN_STRIKES_ZERO
)));
}
else
{
die(json_encode(array(
'hasErrors' => (int) 1,
'errorMsg' => sprintf(BADLOGIN_STRIKES, 5 - $strikes)
)));
}
}
else
{
die(json_encode(array(
'hasErrors' => (int) 1,
'errorMsg' => BADLOGIN
)));
}
}
exec_unstrike_user($vbulletin->GPC['vb_login_username']);
// create new session
process_new_login($vbulletin->GPC['logintype'], $vbulletin->GPC['cookieuser'], $vbulletin->GPC['cssprefs']);
$userinfo = fetch_user($vbulletin->userinfo['userid']);
// is banned user?
if ($userinfo['usergroupid'] == 8) {
process_logout();
}
// return userinfo
die(json_encode(array(
'success' => (int) 1,
'user' => $userinfo
)));
}
이렇게하면 시작하는 데 도움이되기를 바랍니다. 그런데 필드 이름 "cookieuser"를 true로 설정하면 다음에 요청이있을 때 사용자가 기억됩니다.
출처
2011-09-29 17:37:39
Ken
확실하지 않습니다 ... 웹 사이트의 양식에 제출할 사이트 작업이 있습니다. '
암호의 MD5 해시가 추가 된 HTTP POST입니다. –
http://stackoverflow.com/questions/6772940/http-post-request-for-android –