diff --git a/current-auctions.php b/current-auctions.php new file mode 100644 index 0000000..9656463 --- /dev/null +++ b/current-auctions.php @@ -0,0 +1,45 @@ +query($query); + + $json = array(); + + while($details = $stmt->fetch(PDO::FETCH_ASSOC)){ + $json[] = $details; + } + + array_walk_recursive($json, function (&$item, $key) { + $item = null === $item ? '' : $item; + }); + + echo json_encode($json, JSON_NUMERIC_CHECK); +} +catch(PDOException $e){ + echo ($e->getMessage()); +} +?> \ No newline at end of file diff --git a/current-gcw.php b/current-gcw.php new file mode 100644 index 0000000..a6f202e --- /dev/null +++ b/current-gcw.php @@ -0,0 +1,122 @@ + 0 + or + po.current_pvp_kills > 0"; + + $stmt = $conn->query($query); + + $json = array(); + + while($details = $stmt->fetch(PDO::FETCH_ASSOC)){ + $json[] = $details; + } + + array_walk_recursive($json, function (&$item, $key) { + $item = null === $item ? '' : $item; + }); + + echo json_encode($json, JSON_NUMERIC_CHECK); +} +catch(PDOException $e){ + echo ($e->getMessage()); +} +?> \ No newline at end of file diff --git a/current-resources.php b/current-resources.php new file mode 100644 index 0000000..4343751 --- /dev/null +++ b/current-resources.php @@ -0,0 +1,41 @@ += (select last_save_time from clock)"; + + $stmt = $conn->query($query); + + $json = array(); + + while($details = $stmt->fetch(PDO::FETCH_ASSOC)){ + $attrs = explode(':',$details['ATTRIBUTES']); + foreach($attrs as $attr){ + if(sizeof(explode(' ', $attr)) != 2) continue; + list($attribute, $value) = explode(' ', $attr); + $obj[$attribute] = $value; + } + $details['ATTRIBUTES'] = $obj; + $json[] = $details; + unset($obj); + unset($attrs); + } + + array_walk_recursive($json, function (&$item, $key) { + $item = null === $item ? '' : $item; + }); + + echo json_encode($json, JSON_NUMERIC_CHECK); +} +catch(PDOException $e){ + echo ($e->getMessage()); +} +?> \ No newline at end of file diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..612f43e --- /dev/null +++ b/settings.json @@ -0,0 +1,7 @@ +{ + "serverIp": "192.168.0.95", + "dbPort": "1521", + "dbSid": "swg", + "dbUser": "swg", + "dbPass": "swg" +} \ No newline at end of file diff --git a/utils/data.php b/utils/data.php new file mode 100644 index 0000000..c6c44e6 --- /dev/null +++ b/utils/data.php @@ -0,0 +1,18 @@ +serverIp.")(PORT = ".$settings->dbPort.")) + ) + (CONNECT_DATA = + (SERVICE_NAME = ".$settings->dbSid.") + ) + )"; + return new PDO("oci:dbname=".$tns,$settings->dbUser,$settings->dbPass); +} + +?> \ No newline at end of file