vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   VB Login on a Non-VB Page vB3 RC3 (https://vborg.vbsupport.ru/showthread.php?t=61112)

mcahill 02-02-2004 10:00 PM

VB Login on a Non-VB Page vB3 RC3
 
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.

vbmechanic 02-03-2004 01:18 PM

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!

buro9 02-03-2004 02:11 PM

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.

VeoMorphine 02-04-2004 10:50 AM

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.

apokphp 02-05-2004 02:17 AM

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?

Wired1 02-05-2004 02:45 AM

Using <? just tells the server that PHP code is coming. It's still PHP, which is a server side thing. HTML is user side.

apokphp 02-05-2004 03:48 AM

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.

mcahill 02-05-2004 09:18 PM

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.

Oxcide 02-05-2004 10:20 PM

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');

mcncyo 02-07-2004 10:37 AM

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


All times are GMT. The time now is 07:45 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01363 seconds
  • Memory Usage 1,748KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete