Ejemplo n.º 1
0
            $get[$name] = $pldata;
        } else {
            $res[$name] = $tmp;
        }
    }
    unset($pldata, $tmp);
    if (!empty($get)) {
        //Trying to lock DB
        while (lockin_mysql() !== TRUE) {
            sleep('10');
        }
        foreach ($get as $val) {
            $cache->clear($val['account_name'], ROOT_DIR . '/cache/players/');
            $links[$val['account_name']] = $config['td'] . '/uc/accounts/' . $val['account_id'] . '/api/1.9/?source_token=Intellect_Soft-WoT_Mobile-unofficial_stats';
        }
        multiget($links, $res, $config, prepare_stat(), $roster, $lang);
        //print_r($result);
        unset($links);
        // Unlocking DB now
        lockout_mysql();
        //$cache->set('res', $res,ROOT_DIR.'/cache/players');
    }
}
// In $res array stored player statistic.
$sql = "SHOW TABLES FROM `" . $dbname . "` LIKE 'col_tank_%';";
$q = $db->prepare($sql);
if ($q->execute() == TRUE) {
    $col_tables = reform($q->fetchAll());
} else {
    die(show_message($q->errorInfo(), __LINE__, __FILE__, $sql));
}
Ejemplo n.º 2
0
$roster =& roster_sort($new['data']['request_data']['items']);
//print_r($roster);
if (count($new['data']['request_data']['items']) > 0) {
    foreach ($new['data']['request_data']['items'] as $val) {
        $tmp = checker($val, $lang, $config, $tables, $new['error']);
        if (isset($tmp['link'])) {
            $links[$val['name']] =& $tmp['link'];
        }
        if (isset($tmp['data'])) {
            $data[$val['name']] =& $tmp['data'];
        }
    }
    //print_r($new['data']['request_data']['items']);
    //print_r($links);
    if (count($links) > 0) {
        multiget($links, $result, PARS);
        foreach ($result as $name => $val) {
            $res_tmp[$name] = pars_data($val, $config, $lang, $name, $roster[$name]);
            unset($result[$name]);
        }
        unset($result);
        $res =& array_special_merge($data, $res_tmp);
    } else {
        $res =& $data;
    }
}
//print_r($roster);
if (count($res) > 0) {
    $tank_name = tank_names($res);
    $rand_keys = array_rand($res, 1);
    //print_r($rand_keys);