PDA

View Full Version : Get userid & username from Non-vB page ?


Bergman
09-08-2004, 10:09 AM
In order to get OakGallery to work with vB 3.0.3 it would be really great if someone could help me with a PHP script.

The only thing i need to know how i can find out the userid & username for the user that runs the PHP script. Anyone who can help me out ? Please. :)

Dark_Wizard
09-08-2004, 11:11 AM
In order to get OakGallery to work with vB 3.0.3 it would be really great if someone could help me with a PHP script.

The only thing i need to know how i can find out the userid & username for the user that runs the PHP script. Anyone who can help me out ? Please. :)

At the top of the Oak script add this:

require_once('./global.php');


then to get the userid -> $bbuserinfo[userid] and for the username -> $bbuserinfo[username]

Bergman
09-08-2004, 11:48 AM
We have tested the following with no luck
require('./global.php');

and i dont think that
require_once('./global.php');

will do any diffrence. The first one worked fine with ver 2.3.0 version of the forum but after upgrade to 3.0.3 it does not work anymore. Maybe its something in 3.0.3´s global.php that makes the error.

But i will test the require_once thing when i comes home in 3 hours.

Colin F
09-08-2004, 11:52 AM
that shoudn't make a difference. You might have to adjust the path if the script is in a different directory than the vBulletin root folder.

Bergman
09-08-2004, 12:18 PM
Strange, my scripts finds the global.php and also loads it but it doesnt seem to find the id and name. It also makes the OakGallery unfunctional ... probably there is something in global.php that messes tha gallery up. Dont know what though.

http://217.215.89.49/fiskesnack/fotogalleri/index.php

Dark_Wizard
09-08-2004, 12:41 PM
Use this:

require_once('../forum/global.php');

Bergman
09-08-2004, 03:59 PM
Didnt work either ... it seems that a lot of variables (set in OakGallery) is resetted by global.php or some include-script.

Bergman
09-08-2004, 04:18 PM
When i remarken the Init.php script inclusion all variables was back ... dont understand how that one works. :(

Bergman
09-08-2004, 04:31 PM
Now i know what the problem are ... its the following section in Init.php that disables all neccessary variables for the OakGallery. Is it "safe" do disable it ?

-------------------------------------------------------------------------------
// ################################################## ###########################
// set which variables can pass through globals filter
$_allowedvars = array(
'GLOBALS', // of course :)
'_GET', // }
'_POST', // } system variables
'_COOKIE', // }
'_REQUEST', // }
'_SERVER', // }
'_ENV', // |
'_FILES', // }
'specialtemplates', // special templates from datastore table
'globaltemplates', // used for template cacheing
'actiontemplates', // templates for specific script actions
'phrasegroups', // phrase groups (in addition to 'global')
//'actionphrases', // phrase groups for specific actions
'noheader', // used to suppress the default vB headers
'nodb', // suppress database connection
'nozip', // suppress gzipping
'steptitles', // step titles for upgrade scripts
'pagestarttime', // microtime() from top of page
'_allowedvars', // this array :-)
'___db_user', // lycos has special variables
'___db_host', // lycos has special variables
);