-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.php
37 lines (23 loc) · 792 Bytes
/
api.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
<?php
header("Content-Type: application/json; charset=UTF-8");
require_once 'app/require.php';
require_once 'app/controllers/ApiController.php';
$API = new ApiController;
// Check data
if (empty($_GET['user']) || empty($_GET['pass']) || empty($_GET['hwid']) || empty($_GET['key'])) {
$response = array('status' => 'failed', 'error' => 'Missing arguments');
} else {
$username = $_GET['user'];
$passwordHash = $_GET['pass'];
$hwidHash = $_GET['hwid'];
$key = $_GET['key'];
if (API_KEY === $key) {
// decode
$password = base64_decode($passwordHash);
$hwid = base64_decode($hwidHash);
$response = $API->getUserAPI($username, $password, $hwid);
} else {
$response = array('status' => 'failed', 'error' => 'Invalid API key');
}
}
echo (json_encode($response));