Announcement

Collapse
No announcement yet.

cURL Mobile API login vs Login Bridge (Simple login embed)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • cURL Mobile API login vs Login Bridge (Simple login embed)

    I've spent hours sorting through all the (old & new) forum posts both on here and vbulletin.org looking for documentation on how to send a username and password from outside my forums root, and have it log them in. It looks like there are only two options available to vBulletin v4.2 and even v5--make a cURL call using the Mobile API, or use a login "bridge". Let me specify that I am NOT looking for have tables replicating users, or have my own userlist; I simply want to allow users to login into vBulletin from outside my forum root, and be able to check if they are logged in (and their user ID) from outside the forum root.

    The login "bridge" requires changing the current working directory:
    PHP Code:
    $curdir getcwd ();
    chdir("$site/forums");
    require_once(
    "$site/forums/global.php");
    chdir ($curdir); 
    I then use the global variable $vbulletin to check if the user is logged in ($vbulletin->userinfo['userid']). If not, then display a form with special attributes and hidden values.
    HTML Code:
    <form action=\"" . $forumpath . "login.php\" method=\"post\" onsubmit=\"md5hash(vb_login_password,vb_login_md5password,vb_login_md5password_utf)\">
         <input type=\"hidden\" name=\"redirect_url\" value=\"" . $RedirectURL . "\" />
         <script type=\"text/javascript\" src=\"" . $forumpath . "clientscript/vbulletin_md5.js\"></script>
         <input type=\"hidden\" name=\"s\" value=\"" . $session['sessionhash'] . "\" />
         <input type=\"hidden\" name=\"do\" value=\"login\" />        
         <input type=\"hidden\" name=\"vb_login_md5password\" />
         <input type=\"hidden\" name=\"vb_login_md5password_utf\" />
    
        <input name=\"vb_login_username\" type=\"text\" id=\"navbar_username\" onfocus=\"if (this.value == '" . $vbphrase["username"] . ">') this.value = '';\" size=\"15\" /> <label for=cb_cookieuser_navbar><input name=\"cookieuser\" type=\"checkbox\" id=\"cb_cookieuser_navbar\" value=\"1\" checked=\"checked\" />Remember Me?</label>
    
        <input name=\"vb_login_password\" type=\"password\" size=\"15\" />
    </form>
    What's the problem with this? It requires me to change the current working directory and include the global file, which messes with my current database connections and such.

    So what's the alternative? Use the cURL Mobile API, which USED to have documentation; but all the links to the API documentation all go to removed forum posts. If I were to go this route, I'd have to figure it out from the following three links, two of which contain un-official and "old" code:


    My question: what is the recommended solution? The problem with the Mobile API is why am I doing a cURL call when the code exists on my server? It's not what the API was designed for, but is there a better solution that does NOT require me to include global.php?

  • #2
    /bump - no responses on a recommended solution for allowing users to login to vBulletin outside the forum root using my own form?

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...
    X