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

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

/bump - no responses on a recommended solution for allowing users to login to vBulletin outside the forum root using my own form?
Reply With Quote
  #3  
Old 04-16-2013, 02:20 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know what the recommended solution is (or if there is a recommended solution). All I know is a little bit about the problem. To get someone logged in to vbulletin, you need to get it to create a session and save some cookies (you *can* log in without cookies enabled, but "remember me" won't work, and if someone does have cookies enabled then I'm not sure you could also log in without cookies). And part of the cookie problem is that the user's browser has to save it and send it back when requesting a forum page. Also, a session has to have a constant ip and user agent. So I don't know that there's any way to fake all that using cURL (but you said you think it used to work, so maybe there's a way I don't know about).

So given all that, it kind of seems like the only way to do it would be to get the user's browser to send the user name and password to the vbulletin login script, or else hack vbulletin to allow some other way.
Reply With Quote
  #4  
Old 04-25-2013, 07:28 PM
webswimr's Avatar
webswimr webswimr is offline
 
Join Date: Jan 2002
Location: Sarasota, FL
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks KH, it looks like I'm just going to go with the basic form as presented. Not worth my time at the moment to find other solutions.
Reply With Quote
  #5  
Old 04-25-2013, 10:08 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'd ask whats the point of wanting a login on your page to vB, if it doesn't do anything aside from log them into the forum?
Reply With Quote
  #6  
Old 04-26-2013, 01:06 AM
webswimr's Avatar
webswimr webswimr is offline
 
Join Date: Jan 2002
Location: Sarasota, FL
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery View Post
I'd ask whats the point of wanting a login on your page to vB, if it doesn't do anything aside from log them into the forum?
We use vBulletin as the login for our whole site, not just the forums. Some people register for portions of the site without realizing that they are actually creating a forums account.

So, another part of the problem with having the login form outside the root is when someone logs in and they use incorrect information, it gets "stuck" on the forum login.php and they end up seeing an interface different then what they are use to. Hence my other question regarding login_failure hooks, so that on failure, I can send them back to outside the forum.

Does that make sense?

--------------- Added 25 Apr 2013 at 23:14 ---------------
Reply With Quote
  #7  
Old 04-27-2013, 05:26 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why not just intergrate your frontend with vBulletin? Would likely save a lot of time.
Reply With Quote
Reply


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 07:06 AM.


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.03998 seconds
  • Memory Usage 2,230KB
  • 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)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (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)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_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
  • 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