Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
vjosset committed Jan 31, 2022
0 parents commit 1f61ee9
Show file tree
Hide file tree
Showing 379 changed files with 7,323 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
db.php
killteamjson/
33 changes: 33 additions & 0 deletions api/faction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
require_once $root . '/include.php';
global $dbcon;

header('Content-Type: application/json');
switch ($_SERVER['REQUEST_METHOD']) {
case "GET":
//Get the requested faction
GETFaction();
break;
default:
//Invalid verb
header('HTTP/1.0 500 Server Error - Invalid verb "' . $_SERVER['REQUEST_METHOD'] . '"');
die();
break;
}

function GETFaction() {
// Get the requested faction id
$factionid = $_REQUEST['factionid'];

if ($factionid == null || $factionid == '') {
// No faction id passed in, return all factions
$factions = Faction::GetFactions();
echo json_encode($factions);
} else {
// Return the requested faction
$faction = Faction::GetFaction($factionid);
echo json_encode($faction);
}
}
?>
38 changes: 38 additions & 0 deletions api/id.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
require_once $root . '/include.php';
global $dbcon;

header('Content-Type: application/json');
switch ($_SERVER['REQUEST_METHOD']) {
case "GET":
//Get the requested thing
GETID();
break;
default:
//Invalid verb
header('HTTP/1.0 500 Server Error - Invalid verb "' . $_SERVER['REQUEST_METHOD'] . '"');
die();
break;
}

function GETID() {
// Return a shortid
$chars = ['B', 'C', 'D', 'F', 'G', 'H', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];

$out = '';
$len = 10;
$blocksize = 1000;

for ($i = 0; $i < $len; $i++) {
if ($i % $blocksize == 0 && $i > 0) {
$out .= "-";
}
$out .= $chars[rand(0, sizeof($chars) - 1)];
}

echo $out;
}

?>

33 changes: 33 additions & 0 deletions api/killteam.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
require_once $root . '/include.php';
global $dbcon;

header('Content-Type: application/json');
switch ($_SERVER['REQUEST_METHOD']) {
case "GET":
//Get the requested killteam
GETKillteam();
break;
default:
//Invalid verb
header('HTTP/1.0 500 Server Error - Invalid verb "' . $_SERVER['REQUEST_METHOD'] . '"');
die();
break;
}

function GETKillteam() {
// Get the requested killteam id
$killteamid = $_REQUEST['killteamid'];

if ($killteamid == null || $killteamid == '') {
// No killteam id passed in, return all killteams
$killteams = Killteam::GetKillteams();
echo json_encode($killteams);
} else {
// Return the requested killteam
$killteam = Killteam::GetKillteam($killteamid);
echo json_encode($killteam);
}
}
?>
Loading

0 comments on commit 1f61ee9

Please sign in to comment.