Code:
if (isset($_GET['type']) and isset($_GET["id"])) {
//proper request should be -- 127.0.0.1/api.php?type=1&guid=guid&id=id&username=username
if ($_GET['type'] == PLAYER_JOINED_EVENT) {
if (!isRegistered($_GET["guid"])) {
registerPlayer($_GET["guid"], $_GET["username"]);
$id = $_GET["id"];
echo "1|$id|0|0|0|0|";
} else {
$playerStats = getPlayerInfo($_GET["guid"]);
$id = $_GET["id"];
if ($row = $playerStats->fetch_assoc()) {
$guid = $row['guid'];
$kills = $row['kills'];
$deaths = $row['deaths'];
$money = $row['money'];
$rank = getPlayerRank($guid, "kills");
echo "1|$id|$guid|$kills|$deaths|$money|$rank|";
}
}
called by lua script
Code:
local query = formatAPICall("api.php", {"type", "guid", "id", "username"}, {1, guid, player, game.sreg[44]})
game.reg[45] = 100
game.send_message_to_url(query)
with query being http://127.0.0.1:8080/api.php?type=1&guid=1477436&id=5&username=Arthur (which is correct)
which returns the codes
Code:
1|5|1477436|10|2|10000|-1|
does anyone have any idea how to fix this
I used phpmyadmin with sql and loosely followed the instructions in this thread https://forums.taleworlds.com/index.php?topic=299534.0