forked from FrancescoBorzi/TC-Quest-Tracker
-
Notifications
You must be signed in to change notification settings - Fork 2
/
server_processing.php
39 lines (28 loc) · 1.5 KB
/
server_processing.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
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require_once("config.php");
$table = "(SELECT id, quest_abandon_time, quest_complete_time FROM " . $mysql_characters . ".quest_tracker) AS t1 ";
$table .= "JOIN (SELECT ID, LogTitle FROM " . $mysql_world . ".quest_template) AS t2 ";
$table .= "ON t1.id = t2.ID ";
$group_by = " GROUP BY t1.id ";
$primaryKey = 't1.id';
$columns = array(
array( 'db' => 't1.id as id', 'name' => 'id', 'where' => 't1.id', 'dt' => 0 ),
array( 'db' => 't2.LogTitle as title', 'name' => 'title', 'where' => 't2.LogTitle', 'dt' => 1,
'formatter' => function( $data, $row ) {
return '<a href="' . quest_url . $row['id'] . '" target="_blank">' . $row['title'] . '</a>';
} ),
array( 'db' => 'COUNT(t1.quest_abandon_time) AS abandoned_times', 'name' => 'abandoned_times', 'where' => '', 'dt' => 2 ),
array( 'db' => 'COUNT(t1.quest_complete_time) AS completed_times', 'name' => 'completed_times', 'where' => '', 'dt' => 3 ),
array( 'db' => 'MAX(t1.quest_abandon_time) AS last_abandoned', 'name' => 'last_abandoned', 'where' => 't1.quest_abandon_time', 'dt' => 4 ),
array( 'db' => 'MAX(t1.quest_complete_time) AS last_completed', 'name' => 'last_completed', 'where' => 't1.quest_complete_time', 'dt' => 5)
);
$sql_details = array(
'user' => $mysql_username,
'pass' => $mysql_password,
'db' => $mysql_world,
'host' => $mysql_host
);
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $group_by)
);