View Full Version : showing userid on non-vbulletin page isnt working
DionDev
11-16-2008, 04:13 PM
why is this simple php script not working?
<?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:
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
<?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) (https://vborg.vbsupport.ru/showthread.php?t=62164) or [How-To] vBulletin API Basics: Creating Custom Pages & Misc. (https://vborg.vbsupport.ru/showthread.php?t=98009)
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 1226871188 at 1226871188 ---------------
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:
<?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:
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.
DionDev
11-16-2008, 07:56 PM
the error logs show nothing
--------------- Added 1226873598 at 1226873598 ---------------
it was a cookie issue, lynne, i love you :D
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.