forked from jfm-so/piWallet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.php
More file actions
32 lines (31 loc) · 1.09 KB
/
api.php
File metadata and controls
32 lines (31 loc) · 1.09 KB
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
<?php
define("IN_WALLET", false);
include('common.php');
$con = mysqli_connect("$db_host","$db_user","$db_pass","$db_name");
$key = $_GET['key'];
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL. Make sure to edit the common.php file: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM users where secret = '$key' and authused=1");
while($row = mysqli_fetch_array($result)) {
$id = $row['id'];
$username = $row['username'];
$pin = $row['supportpin'];
$twofactoren = $row['authused'];
$isadmin = $row['admin'];
$client = new Client($rpc_host, $rpc_port, $rpc_user, $rpc_pass);
$apibal = $client->getBalance($username) - $fee;
$addr = $client->getAddress($username);
}
if ($isadmin == 1) {
$ifadmin = "true";
} else {
$ifadmin = "false";
}
if ($twofactoren == 1) {
$iftwofactor = "true";
} else {
$iftwofactor = "false";
}
echo json_encode(array("id" => "$id", "username" => "$username", "balance" => "$apibal", "addresses" => "$addr", "Support Pin" => "$pin", "Two Factor Enabled"=> "$iftwofactor", "admin" => "$ifadmin"));
?>