2011-09-28 3 views
0

사용자 패널에서 읽지 않은 제목의 수를 검색하기 위해 vbulletin 포럼에 연결하는 작은 앱을 만들려고합니다.안드로이드 앱이 포함 된 Vbulletin 포럼에 연결

웹 사이트에서 정보를 검색하는 방법을 찾았지만 문제는 포럼에 로그인하는 방법을 모른다는 것입니다.

누구나 나를 도와 줄 수있는 조언이나 최소한의 링크를 줄 수 있습니까? 당신은 로그인이 특정 사이트의 경우 수행하는 방법을 조사 할 필요가

.. 폼 로그인, HTTP 인증, AJAX를 통해 로그인 등 :

답변

0

웹 사이트에 로그인하는 방법은 여러 가지가 있습니다.

사이트에서 로그인 버튼을 클릭하면 어떤 종류의 연결이 이루어지는 지 확인하려면 http 연결 (예 : 파이어 버그와 연결이 가능한 파이어 폭스)을 확인하십시오.

+0

확실하지 않습니다 ... 웹 사이트의 양식에 제출할 사이트 작업이 있습니다. '

' – jullebarge

+0

암호의 MD5 해시가 추가 된 HTTP POST입니다. –

+0

http://stackoverflow.com/questions/6772940/http-post-request-for-android –

0

사용자 이름과 사용자 비밀번호가 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로 설정하면 다음에 요청이있을 때 사용자가 기억됩니다.

관련 문제