public function validUserSession($app_id, $user_id, $access_token) { if ($app_id && $user_id && $access_token) { $check = $this->_db->select("user_session us", "us.session_id,us.device_token,us.mac_id,us.platform,us.user_id,u.name,u.email", "join user u on u.user_id=us.user_id", "where us.app_id='{$app_id}' and us.user_id='{$user_id}' and access_token='{$access_token}' and login_status='1'"); if ($check) { if ($this->_db->getNumRows() == 1) { self::$session_id = $this->_db->getFirst()['session_id']; self::$session_user_id = $this->_db->getFirst()['user_id']; self::$device_token = $this->_db->getFirst()['device_token']; self::$mac_id = $this->_db->getFirst()['mac_id']; self::$platform = $this->_db->getFirst()['platform']; self::$session_user_name = $this->_db->getFirst()['name']; self::$session_user_email = $this->_db->getFirst()['email']; self::$session_user_type = "user"; return true; } else { self::$VALIDATION["error"] = 1; self::$VALIDATION['status'] = 401; self::$VALIDATION['message'] = "Invalid access token."; } } else { self::$VALIDATION["error"] = 1; self::$VALIDATION['status'] = 401; self::$VALIDATION['message'] = "Invalid access parameters."; } } else { self::$VALIDATION["error"] = 1; self::$VALIDATION['status'] = 400; self::$VALIDATION['message'] = "Access parameters not given."; } return false; }