예제 #1
0
            $val = $_POST[$str];
        }
    }
    return $val;
}
$errorHTML = "";
$edit = false;
$bot = GameBots::create()->setId(-1);
$user = GameUsers::create()->setUserId(-1);
$defaultUserName = "";
//edit için id gelirse bot ordan kopyala
$tmp = getURLParam("id");
if (!empty($tmp)) {
    $bot = GameBots::getBotById($tmp);
    if (empty($bot)) {
        $bot = GameBots::create()->setId(-1);
    } else {
        $user = $bot->user;
        $defaultUserName = $user->userName;
        $edit = true;
    }
}
//formdan data gelmişse onları ata ve kaydet
$tmp = getURLParam("form_");
if (!empty($tmp)) {
    $bot->setActive(getURLParam("active", 0));
    $bot->setRoomGroupId(getURLParam("roomGroupId", -1));
    $bot->setWeightBar(getURLParam("weight_bar", -1));
    $bot->setWeightBlocked(getURLParam("weight_blocked", -1));
    $bot->setWeightFaraway(getURLParam("weight_faraway", -1));
    $bot->setWeightSingle(getURLParam("weight_single", -1));
예제 #2
0
<?php

define("__ROOT__", __DIR__ . "/../");
require_once __ROOT__ . 'config/constants.php';
require_once __ROOT__ . 'utils/Functions.php';
require_once __ROOT__ . 'vendors/KLogger.php';
include_once __ROOT__ . "models/GameBots.class.php";
$result = new FunctionResult();
$result->success = false;
if (isset($_GET["sessionId"]) && !empty($_GET["sessionId"])) {
    session_id($_GET["sessionId"]);
}
session_start();
session_write_close();
$gameBots = GameBots::findByExample(DBUtils::getConnection(), GameBots::create()->setActive(1));
if (empty($gameBots)) {
    $gameBots = array();
}
$result->success = true;
$result->result = new stdClass();
$result->result->bots = $gameBots;
echo json_encode($result);
exit(1);