예제 #1
0
파일: train.php 프로젝트: dapfru/gladiators
<?php

require '../../config.php';
$form_width = 170;
require $engine_path . "cls/auth/session.php";
$act = "select";
$type = "gladiators/train";
if ($user && checkpriv("control/support", "")) {
    setvar('user', $user);
} else {
    setvar('user', $auth->user);
}
if ($step) {
    lock_rst($auth->user);
    $do = 0;
    $auth->rst = update_exp($auth->rst);
    $auth->rst = update_health($auth->rst);
    foreach ($_POST['GladiatorID'] as $k => $v) {
        if (!(get_injury($auth->rst[Gladiators][$v][Injury], $auth->rst[Date]) > 0)) {
            $_POST['NewPercentTrain'][$k] = round($_POST['NewPercentTrain'][$k]);
            if ($_POST['NewPercentTrain'][$k] >= 0 && $_POST['NewPercentTrain'][$k] <= 100 && is_numeric($_POST['NewPercentTrain'][$k])) {
                if ($auth->rst[Gladiators][$v][PercentTrain] != $_POST['NewPercentTrain'][$k]) {
                    $auth->rst[Gladiators][$v][PercentTrain] = $_POST['NewPercentTrain'][$k];
                    $do = 1;
                }
            } else {
                $error = 1;
            }
        }
    }
    if (!$error && $do) {
예제 #2
0
function fire($user, $staff)
{
    runsql("delete from tm_staff where  StaffID='{$staff}' and UserID='{$user}'");
    lock_rst($user);
    $rst = read_rst($user);
    if ($staff == 7) {
        $money = moneygained($rst, 0);
        if ($money > 0) {
            $rst = short_transfer_money($rst, $money, 1, $user, 20, 0);
        }
        $rst[ShopDate] = mktime();
    }
    if ($staff == 1 || $staff == 3 || $staff == 5) {
        $rst = update_exp($rst);
        unset($rst[Staff][$staff]);
    }
    unset($rst[Staff][$staff]);
    write_rst($user, $rst);
    unlock_rst($user);
}