예제 #1
0
파일: users.php 프로젝트: activehelper/core
                </User>
<?php 
        }
    }
}
?>

          </Online>
        <Pending>
<?php 
// PENDING USERS QUERY displays pending users not logged in on users users table depending on department settings
include '../import/settings_default.php';
//error_log("department:".$departments."\n", 3, "users.log");
if ($indicator_type == 1) {
    if ($departments == true && $current_department != '') {
        $sql = departmentsSQL($current_department);
        $query = "SELECT DISTINCT `id`, `username`, email, language, request FROM " . $table_prefix . "sessions WHERE (UNIX_TIMESTAMP(NOW())" . " - UNIX_TIMESTAMP(`refresh`)) < '{$connection_timeout}' AND `active` = '0' and id_agent='0' ";
        if ($sessions_set != '') {
            $query .= " and id in (" . $sessions_set . ") AND {$sql} ORDER BY `username`";
        } else {
            $query .= " and {$sql} ORDER BY `username`";
        }
    } else {
        $query = "SELECT DISTINCT `id`, `username`, email, language, request FROM " . $table_prefix . "sessions WHERE (UNIX_TIMESTAMP(NOW())" . " - UNIX_TIMESTAMP(`refresh`)) < '{$connection_timeout}' AND `active` = '0' and id_agent=0 ";
        if ($sessions_set != '') {
            $query .= " and id in (" . $sessions_set . ")  ORDER BY `username`";
        } else {
            $query .= " ORDER BY `username`";
        }
    }
} else {
예제 #2
0
function pendingUsersPopup($timeout)
{
    global $table_prefix;
    global $departments;
    global $current_department;
    global $SQL;
    // PENDING USERS QUERY displays pending users not logged in on users users table depending on department settings
    if ($departments == true) {
        $departments_sql = departmentsSQL($current_department);
        $query = "SELECT DISTINCT (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`datetime`)) AS `display` FROM " . $table_prefix . "sessions WHERE (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`refresh`)) < '{$timeout}' AND active = '0' AND {$departments_sql}";
    } else {
        $query = "SELECT DISTINCT (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`datetime`)) AS `display` FROM " . $table_prefix . "sessions WHERE (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`refresh`)) < '{$timeout}' AND active = '0'";
    }
    $rows = $SQL->selectall($query);
    // Initalise user status to false
    $user_status = 'false';
    if (is_array($rows)) {
        foreach ($rows as $key => $row) {
            if (is_array($row)) {
                $display_flag = $row['display'];
                if ($display_flag < $timeout) {
                    $user_status = 'true';
                }
            }
        }
    }
    return $user_status;
}