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
  #102  
Old 04-17-2005, 07:54 PM
Umpakati Umpakati is offline
 
Join Date: Mar 2005
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To redirect a user back to where he was when he logged in (instead of to the main forum page)...

Find:
PHP Code:
print("<align='center'><span class='sectionheader'>Welcome back, $username!<br>"); 
Add Below:
PHP Code:
foreach($_GET as $option => $value){ 
     if(
$add_to_link != NULL){ 
     
$add_to_link .= "&$option=$value"
     } else { 
     
$add_to_link "?$option=$value"
     } 


Find:
PHP Code:
<input type='hidden' name='vb_login_md5password' /> 
Add Below:
PHP Code:
<input type="hidden" name="url" value="<?php echo $_SERVER[PHP_SELF].$add_to_link;?>"/>
Reply With Quote
  #103  
Old 04-18-2005, 01:26 PM
Paul_Hollibone Paul_Hollibone is offline
 
Join Date: Apr 2005
Location: Australia
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey all, with this script, I have it currently on my site of www.defunction.net

And want to know, is there anyway of adding a link for looged in members to logout?

As of yet, I have tried putting an <a href> link in there, but haven't been very sucsessfull. Any help, or advice would be great.
Reply With Quote
  #104  
Old 04-20-2005, 01:13 PM
Paul_Hollibone Paul_Hollibone is offline
 
Join Date: Apr 2005
Location: Australia
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bump!
Reply With Quote
  #105  
Old 04-26-2005, 09:55 PM
Umpakati Umpakati is offline
 
Join Date: Mar 2005
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have a problem with the include part at the top of the script... it takes me to the forum index.php instead of my regular homepage!
Reply With Quote
  #106  
Old 05-09-2005, 05:35 AM
Six-Out Six-Out is offline
 
Join Date: Mar 2005
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I get a parse error

Unexpected $ in line 170

when line 170 is </html>

any ideas on that?
Reply With Quote
  #107  
Old 05-18-2005, 12:24 AM
theinz theinz is offline
 
Join Date: May 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

MCAHill - This works excellent for me. Thank you so much for posting this. Solved a lot of my problems.

Question: How do you address the page when you enter a false ID or pass. I can't get it to go back to my homepage. thank you!

T.H.
Reply With Quote
  #108  
Old 06-07-2005, 12:35 AM
psychonaut psychonaut is offline
 
Join Date: Jun 2005
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was having trouble using this method without generating errors. I found the solution and thought I would share it.

The code at the begining:
<?php
chdir("forum/");
require('./global.php');
chdir("../");
?>

This can cause problems if your vB uses a different DB since it connects to that DB and then returns but never reconnects to the orginial DB. This cause mysql fetch array errors for me.

Add this line after the last chdir:
mysql_select_db("your_mainDB_name_goes_here");

Should look like this now:
<?php
chdir("forum/");
require('./global.php');
chdir("../");
mysql_select_db("your_mainDB_name_goes_here");
?>


Next, make sure you have the same admin user for the forum DB also listed as a user in the main DB will all permissions. If not, create a matching forum admin account in your main DB.

This should clear up any issues when using this with 2 DB's.

Enjoy! :ninja:
Reply With Quote
  #109  
Old 06-08-2005, 08:22 AM
L3e L3e is offline
 
Join Date: Dec 2003
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey, I installed this script, and it worked fine on the same domain... but I want this to work on a different domain than what the forum is on.

I have tried changing the directory for it to find the global.php like this:
<?
chdir("/home/vgcorec/public_html/forum");
require('./global.php');
chdir("/home/xbcore/public_html/");
?>

and I have also tried just running it on the vgcorec site and then using a php include on the xbcore site and it does not work right.

It shows the login forms, but it will not detect that you are already logged in if you are.

Also, the two sites are on the same server.

Please help!
Reply With Quote
  #110  
Old 06-24-2005, 12:57 PM
mismatch mismatch is offline
 
Join Date: Apr 2003
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is great THANKS!! works lovely!
Reply With Quote
  #111  
Old 06-26-2005, 01:07 PM
Xtremist Xtremist is offline
 
Join Date: May 2005
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

any idea how to fix this error i get

this is what the code looks like on my page

PHP Code:
<?php 
  chdir
("forum/"); 
require(
'./global.php');   
chdir("../); 
?> 


<? 


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> 
                        <? 



?>
This is the error i get

Code:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ross/public_html/login.php on line 11
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:52 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.07510 seconds
  • Memory Usage 2,332KB
  • Queries Executed 25 (?)
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_code
  • (7)bbcode_php
  • (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
  • (4)pagenav_pagelink
  • (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_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