Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

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
  #132  
Old 01-24-2006, 09:23 PM
Sai01 Sai01 is offline
 
Join Date: Dec 2004
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how do i make this work with vBExternal? they seems to have problems together...
Reply With Quote
  #133  
Old 01-24-2006, 10:06 PM
vtx1800 vtx1800 is offline
 
Join Date: Nov 2005
Location: California
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ausnrl
Ok im going to need a little help from someone good with PHP. What happens is i tried on 3.5 and its pretty good but what happens is i login it logs in but then on the main page it just comes up with the login will i need to make a new file and redirect that to the logged in page eg indexloggedin.php also i tried logging in and i check the forums it says i have visited in the last 15 minutes but i dont seem to be logged in!
Same problem, I log in, but it always asks to log in.

I checked the vB settings for the cookies, I am using the .domain.com setting. Don't see why it isn't working.
Reply With Quote
  #134  
Old 03-04-2006, 01:53 AM
manuka's Avatar
manuka manuka is offline
 
Join Date: Feb 2006
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by -animal-
the code works great but when i enter my login details, if the page changes to the "thanks for logging in" page and then back to the page that has the login forms. Is there anyway to say get it to not go to the thanks for loggin in page and then rather than just displaying the login boxed display the users avatar who just logged in?

thanks
yes there is - there are other threads about this topic - but basically you need to hack into the vb code and adapt it for use on non-vb pages - it's pretty basic php/html coding.
Reply With Quote
  #135  
Old 03-15-2006, 12:58 PM
Fallback Fallback is offline
 
Join Date: May 2005
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Question... with this code:

Quote:
<?php
chdir("forum/");
require('./global.php');
chdir("../);
?>
Say you add that on a non-vb page and your vB forum goes down it will render your non-vb page inaccessible. Is there any way to mod the code to ignore the "global.php" if say your forum database goes down?
Reply With Quote
  #136  
Old 04-23-2006, 12:07 AM
UnmodNick's Avatar
UnmodNick UnmodNick is offline
 
Join Date: Apr 2003
Location: St Louis, MO.
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've added this using the mod code that displays the avatar... everything works fine UNTIL I log off, at which point when I try to go to my non vB page displaying the login box or the welcome user info I get:

Code:
Unable to add cookies, header already sent.
File: /xxxx/xxxx/public_html/history/index.php
Line: 2
Any thoughts?

Here is the code I am using:

This is prior to the <html> & <head>:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php 
chdir("./forums"); 
include("./global.php");   
// added this line to include the user functions which 
// has the fetch_avatar_url() function
include("./includes/functions_user.php");
chdir("../"); 
?>
And this is in the body:
Code:
<? 
if ($bbuserinfo['userid']!=0) { 
    $username=$bbuserinfo['username']; 
    

    // i assigned the avatar url to the variable $user_av and check to see if it's empty.
    $user_av = fetch_avatar_url($bbuserinfo['userid']);
    if($user_av!='')
       $user_av="/forums/" . $user_av;  //replace "/forum/" with your virtual path to your forum pages.

    print("<align='center'><span class='sectionheader'>Welcome back, $username!<br>");
    
    //if the avatar url is not empty, display it
    if($user_av!='')
        print("<img src=\"" . $user_av . "\" vspace=4>"); 
} else { 
?> 
<form action='/forums/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> 
                        <? 

} 

?>
Reply With Quote
  #137  
Old 01-16-2008, 12:26 PM
boxerman boxerman is offline
 
Join Date: Jun 2007
Location: UK
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

will this work on vbulletin 3.6 L2? thanks

James
Reply With Quote
  #138  
Old 02-18-2008, 05:27 PM
whitesky_forum whitesky_forum is offline
 
Join Date: Feb 2008
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by boxerman View Post
will this work on vbulletin 3.6 L2? thanks

James
I Just got it working for vBulletin? v3.6.8 Patch Level 2. Did the following change

if ($vbulletin->userinfo['userid']!=0) {
$username=$vbulletin->userinfo['username'];

in place of

if ($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];

Still have to make the testing happen. But hope it work !
Reply With Quote
  #139  
Old 08-08-2008, 05:17 PM
CEO TaYloR? CEO TaYloR? is offline
 
Join Date: Aug 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok the logging in works great but when I log in it shows up as I haven't when it takes you back to the main page.
Reply With Quote
  #140  
Old 11-17-2008, 08:38 AM
msnhockey msnhockey is offline
 
Join Date: Jul 2008
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i am having the same problem as you are CEO TaYloR
Reply With Quote
  #141  
Old 01-31-2009, 10:52 AM
kwchan kwchan is offline
 
Join Date: Dec 2004
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

not working at all for me, i get all kinds of errors
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 02:58 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.05405 seconds
  • Memory Usage 2,322KB
  • Queries Executed 27 (?)
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_code
  • (2)bbcode_php
  • (4)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
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_postinfo_query
  • fetch_postinfo
  • 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