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
  #92  
Old 12-25-2004, 02:51 AM
T3MEDIA T3MEDIA is offline
 
Join Date: Dec 2004
Posts: 944
Благодарил(а): 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.

PHP Code:
chdir("forum/"); 
require(
'./global.php');  
chdir("../); 
cheers!
Woah was on your site vbmechanic... there are a LOT of unhappy customers. Glad I didnt buy anything form you!
Reply With Quote
  #93  
Old 01-25-2005, 03:32 AM
GuppyWithAGun GuppyWithAGun is offline
 
Join Date: Oct 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am getting these errors at the bottom of my page... any ideas why? I am able to get it to log in and show detail find. The only problem i am running into is this.
Code:
Warning: mysql_query(): 7 is not a valid MySQL-Link resource in /home/guppy/public_html/forums/includes/db_mysql.php on line 212

Warning: mysql_error(): 7 is not a valid MySQL-Link resource in /home/guppy/public_html/forums/includes/db_mysql.php on line 357

Warning: mysql_errno(): 7 is not a valid MySQL-Link resource in /home/guppy/public_html/forums/includes/db_mysql.php on line 358

Warning: mysql_query(): 7 is not a valid MySQL-Link resource in /home/guppy/public_html/forums/includes/db_mysql.php on line 212

Warning: mysql_error(): 7 is not a valid MySQL-Link resource in /home/guppy/public_html/forums/includes/db_mysql.php on line 357

Warning: mysql_errno(): 7 is not a valid MySQL-Link resource in /home/guppy/public_html/forums/includes/db_mysql.php on line 358
Reply With Quote
  #94  
Old 01-26-2005, 04:39 PM
PTO PTO is offline
 
Join Date: Jul 2004
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

someone help please =)
Im getting this error:

Code:
Unable to add cookies, header already sent.
File: /home/invictus/public_html/rbar1_info.php
Line: 4
here is my current code:

top page
Code:
<?
chdir("forum/");
include('forum/global.php');   

// added this line to include the user functions which
// has the fetch_avatar_url() function
include('./includes/functions_user.php');

chdir("../");
?>
where i want login
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="/forum/" . $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='/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>
                        <?

}

?>
Reply With Quote
  #95  
Old 02-07-2005, 03:48 AM
dtsp dtsp is offline
 
Join Date: Nov 2002
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok everything goes alright except..when i add

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

to my index.php page of my non vb page it displays the forum login (not the

<?

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_md5pa ssword)'>
<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>
<?

}

?>

) but the actual login page for the index.php of the forum (unregistered login page)
and it doesn't show any the original html of non-vb index page.

can someone help me with that? plz
Reply With Quote
  #96  
Old 02-24-2005, 03:09 PM
morphistation morphistation is offline
 
Join Date: Feb 2005
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For those that where looking for the script to redirect you to the forums after login:

PHP Code:
<?php 
  chdir
("forum/"); 
require(
'./global.php');   
chdir("../"); 
if (
$bbuserinfo['userid']!=0) { 
$username=$bbuserinfo['username']; 
   
header("Location: http://www.exmaple.com/forum/index.php");

} else { 
?> 
<html>
<head>
</head>

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



?> 
</body>
</html>
Reply With Quote
  #97  
Old 02-24-2005, 10:20 PM
asimply1 asimply1 is offline
 
Join Date: Feb 2004
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by morphistation
For those that where looking for the script to redirect you to the forums after login:

PHP Code:
<?php 
  chdir
("forum/"); 
require(
'./global.php');   
chdir("../"); 
if (
$bbuserinfo['userid']!=0) { 
$username=$bbuserinfo['username']; 
   
header("Location: http://www.exmaple.com/forum/index.php");

} else { 
?> 
<html>
<head>
</head>

<body>
<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' /> 
        <input type="hidden" name="url" value="http://localhost/vb2"/>
        </form> 
                        <? 



?> 
</body>
</html>
only add
<input type='hidden' name='do' value='login' />
<input type='hidden' name='forceredirect' value='1' />
<input type='hidden' name='vb_login_md5password' />
<input type="hidden" name="url" value="http://localhost/vb2"/>
Reply With Quote
  #98  
Old 02-25-2005, 01:26 PM
morphistation morphistation is offline
 
Join Date: Feb 2005
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

haha was thinking in a one track mind yesterday apparently... just shows how there are many ways to do things.

:squareeyed:
Reply With Quote
  #99  
Old 03-24-2005, 05:36 AM
dtsp dtsp is offline
 
Join Date: Nov 2002
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<?php

require("http://www.url.com/forum/global.php");

?>

<html>
<head>
</head>

<body>
<?

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

print("<align='center'><span class='sectionheader'>Welcome back, $username!<br>");

} else {


?>

<form action='http://www.url.com/forum/login.php' method='post' onsubmit='md5hash(vb_login_password,vb_login_md5pa ssword)'>
<script type='text/javascript' src='http://www.url.com/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" onfocus="if (this.value == 'User Name') 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' />
<input type="hidden" name="url" value="http://www.url.com/forum"/>
</form>
<?

}

?>
</body>
</html>

the above works for me but now i have another problem...i need it to remember the person that logged in on the non vb page. anybody got any suggestions?
Reply With Quote
  #100  
Old 03-29-2005, 10:26 AM
Matrixgl Matrixgl is offline
 
Join Date: Sep 2002
Location: Canada
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

followed the instructions

Code:
chdir("/home/&&&&&&/public_html/forums/");
include('./global.php');   
chdir("/home/&&&&&&/public_html/site/");
gives me a
Code:
Warning: main(): Failed opening '' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /index.php on line 16
on site.com/site/

vb 3.0.7
Reply With Quote
  #101  
Old 04-17-2005, 04:55 PM
jamesyfx jamesyfx is offline
 
Join Date: Jan 2005
Location: Manchester, UK
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have a problem, when I'm logged in, it works fine.

When I'm logged out, I get
Code:
Warning: array_keys(): The first argument should be an array in /includes/functions.php on line 2128

Warning: Empty regular expression in /includes/functions.php on line 2128
I'm using 3.0.7. :P Thanks.
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 01:33 AM.


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.05121 seconds
  • Memory Usage 2,354KB
  • 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
  • (7)bbcode_code
  • (5)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
  • (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