Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- header("Content-type: text/plain");
- error_reporting(0);
- $host = 'localhost'; //put your host here
- $user = 'space'; //in general is root
- $password = 'space'; //use your password here
- $dbname = 'space'; //your database
- mysql_connect($host, $user, $password) or die("Cant connect into database");
- mysql_select_db($dbname)or die("Cant connect into database");
- if ($_REQUEST["sector"] <> "") {
- $selcmd = "SELECT * FROM planets where sector='".$_REQUEST["sector"]."'";
- $result = mysql_query($selcmd) or die (mysql_error());
- while($row = mysql_fetch_array( $result )) {
- if ($row['ID'] > 0) {
- echo "".$row['ID'].",";
- echo "".$row['x'].",";
- echo "".$row['y'].",";
- echo "".$row['z'].",";
- if ($row['guid'] > 0) {
- $xselcmd = "SELECT Username FROM account where ID='".$row['guid']."'";
- $xresult = mysql_query($xselcmd) or die (mysql_error());
- while($xrow = mysql_fetch_array( $xresult )) {
- echo "".$xrow['Username'].",";
- }
- } else {
- echo ",";
- }
- echo "".$row['sector'].",";
- echo "".$row['name'].",";
- echo "".$row['type']."\n";
- }
- }
- exit;
- }
- if ($_REQUEST["planet"] > 0) {
- $selcmd = "SELECT * FROM resourcedata where guid='".$_REQUEST["planet"]."'";
- $result = mysql_query($selcmd) or die (mysql_error());
- while($row = mysql_fetch_array( $result )) {
- if ($row['ID'] > 0) {
- echo $row['restype'].",";
- echo $row['ResourceCount']."\n";
- }
- }
- exit;
- }
- if ($_REQUEST["restypes"] <> "") {
- $selcmd = "SELECT * FROM restypes";
- $result = mysql_query($selcmd) or die (mysql_error());
- while($row = mysql_fetch_array( $result )) {
- if ($row['ID'] > 0) {
- echo $row['ID'].",";
- echo $row['Type'].",";
- echo $row['resType']."\n";
- }
- }
- exit;
- }
- // *************************************************** ADDED ON - NOT IN JSON FILE
- if ($_REQUEST["buildingtypes"] <> "") {
- $selcmd = "SELECT * FROM buildingtypes";
- $result = mysql_query($selcmd) or die (mysql_error());
- while($row = mysql_fetch_array( $result )) {
- if ($row['ID'] > 0) {
- echo $row['ID'].",";
- echo $row['Name'].",";
- echo $row['BuildTime'].",";
- echo $row['ResourceModifier'].",";
- echo $row['Requirement']."\n";
- }
- }
- exit;
- }
- if ($_REQUEST["displaycity"] <> "") {
- $selcmd = "SELECT * FROM cities WHERE PlanetID='".$_REQUEST["displaycity"]."'";
- $result = mysql_query($selcmd) or die (mysql_error());
- while($row = mysql_fetch_array( $result )) {
- if ($row['ID'] > 0) {
- if ($row['x'] == '5') {
- if ($row['y'] == '10') {
- // 5,10 is command center - NEVER spit out another building for that spot
- }
- } else {
- echo $row['ID'].",";
- echo $row['UserID'].",";
- echo $row['BuildingEntry'].",";
- echo $row['x'].",";
- echo $row['y']."\n";
- }
- }
- }
- exit;
- }
- if ($_REQUEST["cityresources"] <> "") {
- $selcmd = "SELECT * FROM cityresources WHERE PlanetID='".$_REQUEST["cityresources"]."'";
- $result = mysql_query($selcmd) or die (mysql_error());
- while($row = mysql_fetch_array( $result )) {
- //echo $row['ID'].",";
- //echo $row['UserID'].",";
- //echo $row['BuildingEntry'].",";
- echo $row['ResTypeID'].",";
- echo $row['ResCount']."\n";
- }
- exit;
- }
- // Close mySQL Connection
- mysql_close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement