2016-04-07, 01:32 AM
2016-04-07, 04:06 AM
Hi xkevin,
Have you checked plugin hooks ?
http://docs.mybb.com/1.8/development/plugins/hooks/
If it's not than probably you can add custom code.
Have you checked plugin hooks ?
http://docs.mybb.com/1.8/development/plugins/hooks/
If it's not than probably you can add custom code.
2016-04-07, 05:18 AM
I don't know how to use that. But I am thinking to add session_start code. But where do i put this?
I tried looking every file and I found something maybe related in creating a session.
First in global.php [line 51]
second is in class_session.php [line 466]
I tried looking every file and I found something maybe related in creating a session.
First in global.php [line 51]
// Create session for this user
require_once MYBB_ROOT.'inc/class_session.php';
$session = new session;
$session->init();
$mybb->session = &$session;
$mybb->user['ismoderator'] = is_moderator('', '', $mybb->user['uid']);
second is in class_session.php [line 466]
function create_session($uid=0)
{
global $db;
$speciallocs = $this->get_special_locations();
ini_set('session.save_path',realpath(dirname($_SERVER['DOCUMENT_ROOT']) . '/site_sessions'));
// If there is a proper uid, delete by uid.
if($uid > 0)
{
$db->delete_query("sessions", "uid='{$uid}'");
$onlinedata['uid'] = $uid;
}
// Is a spider - delete all other spider references
else if($this->is_spider == true)
{
$db->delete_query("sessions", "sid='{$this->sid}'");
}
// Else delete by ip.
else
{
$db->delete_query("sessions", "ip=".$db->escape_binary($this->packedip));
$onlinedata['uid'] = 0;
}
// If the user is a search enginge spider, ...
if($this->is_spider == true)
{
$onlinedata['sid'] = $this->sid;
}
else
{
$onlinedata['sid'] = md5(uniqid(microtime(true), true));
}
$onlinedata['time'] = TIME_NOW;
$onlinedata['ip'] = $db->escape_binary($this->packedip);
$onlinedata['location'] = $db->escape_string(substr(get_current_location(), 0, 150));
$onlinedata['useragent'] = $db->escape_string(my_substr($this->useragent, 0, 100));
$onlinedata['location1'] = (int)$speciallocs['1'];
$onlinedata['location2'] = (int)$speciallocs['2'];
$onlinedata['nopermission'] = 0;
$db->replace_query("sessions", $onlinedata, "sid", false);
$this->sid = $onlinedata['sid'];
$this->uid = $onlinedata['uid'];
}
2016-04-07, 09:11 AM
MyBB doesn't use PHP sessions hence there is no session_start().
2016-04-07, 10:10 AM
First of all: What do you need?
2016-04-11, 12:04 AM
What i need is to save session. For sso purpose.
2016-04-12, 12:29 AM
(2016-04-07, 09:11 AM)StefanT Wrote: [ -> ]MyBB doesn't use PHP sessions hence there is no session_start().
Is it possible to add customized code for sessions? As the user log in ,session will be save in a folder using session_save_path.
2016-04-12, 01:52 AM
It is possible if you edit the file you mentioned - inc/class_session.php