The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
FIX: How to connect your website with vBulletin
Hi All, Thank you for helping me , now I find the way to how to connect your website (What ever language you use to build your website) with vBulletin by forwarding the username and password for your users to vBulletin through a bridge. The language I use it to build this bridge is ASP 6.0, but no problem as soon I will describe each step how it work. The idea behind that is: 1. Let your existing website create those two cookies: a. $_COOKIE["username"]; b. $_COOKIE["password"]; 2. Create a bridge that connects the username and password fields in vBulletin with those cookies. 3. Ones the bridge fired it must call the “login.php” in vBulletin after forwarding the username and password as the normal situation, and let the user be logged in both: vBulletin and your website. Please note that vBulletin will run in a deferent environment than your website runs, also it uses a deferent cookies and it encrypted to prevent anybody from reading it: so that why many people fail to do that. I didn’t say that forwarding the user information through a cookies is wrong, but because vBulletin encrypt every transaction between the files. Now, let we start! In this article, we will use a splash screen as a bridge, and let the user login to vBulletin after clicking a button. The code of the (splash.asp) is: =========================================== Code:
<% Dim F F = False Sub btn_click() if F = True Then Response.Redirect "/vbulletin/index.php" End If End Sub Sub btn_bf() F = True End Sub %> <html> <head> <title>vBulletin Splash Screen</title> </head> <body onload="btn_click()" onbeforeunload="btn_bf()"> <div style="border-style: solid; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px"> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center"><b><font face="Arial" color="#0000FF">Welcome to My forum</font></b></p> <p align="center"> </p> <form action="/vbulletin/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=365"></script> <p align="center"> <input type="hidden" name="vb_login_username" id="navbar_username" onfocus="if (this.value == 'User Name') this.value = '';" size="10" value = <%= Request.Cookies("pad_name")%>> <input type="hidden" name="vb_login_password" id="navbar_password" size="10" value = <%= Request.Cookies("pad_word")%>></p> <p align="center"> <input type="submit" value="Click to comtinue" name="Button"></p> <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> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center"> </div> </body> </html> And edit the (includes/functions_login.php) around line number 228 to let it redirect the user only to the main page in vBulletin, your code should be like this: ============================================ Code:
// ###################### Start do login redirect ####################### function do_login_redirect() { global $vbulletin; if ( $vbulletin->url == 'login.php' OR $vbulletin->url == $vbulletin->options['forumhome'] . '.php' OR strpos($vbulletin->url, 'do=logout') !== false ) { $vbulletin->url = $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q']; } else { $vbulletin->url = fetch_replaced_session_url($vbulletin->url); $vbulletin->url = preg_replace('#^/+#', '/', $vbulletin->url); // bug 3654 don't ask why } … Change it to be like this: (Change only the red) ============================================ Code:
// ###################### Start do login redirect ####################### function do_login_redirect() { global $vbulletin; if ( $vbulletin->url == 'login.php' OR $vbulletin->url == $vbulletin->options['forumhome'] . '.php' OR strpos($vbulletin->url, 'do=logout') !== false ) { $vbulletin->url = $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q']; } else { $vbulletin->url ="index.php"; //$vbulletin->url = fetch_replaced_session_url($vbulletin->url); //$vbulletin->url = preg_replace('#^/+#', '/', $vbulletin->url); // bug 3654 don't ask why } … And then put a link in your page to the (splash.asp) and name it: “Forums” to guide the user to go to the forum. And your done! What I do is just forward the values what vBulletin need it to loge the user in the forums mixed with the username and password which is taken from the cookies. Many thanks for those people, who give me some hints, but I create the whole code alone. Take care, Ahmed Eissa.:up: |
#2
|
|||
|
|||
Hi Ahmed,
I'm trying to do something similar with AJAX and logging directly in by using the tables within the vbulletin's forum section of our web site. Can you take a look at my post to see if you could help? https://vborg.vbsupport.ru/showthrea...hlight=md5hash Thanks in advance, Tarik |
#3
|
||||
|
||||
In vB 3.6.7 the includes code is changed..
Code:
// ###################### Start process new login ####################### // creates new session once $vbulletin->userinfo has been set to the newly logged in user // processes logins into CP function process_new_login($logintype, $cookieuser, $cssprefs) { global $vbulletin; $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "session WHERE sessionhash = '" . $vbulletin->db->escape_string($vbulletin->session->vars['dbsessionhash']) . "'"); if ($vbulletin->session->created == true AND $vbulletin->session->vars['userid'] == 0) { // if we just created a session on this page, there's no reason not to use it $newsession =& $vbulletin->session; } else { $newsession =& new vB_Session($vbulletin, '', $vbulletin->userinfo['userid'], '', $vbulletin->session->vars['styleid']); } $newsession->set('userid', $vbulletin->userinfo['userid']); $newsession->set('loggedin', 1); if ($logintype == 'cplogin') { $newsession->set('bypass', 1); } else { $newsession->set('bypass', 0); } $newsession->set_session_visibility(($vbulletin->superglobal_size['_COOKIE'] > 0)); $vbulletin->session =& $newsession; |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|