Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-10-2013, 05:36 PM
webswimr's Avatar
webswimr webswimr is offline
 
Join Date: Jan 2002
Location: Sarasota, FL
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:40 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03783 seconds
  • Memory Usage 2,421KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_html
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete