<?php
header('Content-Type: text/json');
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'globalban');
define('DB_PASSWORD', 'globalban');
define('DB_NAME', 'globalban');
try {
$dbh = new PDO('mysql:host='.DB_SERVER.';dbname='.DB_NAME, DB_USERNAME, DB_PASSWORD);
if($dbh === true) {
foreach ($dbh->query('SELECT * globalban') as $row) {
print_r($row);
}
}
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . '<br/>';
die();
}
$ip = $_GET['ip'];
$playerLicense = $_GET['playerLicense'];
$playerSteam = $_GET['playerSteam'];
$playerXbl = $_GET['playerXbl'];
$playerLive = $_GET['playerLive'];
$playerDisc = $_GET['playerDisc'];
//Wenn Parameter übergeben werden
if(!empty($ip) && !empty($playerLicense) && !empty($playerSteam) && !empty($playerXbl) && !empty($playerLive) && !empty($playerDisc)) {
$dbh = new PDO('mysql:host='.DB_SERVER.';dbname='.DB_NAME, DB_USERNAME, DB_PASSWORD);
$sth = $dbh->prepare("SELECT * FROM globalban WHERE ip = :ip AND playerLicense = :playerLicense AND playerSteam = :playerSteam AND playerXbl = :playerXbl AND playerLive = :playerLive AND playerDisc = :playerDisc LIMIT 1");
$sth->bindParam(':ip', $ip);
$sth->bindValue(':playerLicense', $playerLicense);
$sth->bindParam(':playerSteam', $playerSteam);
$sth->bindValue(':playerXbl', $playerXbl);
$sth->bindValue(':playerLive', $playerLive);
$sth->bindValue(':playerDisc', $playerDisc);
$sth->execute();
$row = $sth->fetch(PDO::FETCH_OBJ);
//print_r($row);
$json = array(
'status' => 'Found',
'result' => [
'ip' => 'Redacted',
'License Hash' => $row->playerLicense,
'Steam ID' => $row->playerSteam,
'XBox Live ID' => $row->playerXbl,
'Live ID' => $row->playerLive,
'Discord ID' => $row->playerDisc,
],
'reason' => [
'Ban Reason' => $row->banReason,
],
);
echo json_encode($json);
//Wenn Parameter Leer sind
} else if(empty($ip) && empty($playerLicense) && empty($playerSteam) && empty($playerXbl) && empty($playerLive) && empty($playerDisc)) {
$json = array(
[
'error' => 'Only PostRequest Allowed :(',
],
);
echo json_encode($json);
// Wenn kein Eintrag vorhanden ist
} else {
$json = array(
[
'status' => 'Ok',
],
);
echo json_encode($json);
}
Alles anzeigen