Exemple #1
0
$addHearts = $dataPriceData["amount"];
// 보석이부족한경우.
if ($nowGems < $spendGems) {
    echo "none2";
    $mysqli->close();
    exit;
}
//결과반영
$sqlUpdateUserCore = "UPDATE `usercore` SET `gems` = `gems` - " . $spendGems . ",\n `hearts` = `hearts` + " . $addHearts . " WHERE `no` = " . $userKeyNo;
$resultUpdateUserCore = SendSqlQuery($sqlUpdateUserCore, "UpdateUserCore", $mysqli);
$returnGems = $nowGems - $spendGems;
$returnHearts = $dataUserCore["hearts"] + $addHearts;
//반환 데이터생성
// 사용자 데이터가 존재하므로 리턴할 XML 데이터 구조 생성
$dom = new DOMDocument('1.0', 'UTF-8');
//root 노드 생성
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$gems = nodeMaker($dom, "gems", $returnGems);
$hearts = nodeMaker($dom, "hearts", $returnHearts);
$rootNode->appendChild($gems);
$rootNode->appendChild($hearts);
// 반환되는 데이터의 헤더에결과값이 XML 형태라는 것을 명시
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
// 결과 XML  반환
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;
Exemple #2
0
//
$sqlFindMsg = "SELECT * FROM `usermessage` WHERE `user` = " . $userKeyNo;
$resultFindMsg = SendSqlQuery($sqlFindMsg, "FindMsg", $mysqli);
//
$dom = new DOMDocument('1.0', 'UTF-8');
//root element
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$response = $dom->createElement("usermessage");
$rootNode->appendChild($response);
//db php
while ($datarow = mysqli_fetch_array($resultFindMsg)) {
    $dataNode = $dom->createElement('MessageData');
    $no = nodeMaker($dom, "no", $datarow["no"]);
    $sender = nodeMaker($dom, "sender", $datarow["sender"]);
    $msgType = nodeMaker($dom, "msgType", $datarow["msgType"]);
    $amount = nodeMaker($dom, "amount", $datarow["amount"]);
    $dataNode->appendChild($no);
    $dataNode->appendChild($sender);
    $dataNode->appendChild($msgType);
    $dataNode->appendChild($amount);
    $response->appendChild($dataNode);
}
//
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;
Exemple #3
0
$addCoins = $dataPriceData["amount"];
// 보석이부족한경우.
if ($nowGems < $spendGems) {
    echo "none2";
    $mysqli->close();
    exit;
}
//결과반영
$sqlUpdateUserCore = "UPDATE `usercore` SET `gems` = `gems` - " . $spendGems . ",\n `coins` = `coins` + " . $addCoins . " WHERE `no` = " . $userKeyNo;
$resultUpdateUserCore = SendSqlQuery($sqlUpdateUserCore, "UpdateUserCore", $mysqli);
$returnGems = $nowGems - $spendGems;
$returnCoins = $dataUserCore["coins"] + $addCoins;
//반환 데이터생성
// 사용자 데이터가 존재하므로 리턴할 XML 데이터 구조 생성
$dom = new DOMDocument('1.0', 'UTF-8');
//root 노드 생성
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$gems = nodeMaker($dom, "gems", $returnGems);
$coins = nodeMaker($dom, "coins", $returnCoins);
$rootNode->appendChild($gems);
$rootNode->appendChild($coins);
// 반환되는 데이터의 헤더에결과값이 XML 형태라는 것을 명시
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
// 결과 XML  반환
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;
Exemple #4
0
$mysqli->set_charset("utf8");
//
$sqlFindInappItem = "SELECT * FROM `inappitem` ORDER BY `no`";
//
$resultInappItem = SendSqlQuery($sqlFindInappItem, "InappItem", $mysqli);
//
$dom = new DOMDocument('1.0', 'UTF-8');
//root element
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$response = $dom->createElement("inapp");
$rootNode->appendChild($response);
//db php
while ($datarow = mysqli_fetch_array($resultInappItem)) {
    $dataNode = $dom->createElement('InappItemData');
    $no = nodeMaker($dom, "no", $datarow["no"]);
    $codeNo = nodeMaker($dom, "codeNo", $datarow["codeNo"]);
    $sku = nodeMaker($dom, "sku", $datarow["sku"]);
    $dataNode->appendChild($no);
    $dataNode->appendChild($codeNo);
    $dataNode->appendChild($sku);
    $response->appendChild($dataNode);
}
//
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;
Exemple #5
0
    }
    if ($totalHearts != $nowHearts) {
        $sqlUpdateHearts = "UPDATE `usercore`\n            SET `hearts` = '" . $totalHearts . "', `loginTime` = '" . $nowTime . "'\n            WHERE `no` = " . $userKeyNo;
        $resultUpdateHearts = SendSqlQuery($sqlUpdateHearts, "UpdateHearts", $mysqli);
        $lastTime = $nowTime;
        $nowHearts = $totalHearts;
    }
}
//server time //lastTime //heart 보낸다.
// 사용자 데이터가 존재하므로 리턴할 XML 데이터 구조 생성
$dom = new DOMDocument('1.0', 'UTF-8');
//root 노드 생성
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$response = $dom->createElement("result");
$rootNode->appendChild($response);
$serverTime = nodeMaker($dom, "serverTime", $nowTime);
$loginTime = nodeMaker($dom, "loginTime", $lastTime);
$hearts = nodeMaker($dom, "hearts", $nowHearts);
$response->appendChild($hearts);
$response->appendChild($loginTime);
$response->appendChild($serverTime);
// 반환되는 데이터의 헤더에결과값이 XML 형태라는 것을 명시
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
// 결과 XML 반환
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;
Exemple #6
0
// 코인이부족한경우.
if ($nowCoins < $spendCoins) {
    echo "none1";
    $mysqli->close();
    exit;
}
//결과반영
$sqlUpdateUserCore = "UPDATE `usercore` SET `coins` = `coins` - " . $spendCoins . " WHERE `no` = " . $userKeyNo;
$resultUpdateUserCore = SendSqlQuery($sqlUpdateUserCore, "UpdateUserCore", $mysqli);
$sqlLvUpgrade = "UPDATE `userupgrade` SET `attLv` = " . $afterLv . " WHERE `no` = " . $dataUpgradeData["no"];
$resultLvUpgrade = SendSqlQuery($sqlLvUpgrade, "LvUpgrade", $mysqli);
$returnCoins = $nowCoins - $spendCoins;
//반환 데이터생성
// 사용자 데이터가 존재하므로 리턴할 XML 데이터 구조 생성
$dom = new DOMDocument('1.0', 'UTF-8');
//root 노드 생성
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$coins = nodeMaker($dom, "coins", $returnCoins);
$attLv = nodeMaker($dom, "attLv", $afterLv);
$rootNode->appendChild($coins);
$rootNode->appendChild($attLv);
// 반환되는 데이터의 헤더에결과값이 XML 형태라는 것을 명시
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
// 결과 XML  반환
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;
Exemple #7
0
//
$sqlFindItem = "SELECT * FROM `useritem` WHERE `user` = " . $userKeyNo;
$resultFindItem = SendSqlQuery($sqlFindItem, "FindItem", $mysqli);
//
$dom = new DOMDocument('1.0', 'UTF-8');
//root element
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$response = $dom->createElement("useritem");
$rootNode->appendChild($response);
//db php
while ($datarow = mysqli_fetch_array($resultFindItem)) {
    $dataNode = $dom->createElement('ItemData');
    $no = nodeMaker($dom, "no", $datarow["no"]);
    $itemNo = nodeMaker($dom, "itemNo", $datarow["itemNo"]);
    $amount = nodeMaker($dom, "amount", $datarow["amount"]);
    $use = nodeMaker($dom, "use", $datarow["use"]);
    $dataNode->appendChild($no);
    $dataNode->appendChild($itemNo);
    $dataNode->appendChild($amount);
    $dataNode->appendChild($use);
    $response->appendChild($dataNode);
}
//
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;
$resultFindItem = SendSqlQuery($sqlFindItem, "FindItem", $mysqli);
if ($resultFindItem->num_rows > 0) {
    $dataFindItem = mysqli_fetch_array($resultFindItem);
    $returnAmount = $dataFindItem["amount"] + 1;
    //item을 이미 구매한경우
    $sqlItemUpdate = "UPDATE `useritem` SET `amount` = `amount` + 1 WHERE `user` = " . $userKeyNo . " AND `itemNo` = " . $pID;
    $resultItemUpdate = SendSqlQuery($sqlItemUpdate, "ItemUpdate", $mysqli);
} else {
    $sqlInsertItem = "INSERT INTO `useritem` (`no`, `user`, `itemNo`, `amount`, `use`) VALUES (NULL, " . $userKeyNo . ", " . $pID . ", 1, 0)";
    $resultInsertItem = SendSqlQuery($sqlInsertItem, "InsertItem", $mysqli);
}
$returnCoins = $nowCoins - $spendCoins;
//반환 데이터생성
// 사용자 데이터가 존재하므로 리턴할 XML 데이터 구조 생성
$dom = new DOMDocument('1.0', 'UTF-8');
//root 노드 생성
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$coins = nodeMaker($dom, "coins", $returnCoins);
$rAmount = nodeMaker($dom, "amount", $returnAmount);
$rootNode->appendChild($coins);
$rootNode->appendChild($rAmount);
// 반환되는 데이터의 헤더에결과값이 XML 형태라는 것을 명시
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
// 결과 XML  반환
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;
Exemple #9
0
// 코인이부족한경우.
if ($nowCoins < $spendCoins) {
    echo "none1";
    $mysqli->close();
    exit;
}
//결과반영
$sqlUpdateUserCore = "UPDATE `usercore` SET `coins` = `coins` - " . $spendCoins . " WHERE `no` = " . $userKeyNo;
$resultUpdateUserCore = SendSqlQuery($sqlUpdateUserCore, "UpdateUserCore", $mysqli);
$sqlLvUpgrade = "UPDATE `userupgrade` SET `moneyLv` = " . $afterLv . " WHERE `no` = " . $dataUpgradeData["no"];
$resultLvUpgrade = SendSqlQuery($sqlLvUpgrade, "LvUpgrade", $mysqli);
$returnCoins = $nowCoins - $spendCoins;
//반환 데이터생성
// 사용자 데이터가 존재하므로 리턴할 XML 데이터 구조 생성
$dom = new DOMDocument('1.0', 'UTF-8');
//root 노드 생성
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$coins = nodeMaker($dom, "coins", $returnCoins);
$moneyLv = nodeMaker($dom, "moneyLv", $afterLv);
$rootNode->appendChild($coins);
$rootNode->appendChild($moneyLv);
// 반환되는 데이터의 헤더에결과값이 XML 형태라는 것을 명시
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
// 결과 XML  반환
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;
Exemple #10
0
//
$dom = new DOMDocument('1.0', 'UTF-8');
//root element
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$response = $dom->createElement("friendlist");
$rootNode->appendChild($response);
//db php
while ($datarow = mysqli_fetch_array($resultFindFriend)) {
    $dataNode = $dom->createElement('FriendData');
    $no = nodeMaker($dom, "no", $datarow["no"]);
    $friend = nodeMaker($dom, "friend", $datarow["friend"]);
    $name = nodeMaker($dom, "name", $datarow["name"]);
    $score = nodeMaker($dom, "score", $datarow["score"]);
    $state = nodeMaker($dom, "state", $datarow["state"]);
    $sendTime = nodeMaker($dom, "sendTime", $datarow["sendTime"]);
    $dataNode->appendChild($no);
    $dataNode->appendChild($friend);
    $dataNode->appendChild($name);
    $dataNode->appendChild($score);
    $dataNode->appendChild($friend);
    $dataNode->appendChild($state);
    $dataNode->appendChild($sendTime);
    $response->appendChild($dataNode);
}
//
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
$xmlString = $dom->saveXML();
echo $xmlString;
Exemple #11
0
// 코인이부족한경우.
if ($nowCoins < $spendCoins) {
    echo "none1";
    $mysqli->close();
    exit;
}
//결과반영
$sqlUpdateUserCore = "UPDATE `usercore` SET `coins` = `coins` - " . $spendCoins . " WHERE `no` = " . $userKeyNo;
$resultUpdateUserCore = SendSqlQuery($sqlUpdateUserCore, "UpdateUserCore", $mysqli);
$sqlLvUpgrade = "UPDATE `userupgrade` SET `defLv` = " . $afterLv . " WHERE `no` = " . $dataUpgradeData["no"];
$resultLvUpgrade = SendSqlQuery($sqlLvUpgrade, "LvUpgrade", $mysqli);
$returnCoins = $nowCoins - $spendCoins;
//반환 데이터생성
// 사용자 데이터가 존재하므로 리턴할 XML 데이터 구조 생성
$dom = new DOMDocument('1.0', 'UTF-8');
//root 노드 생성
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$coins = nodeMaker($dom, "coins", $returnCoins);
$defLv = nodeMaker($dom, "defLv", $afterLv);
$rootNode->appendChild($coins);
$rootNode->appendChild($defLv);
// 반환되는 데이터의 헤더에결과값이 XML 형태라는 것을 명시
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
// 결과 XML  반환
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;
    $saveInsertId = $mysqli->insert_id;
    // 신규 데이터에 맞춰서 userupgrade 테이블 데이터를 노드로 작성한 후 등록
    $upgradeNo = nodeMaker($dom, "upgradeNo", $saveInsertId);
    $attLv = nodeMaker($dom, "attLv", "1");
    $defLv = nodeMaker($dom, "defLv", "1");
    $moneyLv = nodeMaker($dom, "moneyLv", "1");
    $response->appendChild($upgradeNo);
    $response->appendChild($attLv);
    $response->appendChild($defLv);
    $response->appendChild($moneyLv);
} else {
    //userupgrade 테이블에 데이터가 존재하므로 PHP에서 사용하도록 로딩
    $dataUpgradeRow = mysqli_fetch_array($resultFindUserUpgrade);
    $upgradeNo = nodeMaker($dom, "upgradeNo", $dataUpgradeRow["no"]);
    $attLv = nodeMaker($dom, "attLv", $dataUpgradeRow["attLv"]);
    $defLv = nodeMaker($dom, "defLv", $dataUpgradeRow["defLv"]);
    $moneyLv = nodeMaker($dom, "moneyLv", $dataUpgradeRow["moneyLv"]);
    $response->appendChild($upgradeNo);
    $response->appendChild($attLv);
    $response->appendChild($defLv);
    $response->appendChild($moneyLv);
}
// 반환되는 데이터의 헤더에결과값이 XML 형태라는 것을 명시
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
// 결과 XML  반환
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;
Exemple #13
0
$dom = new DOMDocument('1.0', 'UTF-8');
//root element
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$response = $dom->createElement("friendlist");
$rootNode->appendChild($response);
//db php
while ($datarow = mysqli_fetch_array($resultFindFriend)) {
    $dataNode = $dom->createElement('FriendData');
    $no = nodeMaker($dom, "no", $datarow["no"]);
    $friend = nodeMaker($dom, "friend", $datarow["friend"]);
    $name = nodeMaker($dom, "name", $datarow["name"]);
    $score = nodeMaker($dom, "score", $datarow["score"]);
    $state = nodeMaker($dom, "state", $datarow["state"]);
    $sendTime = nodeMaker($dom, "sendTime", $datarow["sendTime"]);
    $facebook = nodeMaker($dom, "facebook", $datarow["facebook"]);
    $dataNode->appendChild($no);
    $dataNode->appendChild($friend);
    $dataNode->appendChild($name);
    $dataNode->appendChild($score);
    $dataNode->appendChild($friend);
    $dataNode->appendChild($state);
    $dataNode->appendChild($sendTime);
    $dataNode->appendChild($facebook);
    $response->appendChild($dataNode);
}
//
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
$xmlString = $dom->saveXML();
// 사용자의 전체 친구리스트 로딩하여 제외리스트 생성.
$sqlFindAllFriend = "SELECT * FROM `friendlist` WHERE `user` = " . $userKeyNo;
$resultFindAllFriend = SendSqlQuery($sqlFindAllFriend, "FindAllFriend", $mysqli);
$removeList = "(" . $userKeyNo;
while ($datarow = mysqli_fetch_array($resultFindAllFriend)) {
    $removeList = $removeList . ", " . $datarow["friend"];
}
$removeList = $removeList . ")";
// $removeList에 있는 유저를 제외하고 3개 선택.
$sqlFindRecommendedFriend = "SELECT * FROM `usercore` WHERE `no` NOT IN " . $removeList . "\n    ORDER BY RAND() LIMIT 0, 3";
$resultFindRecommenedFriend = SendSqlQuery($sqlFindRecommendedFriend, "FindRecommendedFriend", $mysqli);
// 결과 생성
$dom = new DOMDocument('1.0', 'UTF-8');
//root 노드 생성
$rootNode = $dom->createElement('farmdefence');
$dom->appendChild($rootNode);
$response = $dom->createElement("recommendFriend");
$rootNode->appendChild($response);
while ($datarow = mysqli_fetch_array($resultFindRecommenedFriend)) {
    $dataNode = $dom->createElement('RecommendedData');
    $name = nodeMaker($dom, "name", $datarow["id"]);
    $dataNode->appendChild($name);
    $response->appendChild($dataNode);
}
header("Content-type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
$xmlString = $dom->saveXML();
echo $xmlString;
$mysqli->close();
exit;