PDA

View Full Version : sessions in vbulletin


kiril_cvetkov
08-03-2008, 01:20 PM
Hi. Is it ok to use a sessions in vbulletin?
Example :
1)Hook Location = Member Complete
2) I am writing in the hook the following code :
session_start();
$_SESSION['vbusername']=$prepared['username'];3)In file.php i am writinh the following code :

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'TEST'); // change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(

);

// get special data templates from the datastore
$specialtemplates = array(

);

// pre-cache templates used by all actions
$globaltemplates = array(
'KirilCvetkov',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
//################-Code of the modification #####################

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
session_start();
if (isset($_SESSION['vbusername']))
{
echo $_SESSION['vbusername'];
}


?>- am getting what i want.. but that is classic PHP... can i use that on vbulletin or there is other solution there.

Cheers Kiril..

MoT3rror
08-03-2008, 01:58 PM
vBulletin already has a its own session started when you include global.php so if you want to interact with their session here is a article (https://vborg.vbsupport.ru/showthread.php?t=152344&highlight=session).

Opserty
08-03-2008, 09:41 PM
vBulletin's session are stored in the database.

What exactly are you trying to achieve? There may be other possible solutions which are easier to implement.