Файл: public_html/element_starting_game.php
Строк: 276
<?php
$starting_on = '';
require_once './element_options/element_options.php';
$title = 'У истока';
if (readcache('element_user_mesto'.$user['lost_id']) != $title) writecache('element_user_mesto'.$user['lost_id'], $title);
// Если пользователь не авторизован/зарегистрирован, делаем следующеё
if (!$user)
{
$code = '';
if ( ! empty($_GET['code']))
{
$curl = curl_init("https://oauth.vk.com/access_token?client_id=".APP_VK_ID."&client_secret=".APP_VK_SECRET."&redirect_uri=".APP_VK_REDIRECT."&code={$_GET['code']}");
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$data = json_decode(curl_exec($curl));
$code = '&code='.$_GET['code'];
if (isset($data->access_token, $data->user_id))
{
$has = mysql_fetch_assoc(mysql_query("SELECT * FROM `element_user` WHERE `identifier`='{$data->user_id}' LIMIT 1"));
if ( ! empty($has['lost_id']))
{
setcookie('id', $has['lost_id'], time()+3600*24*365, '/');
setcookie('password', $has['lost_password'], time()+3600*24*365, '/');
header('location: /start');
exit;
}
else
{
$identifier = md5(md5('element'.rand(0,1000)));
setcookie('identifier', $identifier, time()+$data->expires_in, '/');
writecache('vk'.$identifier, $data);
}
}
}
if ($go == 'male' or $go == 'female')
{
$sql = '';
$login = 'Странник';
$password = md5(md5('element'.rand(0,1000)));
$refferer = (isset($_COOKIE['refferer']) AND is_numeric($_COOKIE['refferer'])) ? (int)mysql_real_escape_string($_COOKIE['refferer']) : false;
if ($refferer) $ref = $refferer; else $ref = $refferer = 0;
// Регистрация / Посл. вход / Почта / Бан / Ник / Стихия / Пол
$lost_other = time().' '.time().' 0 0 1 1 1 0';
if (isset($_COOKIE['identifier']))
{
$data = readcache('vk'.$_COOKIE['identifier']);
if (isset($data->access_token, $data->user_id))
{
$has = mysql_fetch_assoc(mysql_query("SELECT * FROM `element_user` WHERE `identifier`='{$data->user_id}' LIMIT 1"));
if ( ! empty($has['lost_id']))
{
setcookie('id', $has['lost_id'], time()+3600*24*365, '/');
setcookie('password', $has['lost_password'], time()+3600*24*365, '/');
header('location: /start');
exit;
}
else
{
$curl = curl_init("https://api.vk.com/method/users.get?user_ids={$data->user_id}&access_token={$data->access_token}");
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$profile = json_decode(curl_exec($curl));
if (isset($profile->response))
{
$login = mysql_real_escape_string($profile->response[0]->first_name);
$password = md5(md5($profile->response[0]->uid));
echo $sql = ", `lost_save`='1', `identifier`='{$profile->response[0]->uid}'";
}
//delecache('vk'.$_COOKIE['identifier']);
writecache('vk'.$_COOKIE['identifier'], false);
setcookie('identifier', '', time()+$data->expires_in, '/');
}
}
}
mysql_query("INSERT INTO `element_user` SET `lost_login` = '$login',
`lost_password` = '$password',
`lost_level` = '1',
`lost_exp` = '0 0',
`lost_male` = '$go',
`lost_params_strlen` = '100',
`lost_params_heatpoints` = '100',
`lost_params_energy` = '40:40:".time()."',
`lost_params_protection` = '100',
`lost_params_summa` = '300',
`lost_other` = '$lost_other',
`lost_labirint` = '0:0:0:0:0:0:0:0:0',
`lost_abilities_ogon` = '0',
`lost_abilities_voda` = '0',
`lost_abilities_zemlya` = '0',
`lost_abilities_vozduh` = '0',
`lost_arena_tvt_rating` = '1000',
`lost_arena_pvp_rating` = '1000',
`lost_refferer` = '$ref',
`lost_params_training` = '0:0:0',
`lost_start_ip` = '".my_ip()."',
`lost_ip` = '".my_ip()."',
`lost_user_agent` = '".$_SERVER['HTTP_USER_AGENT']."',
`lost_user_agent_2` = '".$_SERVER['HTTP_USER_AGENT']."'{$sql}");
$insert_user = mysql_insert_id();
if ($ref > 0) {
mysql_query("INSERT INTO `element_refferer` SET `id_user` = '$ref', `id_refferer` = '$insert_user'");
}
setcookie('id', (int)$insert_user, time()+3600*24*365, '/');
setcookie('password',$password, time()+3600*24*365, '/');
header('location: /start');
exit;
}
$title = 'Выбор пола';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_false.php';
echo '<div class="cntr game-master mt5 mb5 small">Приветствуем Вас в <span class="bold">Мире Стихий!</span><br/>Выберите пожалуйста Ваш пол: </div>';
echo '<div class="nfl cntr p5 mb5 mt5 w80 mlra">';
echo '<span class="inbl w45 va_t">
<a class="atask" href="/start?go=male'.$code.'">
<span class="inbl prel">
<img alt="male" src="/images/male.jpg" alt=""/>
</span><br/>
<span class="mt3">Мужчина</span>
</a>
</span>';
echo '<span class="inbl w45 va_t">
<a class="atask" href="/start?go=female'.$code.'">
<span class="inbl prel">
<img alt="female" src="/images/female.jpg" alt=""/>
</span><br/>
<span class="mt3">Женщина</span>
</a>
</span>';
echo '</div>';
echo '<div class="cntr mb5 mt5"><a class="button w50" href="/">Выход</a></div>';
require_once './element_include/element_foot_user_battle_true.php';
exit;
}
$training_battle = readcache('ElementUser'.$user['lost_id'].'training');
// Если не прошел обучение
if ($user['lost_race'] == 0 AND !$training_battle) {
if ($go == 'start') {
require_once './element_function/element_function_battle.php';
$bot_hp = GenerationMaxHeatpoints(125);
$myy_hp = GenerationMaxHeatpoints($user['lost_params_heatpoints']);
$journal = array('<span class="lngreen bold">Обучение началось!</span>');
$training = array('bot' => array('other_hp' => $bot_hp, 'battle_hp' => $bot_hp, 'time' => false, 'life' => 0),
'user' => array('other_hp' => $myy_hp, 'battle_hp' => $myy_hp, 'time' => false, 'life' => 0),
'other' => array('training' => 1, 'timer' => time()));
writecache('element_training_journal_user_id'.$user['lost_id'], $journal);
writecache('element_training_user_id'.$user['lost_id'], $training);
writecache('ElementUser'.$user['lost_id'].'training', true);
header('Location: /training');
exit;
}
$title = 'Выбор стихии';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_false.php';
echo '<div class="cntr game-master mt5 mb5 small"><img alt="female" src="/images/help.jpg" alt=""/><br/>Отлично! Теперь пройдите обучение и выберите для себя подходящую стихию!</div>';
echo '<div class="cntr small mt10 mb5"><a class="button w70" href="/start?go=start">Начать обучение!</a></div>';
require_once './element_include/element_foot_user_battle_true.php';
exit;
}
// Если прошел обучение, но не выбрал стихию
if ($user['lost_race'] == 0 AND $training_battle) {
// Выбираем стихию
if ($id AND $id >= 1 AND $id <= 4) {
$user['lost_race'] = $id;
writecache('element_users_id_'.$user['lost_id'], $user);
user_list_update($user['lost_id']);
header('Location: /');
exit;
}
$title = 'Выбор стихии';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_false.php';
echo '<div class="cntr game-master mt5 mb5 small">Вы успешно прошли обучение!<br/>Каждая стихия дает плюсы своему умению в бою. Теперь выберите пожалуйста стихию, за которую Вы хотите играть!</div>';
echo '<div class="nfl cntr small p5 mb5 mt5 mlra">';
echo '<span class="inbl w23 va_t">
<a class="atask" href="/start?id=1">
<span class="inbl prel">
<img width="45" height="45" alt="male" src="/images/race/ogon.png" alt=""/>
</span><br/>
<span class="mt3">Огонь</span>
</a>
</span>';
echo '<span class="inbl w23 va_t">
<a class="atask" href="/start?id=2">
<span class="inbl prel">
<img width="45" height="45" alt="female" src="/images/race/voda.png" alt=""/>
</span><br/>
<span class="mt3">Вода</span>
</a>
</span>';
echo '<span class="inbl w23 va_t">
<a class="atask" href="/start?id=3">
<span class="inbl prel">
<img width="45" height="45" alt="male" src="/images/race/vozdukh.png" alt=""/>
</span><br/>
<span class="mt3">Воздух</span>
</a>
</span>';
echo '<span class="inbl w23 va_t">
<a class="atask" href="/start?id=4">
<span class="inbl prel">
<img width="45" height="45" alt="female" src="/images/race/zemlya.png" alt=""/>
</span><br/>
<span class="mt3">Земля</span>
</a>
</span>';
echo '</div>';
echo '<div class="nfl cntr small p5 mb5 mt5 mlra">';
echo '<div class="white ml2 mr2 small">';
echo '<img src="/images/icons/1_online.png"> <span class="error1 bold">Стихия Огня</span><br/> При активности умения "<span class="bold">Огненная сила</span>", добавляет <span class="yellow1 bold">+10%</span> к Вашему урону';
echo '</div>';
echo '<div class="hr mt5 mb5"></div>';
echo '<div class="white ml2 mr2 mb5 small">';
echo '<img src="/images/icons/2_online.png"> <span class="admin bold">Стихия Воды</span><br/> При активности умения "<span class="bold">Водяной крит</span>", добавляет <span class="yellow1 bold">+10%</span> к критическому урону';
echo '</div>';
echo '<div class="hr mt5 mb5"></div>';
echo '<div class="white ml2 mr2 mb5 small">';
echo '<img src="/images/icons/3_online.png"> <span class="ccc bold">Стихия Воздуха</span><br/> При срабатывании умения "<span class="bold">Ловушка ветра</span>", добавляет <span class="yellow1 bold">+10%</span> к забираемому здоровья врага';
echo '</div>';
echo '<div class="hr mt5 mb5"></div>';
echo '<div class="white ml2 mr2 mb5 small">';
echo '<img src="/images/icons/4_online.png"> <span class="lngreen bold">Стихия Земли</span><br/> При активности умения "<span class="bold">Земляная стойкость</span>", поглощает урон врага по вам на <span class="yellow1 bold">+10%</span> урон';
echo '</div>';
echo '</div>';
require_once './element_include/element_foot_user_battle_true.php';
exit;
}
header('Location: /');
?>