Пример #1
0
function SendResponse($response)
{
    global $config;
    if ($config['api']['debug'] || isset($_GET['debug'])) {
        data_dump($response, false, "Response (debug mode)");
    } else {
        echo json_encode($response);
    }
}
Пример #2
0
         } else {
             header('Location: changepassword.php');
             exit;
         }
     }
 }
 // Give points to character
 if (empty($_POST['points_char']) === false && empty($_POST['points_value']) === false) {
     $char = sanitize($_POST['points_char']);
     $points = (int) $_POST['points_value'];
     data_dump($_POST, false, "post data");
     $account = mysql_select_single("SELECT `account_id` FROM `players` WHERE `name`='{$char}' LIMIT 1;");
     data_dump($account, false, "fetching account id from players table");
     $znote_account = mysql_select_single("SELECT `id`, `points` FROM `znote_accounts` WHERE `account_id`='" . $account['account_id'] . "';");
     data_dump($znote_account, false, "Fetching existing points from znote_accounts");
     data_dump(array('Old:' => $znote_account['points'], 'New:' => $points, 'Total:' => $znote_account['points'] + $points), false, "Points calculation:");
     $points += $znote_account['points'];
     mysql_update("UPDATE `znote_accounts` SET `points`='{$points}' WHERE `account_id`='" . $account['account_id'] . "';");
 }
 // Set character position
 if (empty($_POST['position_name']) === false && empty($_POST['position_type']) === false) {
     if (user_character_exist($_POST['position_name'])) {
         if (array_key_exists($_POST['position_type'], $config['ingame_positions'])) {
             if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
                 set_ingame_position($_POST['position_name'], $_POST['position_type']);
             } else {
                 if ($config['TFSVersion'] == 'TFS_03') {
                     set_ingame_position03($_POST['position_name'], $_POST['position_type']);
                 }
             }
             $pos = 'Undefined';
Пример #3
0
function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $comment)
{
    $charid = user_character_id($charname);
    $typeid = (int) $typeid;
    $actionid = (int) $actionid;
    $reasonid = (int) $reasonid;
    $time = (int) ($time + time());
    $data = user_character_data($charid, 'account_id', 'lastip');
    $accountid = $data['account_id'];
    $charip = $data['lastip'];
    $comment = sanitize($comment);
    // ...
    $bannedby = config('website_char');
    if (user_character_exist($bannedby)) {
        $bannedby = user_character_id($bannedby);
        if (Config('TFSVersion') === 'TFS_02') {
            mysql_insert("INSERT INTO `bans` (`type` ,`ip` ,`mask` ,`player` ,`account` ,`time` ,`reason_id` ,`action_id` ,`comment` ,`banned_by`) VALUES ('{$typeid}', '{$charip}', '4294967295', '{$charid}', '{$accountid}', '{$time}', '{$reasonid}', '{$actionid}', '{$comment}', '{$bannedby}');");
        } elseif (Config('TFSVersion') === 'TFS_03') {
            $now = time();
            switch ($typeid) {
                case 1:
                    // IP ban
                    mysql_insert("INSERT INTO `bans` (`type`, `value`, `param`, `active`, `expires`, `added`, `admin_id`, `comment`) VALUES ('{$typeid}', '{$charip}', '4294967295', '1', '{$time}', '{$now}', '{$bannedby}', '{$comment}');");
                    break;
                case 2:
                    // namelock
                    mysql_insert("INSERT INTO `bans` (`type`, `value`, `param`, `active`, `expires`, `added`, `admin_id`, `comment`) VALUES ('{$typeid}', '{$charid}', '4294967295', '1', '{$time}', '{$now}', '{$bannedby}', '{$comment}');");
                    break;
                case 3:
                    // acc ban
                    mysql_insert("INSERT INTO `bans` (`type`, `value`, `param`, `active`, `expires`, `added`, `admin_id`, `comment`) VALUES ('{$typeid}', '{$accountid}', '4294967295', '1', '{$time}', '{$now}', '{$bannedby}', '{$comment}');");
                    break;
                case 4:
                    // notation
                    mysql_insert("INSERT INTO `bans` (`type`, `value`, `param`, `active`, `expires`, `added`, `admin_id`, `comment`) VALUES ('{$typeid}', '{$charid}', '4294967295', '1', '{$time}', '{$now}', '{$bannedby}', '{$comment}');");
                    break;
                case 5:
                    // deletion
                    mysql_insert("INSERT INTO `bans` (`type`, `value`, `param`, `active`, `expires`, `added`, `admin_id`, `comment`) VALUES ('{$typeid}', '{$charid}', '4294967295', '1', '{$time}', '{$now}', '{$bannedby}', '{$comment}');");
                    break;
            }
        } elseif (Config('TFSVersion') === 'TFS_10') {
            $now = time();
            switch ($typeid) {
                case 1:
                    // IP ban
                    mysql_insert("INSERT INTO `ip_bans` (`ip`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES ('{$charip}', '{$comment}', '{$now}', '{$time}', '{$bannedby}');");
                    break;
                case 2:
                    // namelock
                    mysql_insert("INSERT INTO `player_namelocks` (`player_id`, `reason`, `namelocked_at`, `namelocked_by`) VALUES ('{$charid}', 'comment', '{$now}', '{$bannedby}');");
                    break;
                case 3:
                    // acc ban
                    mysql_insert("INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES ('{$accountid}', '{$comment}', '{$now}', '{$time}', '{$bannedby}');");
                    break;
                case 4:
                    // notation
                    data_dump(false, array('status' => false), "Function deprecated. Ban option does not exist in TFS 1.0.");
                    die;
                    break;
                case 5:
                    // deletion
                    data_dump(false, array('status' => false), "Function deprecated. Ban option does not exist in TFS 1.0.");
                    die;
                    break;
            }
        }
        return true;
    } else {
        return false;
    }
}
Пример #4
0
	<?php 
}
include 'layout/overall/footer.php';
// ZEOTSS: Register visitor
if ($config['zeotss']['enabled'] && $config['zeotss']['visitors']) {
    $curl_connection = curl_init($config['zeotss']['server'] . "modules/visitor/registervisitor.php");
    curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 1);
    curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
    curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 0);
    $post_string = "longip=" . ip2long($_SERVER['REMOTE_ADDR']) . "&register=1";
    curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
    $result = curl_exec($curl_connection);
    if ($config['zeotss']['debug']) {
        data_dump(false, array($result), "CURL DATA");
    }
    curl_close($curl_connection);
    // Check if site is registered on ZEOTSS and can use its utilities:
    $result = json_decode($result);
    if ($result->data->exist === false) {
        ?>
		<script type="text/javascript">
		alert("Error: ZEOTSS site validation failed, have you registered? Register at: <?php 
        echo $config['zeotss']['server'];
        ?>
");
		</script>
		<?php 
    }
}
Пример #5
0
 public function dumpErrors()
 {
     if ($this->getErrors() !== false) {
         data_dump($this->getErrors(), false, "Errors detected in player class:");
     }
 }