Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

Reply
 
Thread Tools
VB Login on a Non-VB Page vB3 RC3 Details »»
VB Login on a Non-VB Page vB3 RC3
Version: 1.00, by mcahill mcahill is offline
Developer Last Online: Dec 2012 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 02-02-2004 Last Update: Never Installs: 74
 
No support by the author.

This is a simple modification to do, and adds a lot of value to your homepage.

Notes:

1. This script can occassionally have conflicts with other javascripts. Test before you deploy.
2. If you use and include to put the file on your page, be sure that the chdir and the require for global.php is in the head of the main document.
3. It is assumed that you are using a php page, and that you have already got connectivity with your database.


The code:

At the top of the document, before the <html> or <head> tags (edit to provide the path for your particular installation):

PHP Code:
<?php
  chdir
("forum/");
require(
'./global.php');  
chdir("../); 
?>
Wherever you want your login:

PHP Code:
 <?
 

if ($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];
  
print("<align='center'><span class='sectionheader'>Welcome back, $username!<br>");

} else {
   


?>
<form action='/forum/login.php' method='post' onsubmit='md5hash(vb_login_password,vb_login_md5password)'>
        <script type='text/javascript' src='/forum/clientscript/vbulletin_md5.js'></script>
        
         <span class="sectionheader">Username:</span>
            <input type='text' class='button' name='vb_login_username' id='navbar_username' size='15' accesskey='u' tabindex='1' value='' onfocus='if (this.value == 'username') this.value = '';' /><br>
            
            <span class="sectionheader">Password:&nbsp;</span>
            <input type='password' class='button' name='vb_login_password' size='15' accesskey='p' tabindex='2' /><br>
            <input type='checkbox' name='cookieuser' value='1' tabindex='3' id='cb_cookieuser_navbar' accesskey='c' checked='checked' /><span class='sectionheader'>Remember Me</span><br>
        
        
        
        <input name="submit" type='submit' class='button' accesskey='s' tabindex='4' title='Log In' value='Log In' />
        <input type='hidden' name='do' value='login' />
        <input type='hidden' name='forceredirect' value='1' />            
        <input type='hidden' name='vb_login_md5password' />
        </form>
                        <?

 } 

?>
Troubleshooting:

Before requesting support, please check the following:

1. Make sure you have the path to your forum in the chdir. If you haven't done this, you will get a "can't include" error.
2. Make sure you have the chdir in the main document. If it isn't you will get a "can't modify header" error.
3. If those don't resolve the issue, try putting the login in a separate file, with no other code. If it works there, then you will know that you have a conflict with one of the scripts on the page you are trying to add the login to. I can't help you if you've got a conflict with another script.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 02-03-2004, 01:18 PM
vbmechanic vbmechanic is offline
 
Join Date: Jan 2004
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

One suggestion, if you chdir at the top of the program to include something, you should also chdir back to the original location so you don't disrupt any relative includes further down the code.

PHP Code:
chdir("forum/"); 
require(
'./global.php');  
chdir("../); 
cheers!
Reply With Quote
  #3  
Old 02-03-2004, 02:11 PM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by vbmechanic
One suggestion, if you chdir at the top of the program to include something, you should also chdir back to the original location so you don't disrupt any relative includes further down the code.
A further note on this is that vBulletin's XSS measures are now kicking arse... and if you were going to use the above within another PHP script and expected some inputs or other vars that you can't get hold of... it's because \includes\init.php

You will need to have fun in there to work out how to get to your vars.
Reply With Quote
  #4  
Old 02-04-2004, 10:50 AM
VeoMorphine VeoMorphine is offline
 
Join Date: Nov 2002
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmmmmmm...... Just a sugestion. Insted of writing out all the form code i think vbulletin has a make_login() or somthing like that function. But they way you did it offers more flex to it so, either way has its ups and downs.
Reply With Quote
  #5  
Old 02-05-2004, 02:17 AM
apokphp apokphp is offline
 
Join Date: Nov 2002
Posts: 440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What about if the page is html. I know your hack is for .php, but is it possible to use on html pages? Or should the html page be converted to .php? And if so, isn't that done just by adding the <?php tag?
Reply With Quote
  #6  
Old 02-05-2004, 02:45 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Using <? just tells the server that PHP code is coming. It's still PHP, which is a server side thing. HTML is user side.
Reply With Quote
  #7  
Old 02-05-2004, 03:48 AM
apokphp apokphp is offline
 
Join Date: Nov 2002
Posts: 440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My server has php. My index is html. I use vb as a forum. I'd like to use some form of vb logon on the front page which is not related to vb at all.
Reply With Quote
  #8  
Old 02-05-2004, 09:18 PM
mcahill mcahill is offline
 
Join Date: Apr 2002
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The page needs to be php. That means it has to have a .php extension. If you're running vB on the same server, you have php installed.

If the page has an html extension, it will not be processed by the server.
Reply With Quote
  #9  
Old 02-05-2004, 10:20 PM
Oxcide Oxcide is offline
 
Join Date: Feb 2004
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hehe, Apok has already seen this, to bad he never told me.

Anyway.

What if I want to use this on a remote server/site.

Should I include the remote database information above the chdir? And then use a URL to those files on the remote server? Or change it to connect to the server, and use the absolute path to the files?

Or is it as simple as doing

require('http://www.pathtoremoteserver.com/forums/global.php');
Reply With Quote
  #10  
Old 02-07-2004, 10:37 AM
mcncyo's Avatar
mcncyo mcncyo is offline
 
Join Date: Oct 2001
Location: derby, Kansas
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Oxcide
Hehe, Apok has already seen this, to bad he never told me.

Anyway.

What if I want to use this on a remote server/site.

Should I include the remote database information above the chdir? And then use a URL to those files on the remote server? Or change it to connect to the server, and use the absolute path to the files?

Or is it as simple as doing

require('http://www.pathtoremoteserver.com/forums/global.php');


I would also like to know how to do this but mine is on the same server
Reply With Quote
Reply

Thread Tools

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:40 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05184 seconds
  • Memory Usage 2,296KB
  • Queries Executed 23 (?)
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
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete