I did what you suggested and I couldn't produce the desired result from it. The change you can see is about the eleventh line down on the script I pasted in the message. Here is what the script looks like:
----------------------------------------------------------------------------------------------------------------------
public function getDBdata($session_id, $first) {
if ($session_id == 0) {
$_SESSION[$this->uid . 'is_guest'] = 1;
} else {
$_SESSION[$this->uid . 'is_guest'] = 0;
}
if ($_SESSION[$this->uid . 'is_guest'] == 0) {
if ($_SESSION[$this->uid . 'time'] online_time || isset($_SESSION[$this->uid . 'usr_name']) == false || $first == 'false') { //To consume less resources , now the query is made only once in 15 seconds
$query = "SELECT name FROM " . DBprefix . "users_entity WHERE guid='" . $session_id . "' LIMIT 1";
$res_obj = $this->db->query($query);
$res = $res_obj->fetchAll();
if ($res == null) {
$this->freichat_debug("Incorrect Query : " . $query . ", check parameters");
}
foreach ($res as $result) {
if (isset($result['username'])) { //To avoid undefined index error. Because empty results were shown sometimes
$_SESSION[$this->uid . 'usr_name'] = $result['usr_name'];
$_SESSION[$this->uid . 'usr_ses_id'] = $session_id;
}
}
}
} else {
$_SESSION[$this->uid . 'usr_name'] = $_SESSION[$this->uid . 'gst_nam'];
$_SESSION[$this->uid . 'usr_ses_id'] = $_SESSION[$this->uid . 'gst_ses_id'];
}
}
----------------------------------------------------------------------------------------------------------------------
Am I missing any other changes?
I did what you suggested and I couldn't produce the desired result from it. The change you can see is about the eleventh line down on the script I pasted in the message. Here is what the script looks like:
----------------------------------------------------------------------------------------------------------------------
<code>
public function getDBdata($session_id, $first) {
if ($session_id == 0) {
$_SESSION[$this->uid . 'is_guest'] = 1;
} else {
$_SESSION[$this->uid . 'is_guest'] = 0;
}
if ($_SESSION[$this->uid . 'is_guest'] == 0) {
if ($_SESSION[$this->uid . 'time'] < $this->online_time || isset($_SESSION[$this->uid . 'usr_name']) == false || $first == 'false') { //To consume less resources , now the query is made only once in 15 seconds
$query = "SELECT name FROM " . DBprefix . "users_entity WHERE guid='" . $session_id . "' LIMIT 1";
$res_obj = $this->db->query($query);
$res = $res_obj->fetchAll();
if ($res == null) {
$this->freichat_debug("Incorrect Query : " . $query . ", check parameters");
}
foreach ($res as $result) {
if (isset($result['username'])) { //To avoid undefined index error. Because empty results were shown sometimes
$_SESSION[$this->uid . 'usr_name'] = $result['usr_name'];
$_SESSION[$this->uid . 'usr_ses_id'] = $session_id;
}
}
}
} else {
$_SESSION[$this->uid . 'usr_name'] = $_SESSION[$this->uid . 'gst_nam'];
$_SESSION[$this->uid . 'usr_ses_id'] = $_SESSION[$this->uid . 'gst_ses_id'];
}
}
</code>
----------------------------------------------------------------------------------------------------------------------
Am I missing any other changes?