vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   showing userid on non-vbulletin page isnt working (https://vborg.vbsupport.ru/showthread.php?t=196455)

DionDev 11-16-2008 04:13 PM

showing userid on non-vbulletin page isnt working
 
why is this simple php script not working?

Code:

<?php

chdir('./forums');
require_once('./global.php');

echo $vbulletin->userinfo['userid'];

?>


Lynne 11-16-2008 04:47 PM

add this after your require_once line:
PHP Code:

global $vbulletin


DionDev 11-16-2008 04:55 PM

its still not working
im logged in, but when i go to that page it shows the userid as 0

Code:

<?php

chdir('./forums');
require_once('./global.php');
global $vbulletin;

echo $vbulletin->userinfo['userid'];

?>


Lynne 11-16-2008 05:06 PM

Is that all you have in the page? You need to look at these: How to create your own vBulletin-powered page! (uses vB templates) or [How-To] vBulletin API Basics: Creating Custom Pages & Misc.

DionDev 11-16-2008 07:03 PM

yes, that is all i have on the page

your linked threads do not explain why this does not work.

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

god this is so frustrating. why cant this simple thing work? this is rediculous.

Lynne 11-16-2008 07:37 PM

It works just fine for me.

DionDev 11-16-2008 07:43 PM

http://www.wkdservers.co.uk/forums/index.php

username: tester
password: 123456

http://www.wkdservers.co.uk/vbtest.php

vbtest.php contains:

Code:

<?php

chdir('./forums');
require_once('./global.php');
global $vbulletin;

echo $vbulletin->userinfo['userid'];

?>

why wouldnt this work for me then?

Lynne 11-16-2008 07:51 PM

try:
PHP Code:

chdir('/full/path/to/forums'); 

Although, I just put it in my root directory as is and it worked fine for me. I'm not sure why it doesn't work on your site. Have you checked your error_logs?

edit: I'll bet it's a cookie thing. Make sure your cookie settings are default.

DionDev 11-16-2008 07:55 PM

using the full path in chdir changed nothing.

Lynne 11-16-2008 07:56 PM

Yeah, I'm pretty sure it's a cookie thing (I was editing my post when you posted). Make sure you haven't changed them at all - they should still be default.


All times are GMT. The time now is 09:20 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.01170 seconds
  • Memory Usage 1,733KB
  • 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_code_printable
  • (2)bbcode_php_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