2011-08-19 3 views
2

나는 이것을 여러 시간 동안 검색해 보았지만 성공하지 못했습니다.vBulletin 4.x 외부 페이지 로그인 및 변수

외부 페이지에서 vBulletin에 로그인하려고합니다. 나는이 일을 할 수 있었다. 그러나 내가 일할 수없는 것은 사용자 이름과 $ vbulletin 변수 중 하나를 보여주는 것입니다.

포럼 등에 global.php chdir()을 포함 시켰지만 작동시키지 못했습니다.

누구든지이 문제를 해결하는 방법을 알고 있습니까?

답변

2

이것은 실제로 작동하는 예제입니다. 잘 작동합니다. 외부 페이지에 사용자 이름 및 로그 아웃 버튼이 표시됩니다.

나는 왜 그런지 모르겠다.

<?php 
    $curdir = getcwd(); 
    #Add your root dir below where it says "ADD ROOT" Example: /home/server/public_html/mainsite/forums 
    #Do not end with a "/" leave it open like above example. 
    chdir('ADD ROOT'); 
    require_once('ADD ROOT/global.php'); 
    chdir($curdir); 
    if ($vbulletin->userinfo['userid'] == 0) { 
    #Form Display Code, You can edit the way the Form is layed out here. 
     echo "<form id=\"login\" action=\"/forums/login.php?do=login\" method=\"post\" onsubmit=\"md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)\"> 
    <script type=\"text/javascript\" src=\"clientscript/vbulletin_md5.js?v=364\"></script> 
    <a href=\"/forums/register.php\">Register</a> 
    <label for=\"navbar_username\">Username</label> 
    <input type=\"text\" class=\"bginput\" style=\"font-size: 11px\" name=\"vb_login_username\" id=\"navbar_username\" size=\"10\" accesskey=\"u\" tabindex=\"101\" onfocus=\"if (this.value == 'User Name') this.value = '';\" /> 
    <label for=\"navbar_password\">Password</label> 
    <input type=\"password\" class=\"bginput\" style=\"font-size: 11px\" name=\"vb_login_password\" id=\"navbar_password\" size=\"10\" tabindex=\"102\" /> 
    <label for=\"cb_cookieuser_navbar\"><input type=\"checkbox\" name=\"cookieuser\" value=\"1\" tabindex=\"103\" id=\"cb_cookieuser_navbar\" accesskey=\"c\" />Remember Me?</label> 
    <input type=\"submit\" class=\"button\" value=\"Login\" tabindex=\"104\" title=\"Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself.\" accesskey=\"s\" /> 
    <input type=\"hidden\" name=\"s\" value=\"\" /> 
    <input type=\"hidden\" name=\"do\" value=\"login\" />   
    <input type=\"hidden\" name=\"vb_login_md5password\" /> 
    <input type=\"hidden\" name=\"vb_login_md5password_utf\" /> 
    </form>"; 
    #End Form Display Code 
    } else { 
    #Display after login completed 
     echo "Welcome Back, <b>".$vbulletin->userinfo['username']."</b>"; 
     if ($vbulletin->userinfo['usergroupid'] == '6') { 
     echo "&nbsp;|&nbsp;<a href=\"/forums/member.php?1-".$vbulletin->userinfo['username']."\">My Profile</a>"; 
     echo "&nbsp;|&nbsp;<a href=\"/forums/egncadmincp/index.php\">AdminCP</a>"; 
     echo "&nbsp;|&nbsp;<a href=\"/forums/egncmodcp/index.php\">ModCP</a>"; 
     } 
    } 
    ?>