vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Welcome "Username" Screen after Login (https://vborg.vbsupport.ru/showthread.php?t=191604)

sector77 09-22-2008 09:37 PM

Welcome "Username" Screen after Login
 
Hello everyone! I've been using vb for quite a while but am only now attempting to integrate the log in screen on an outside .php home page. In other words, I want people to have the ability to log in to my site (www.trancesessions.com) and be able to see every page (including the forum) as a member.

I was able to set up the username/pw log in screen on the home page (www.trancesessions.com). But I have two problems. One, once the member logs in successfully, it takes that member directly to the forum (which is ok and I know how to change where it routes them to).

What I would like to do is make it so that once the person logs in, they are taken back to the same page but instead of seeing the username/pw boxes, they'll see a welcome 'username' area that is similar to the welcome message you get when you log in directly to the forum.

Does anyone have any idea how to do this or what code I can use to achieve this? I'm sorry if I did a bad job of explaining it and will elaborate to the best of my ability if you have any questions.

Thank you for any help!!!

PS. This is currently the code I have on the home page for the log in screen:

Code:

<!-- login form -->
                <form action="forums/login.php" method="post" onsubmit="md5hash(vb_login_password,vb_login_md5password,vb_login_md5password_utf)">
                  <div align="left">

                    <script type="text/javascript" src="forums/clientscript/vbulletin_md5.js"></script>
                  <font face="Verdana, Arial, Helvetica, sans-serif" size="-2">
                  Username:
                  <br>
                  <input type="text" class="button" name="vb_login_username" id="navbar_username" size="20" accesskey="u" tabindex="1" onFocus="if (this.value == 'Username') this.value = '';" />                 
                  <br />
                  Password:
                  </font>
                  <br>
                  <input type="password" class="button" name="vb_login_password" size="20" accesskey="p" tabindex="2" />

                  <input type="submit" class="button" value="Login" tabindex="4" title="" accesskey="s"/>
                  </div>
                  <div align="left">
                  <input type="checkbox" name="cookieuser" value="1" tabindex="3" id="cb_cookieuser_navbar" accesskey="c" checked="checked" />
                  <font face="Verdana, Arial, Helvetica, sans-serif" size="-2">
                  Remember Me
                  </font>
                  </label>
                  </div>

                  <br>
                  <div align="left">
                  <font face="Verdana, Arial, Helvetica, sans-serif" size="-2">
                  Not a member?
                  <a href="http://www.trancesessions.com/forums/register.php">Register Here</a>
                  </font>
                  </div>
                  <input type="hidden" name="s" value="" />
                  <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="vb_login_md5password_utf" />
                  <input type="hidden" name="url" value="http://www.trancesessions.com/forums" />
                    </div>
                </form>
                <!-- / login form -->


Dismounted 09-23-2008 05:52 AM

You need to include vBulletin's global.php - then you can use its variables to check if someone is logged in, etc.

sector77 09-23-2008 08:06 PM

Quote:

Originally Posted by Dismounted (Post 1628297)
You need to include vBulletin's global.php - then you can use its variables to check if someone is logged in, etc.

o man...i'm such a noob lol... when you say include global.php i know where to locate that file but how would i include it? i guess i just dont know what steps to do that would be....

any suggestions?

ty for your earlier reply

Jacob B 09-24-2008 01:55 AM

You need to put this code in your PHP file after you've set the PHP environment.

PHP Code:

// ########################## REQUIRE BACK-END ############################ 
require_once('./global.php'); 


sector77 09-24-2008 02:07 AM

aww man....now i'm getting really confused lol haha...i'm looking at the code on my index.php page (non-vb page) and it's really throwing me off....


ok....

does anyone know what code i would need to put exactly on the home page? and then again what code would i need to put in the global.php file?

i'm so confused....do i even need to do all that?

thanks

--------------- Added [DATE]1222225967[/DATE] at [TIME]1222225967[/TIME] ---------------

Quote:

Originally Posted by Jacob B (Post 1628975)
You need to put this code in your PHP file after you've set the PHP environment.

PHP Code:

// ########################## REQUIRE BACK-END ############################ 
require_once('./global.php'); 


i think i'm not understanding exactly where to put that code you gave me....and then on top of that....what i would need to do to 'set the PHP environment'

does the code you gave me need to be inserted on the (non vb page) i have or does it need to be inserted in the vbulletin 'global.php' file?


thank you jacob for putting up with this noob! lol

Jacob B 09-24-2008 05:03 AM

Quote:

does anyone know what code i would need to put exactly on the home page? and then again what code would i need to put in the global.php file?
Nothing should be inserted into your global.php file unless told to do so by a member of staff at www.vbulletin.com as part of a support issue.

Quote:

i think i'm not understanding exactly where to put that code you gave me....and then on top of that....what i would need to do to 'set the PHP environment'
When you're creating a vBulletin-powered page, it requires a PHP file to get it up and running if you want to include user accounts, etc. There are many articles available to do this, including this one here. I firmly suggest reading over that particular article to get a feel for using vBulletin PHP.

Here is how a standard vBulletin-powered page should look (this one is called test.php, taken from the article posted above):

PHP Code:

<?php 

// ######################## SET PHP ENVIRONMENT ########################### 
error_reporting(E_ALL & ~E_NOTICE); 

// ##################### DEFINE IMPORTANT CONSTANTS ####################### 
// change the line below to the actual filename without ".php" extention. 
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation. 

define('THIS_SCRIPT''test');  

// #################### PRE-CACHE TEMPLATES AND DATA ###################### 
// get special phrase groups 
$phrasegroups = array(); 

// get special data templates from the datastore 
$specialtemplates = array(); 

// pre-cache templates used by all actions 
$globaltemplates = array( 
        
// change the lines below to the list of actual templates used in the script 
        
'test_mytesttemplate1'
        
'test_mytesttemplate22'
); 

// pre-cache templates used by specific actions 
$actiontemplates = array(); 

// ########################## REQUIRE BACK-END ############################ 
require_once('./global.php'); 

// #################### HARD CODE JAVASCRIPT PATHS ######################## 
$headinclude str_replace('clientscript'$vbulletin->options['bburl'] . '/clientscript'$headinclude); 

// ######################################################################## 
// ######################### START MAIN SCRIPT ############################ 
// ######################################################################## 

$navbits = array();  
// change the line below to contain whatever you want to show in the navbar (title of your custom page) 
$navbits[$parent] = 'Test Page'

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 

// change the line below to contain the name of the actual main output template used in your script 
eval('print_output("' fetch_template('test_mytesttemplate1') . '");'); 

?>

Do you see how he's inserted his global.php file? That's what you need to do. Then you can use variables such as: $username, $bbuserinfo[userid], etc.


All times are GMT. The time now is 01:03 PM.

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.01181 seconds
  • Memory Usage 1,763KB
  • 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
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete