vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   User ID in VB (https://vborg.vbsupport.ru/showthread.php?t=97718)

MajidOnline 10-06-2005 12:32 PM

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

Marco van Herwaarden 10-06-2005 02:27 PM

You mean you want the userid of the user loading the page? Or of all online users?

MajidOnline 10-08-2005 10:15 AM

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.

moondragon13 12-26-2005 06:51 AM

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.

merk 12-26-2005 08:23 AM

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

Though, requiring vbulletin's files may screw with the enviroment of your scripts.

Marco van Herwaarden 12-26-2005 09:53 AM

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.

merk 12-26-2005 10:03 AM

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.

Marco van Herwaarden 12-26-2005 11:48 AM

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.

merk 12-26-2005 09:56 PM

Which is why you need to define it first, but at least you dont have to muck around with chdir anymore :)

Paul M 12-26-2005 10:10 PM

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).


All times are GMT. The time now is 11:09 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.00998 seconds
  • Memory Usage 1,737KB
  • 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_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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