forked from gi11es/btcfile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.php
26 lines (16 loc) · 770 Bytes
/
stats.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
require_once __DIR__.'/phplibs/utils.php';
Utils::options_headers();
Utils::no_cache_headers();
$json = array();
$results = DB::statement('SELECT COUNT(*) as count, SUM(size) AS size FROM ' . Utils::table('download_file')
. ' LEFT JOIN ' . Utils::table('download')
. ' ON ' . Utils::table('download_file'). '.id = ' . Utils::table('download') . '.id WHERE '
. Utils::table('download') . '.status != 1' , array());
$row = array_pop($results);
$json['files'] = $row['count'];
$json['size'] = $row['size'];
$results = DB::statement('SELECT SUM(paid) AS sum FROM ' . Utils::table('download_address') . ' WHERE status = :status', array(':status' => 10));
$row = array_pop($results);
$json['spent'] = $row['sum'];
echo json_encode($json);