//1.1.2.1用户登录VPN时长汇总
require '../../include/init.inc.php';
$width = $height = $start_date = $end_date = $top = $search = $usercount = $ajaxMethod = $username = '';
$_GET['start_date'] = empty($_GET['start_date']) ? date("Y-m-d", time() - 86400) : $_GET['start_date'];
$_GET['end_date'] = empty($_GET['end_date']) ? date("Y-m-d", time()) : $_GET['end_date'];
$_GET['width'] = empty($_GET['width']) ? 800 : $_GET['width'];
$_GET['height'] = empty($_GET['height']) ? 720 : $_GET['height'];
$_GET['usercount'] = empty($_GET['usercount']) ? 20 : $_GET['usercount'];
$_GET['ajaxMethod'] = empty($_GET['ajaxMethod']) ? '' : $_GET['ajaxMethod'];
$_GET['username'] = empty($_GET['username']) ? '' : $_GET['username'];
extract($_GET, EXTR_IF_EXISTS);
//ajax请求
if (isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && strtolower($_SERVER["HTTP_X_REQUESTED_WITH"]) == "xmlhttprequest") {
    if ($ajaxMethod == 'showUserLoginTime') {
        $list = VpnCount::getUserLoginDetail($start_date, $end_date, $username);
        foreach ($list as &$item) {
            $item['TIMES'] = number_format($item['TIMES']);
        }
        $res = array();
        $res['list'] = $list;
        $res = json_encode($res);
        exit($res);
    } else {
        $count = array();
        if (empty($usercount)) {
            $count = VpnCount::getUserLoginAllTimeCount($start_date, $end_date, $width, $height);
        } else {
            $count = VpnCount::getTopUserLoginAllTimeCount($start_date, $end_date, $usercount, $width, $height);
        }
        $jpg = $count[0]['IMAGE'];