Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 10-06-2005, 12:32 PM
MajidOnline MajidOnline is offline
 
Join Date: Mar 2005
Location: In my clothes !
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default User ID in VB

Hello,

I whould like get ID of the users logged in, in my program .

How I can do it ? the user ID write in session or cookie ?

Thank you,
Majid
Reply With Quote
  #2  
Old 10-06-2005, 02:27 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You mean you want the userid of the user loading the page? Or of all online users?
Reply With Quote
  #3  
Old 10-08-2005, 10:15 AM
MajidOnline MajidOnline is offline
 
Join Date: Mar 2005
Location: In my clothes !
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarcoH64
You mean you want the userid of the user loading the page? Or of all online users?
I have written a program that the users can upload files .(I haven't programmed this program under the VB or forums program and it is something seperated).

Now I want to do sth that my user IDs would be saved in my database as they log in.

for instance When my forums system were PHPBB the user information was saved in a session that I could use it anywhere in my site.
Reply With Quote
  #4  
Old 12-26-2005, 06:51 AM
moondragon13 moondragon13 is offline
 
Join Date: Dec 2005
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am also looking for this information. I tried the following:

PHP Code:
require_once($_SERVER['DOCUMENT_ROOT'] . "/forums/global.php");
    
    
// IF USER IS LOGGED IN
    
if ($bbuserinfo[userid])
    {
        
// CODE TO EXECUTE IF USER IS LOGGED IN
        
echo 'logged in';
    }
    else
    {
        
// CODE IF USER IS NOT LOGGED IN
        
echo 'not logged in';
    } 
You would think this would work. I just need to verify the user is logged in when they are on other pages outside the forum.
Reply With Quote
  #5  
Old 12-26-2005, 08:23 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$vbulletin->userinfo['userid'] is the proper variable now days.

Though, requiring vbulletin's files may screw with the enviroment of your scripts.
Reply With Quote
  #6  
Old 12-26-2005, 09:53 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes you should be using $vbulletin->userinfo for vB3.5.

Also please note that you will have problems if you include global.php like that. You should first chdir() to your forum homedirectory, then require global.php, and if needed chdir back.
Reply With Quote
  #7  
Old 12-26-2005, 10:03 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not anymore Marco, ever wonder why all the requires() use "DIR" now?

Define DIR as the forum's full path, and you can require it like that.
Reply With Quote
  #8  
Old 12-26-2005, 11:48 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm i guess it would work if you manually define DIR.

Normal global.php is the exception to the DIR rule, since it will set it to the current directory if not set yet.
Reply With Quote
  #9  
Old 12-26-2005, 09:56 PM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Which is why you need to define it first, but at least you dont have to muck around with chdir anymore
Reply With Quote
  #10  
Old 12-26-2005, 10:10 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by merk
Not anymore Marco, ever wonder why all the requires() use "DIR" now?

Define DIR as the forum's full path, and you can require it like that.
Actually, if you look in the vb scripts, non of them use DIR to require global.php (because it's defined by init.php, which is called by global.php).
Reply With Quote
Reply

Thread Tools
Display Modes

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:45 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.04625 seconds
  • Memory Usage 2,248KB
  • Queries Executed 11 (?)
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)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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