Файл: index.php
Строк: 347
<?
include_once 'sys/core/start.php';
include_once 'sys/core/compress.php';
include_once 'sys/core/sess.php';
include_once 'sys/core/home.php';
include_once 'sys/core/db_connect.php';
include_once 'sys/core/ipua.php';
include_once 'sys/core/fnc.php';
include_once 'sys/core/user.php';
include_once 'sys/inc/fnc_game.php';
include_once 'sys/inc/thead.php';
if (isset($user)){
header('Location: /dev/garage.php');
}
else
{
$on=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `date_last` > ".(time()-600).""), 0);
echo "<table class='wdt' style='background-color: #221e1f;'>";
echo "<tr><td align='center' class='white' style='padding: 0px;'><a href='/'><img src='/style/theme/logos.png' alt='SGRaces'/></td></tr></table>";
echo "<table class='wdt brown-header'>";
echo "<tr><td align='center'>Онлайн: $on</td></tr></table>";
echo "<table class='wdt gray-table'>";
echo "<tr>
<td class='white td-cell' align='center'>
Добро пожаловать в игру «SGRaces»! <br> Покупай самые современные автомобили и принимай участие в уличных гонках. <br><br> На первом уровне тебе будут доступны гонки с друзьями или другими незнакомыми гонщиками.<br><br>Повышай свой уровень и тебе будут открываться новые возможности по улучшению своей машины!</td>
</tr>";
//Рег через Вконтакте
$client_id = ''; // ID приложения
$client_secret = ''; // Защищённый ключ
$redirect_uri = ''; // Адрес сайта
$url = 'http://oauth.vk.com/authorize';
$params = array(
'client_id' => $client_id,
'redirect_uri' => $redirect_uri,
'response_type' => 'code'
);
if (isset($_GET['code'])) {
$result = false;
$params = array(
'client_id' => $client_id,
'client_secret' => $client_secret,
'code' => $_GET['code'],
'redirect_uri' => $redirect_uri
);
$token = json_decode(file_get_contents('https://oauth.vk.com/access_token?client_id='.$client_id.'&client_secret='.$client_secret.'&code='.$_GET['code'].'&redirect_uri='.$redirect_uri), true);
if (isset($token['access_token'])) {
$params = array(
'uids' => $token['user_id'],
'fields' => 'uid,first_name,last_name,screen_name,sex,bdate,photo_50',
'access_token' =>
$token['access_token']
);
$userInfo = json_decode(file_get_contents('https://api.vk.com/method/users.get?uids='.$token['user_id'].'&fields=uid,first_name,last_name,screen_name,sex,bdate,photo_50&access_token='.$token['access_token']), true);
if (isset($userInfo['response'][0]['uid'])) {
$userInfo = $userInfo['response'][0];
$result = true;
}
}
if ($result) {
//Результат
}
}
//Рег через Одноклассники
$client_i = ''; // Application ID
$public_ke = ''; // Публичный ключ приложения
$client_secre = ''; // Секретный ключ приложения
$redirect_ur = ''; // Ссылка на приложение
$ur = 'http://www.odnoklassniki.ru/oauth/authorize';
$param = array(
'client_id' => $client_i,
'response_type' => 'code',
'redirect_uri' => $redirect_ur
);
if (isset($_GET['code'])) {
$resul = false;
$param = array(
'code' => $_GET['code'],
'redirect_uri' => $redirect_ur,
'grant_type' => 'authorization_code',
'client_id' => $client_i,
'client_secret' => $client_secre
);
$ur = 'http://api.odnoklassniki.ru/oauth/token.do';
$cur = curl_init();
curl_setopt($cur, CURLOPT_URL, $ur);
curl_setopt($cur, CURLOPT_POST, 1);
curl_setopt($cur, CURLOPT_POSTFIELDS, 'code='.$_GET['code'].'&redirect_uri='.$redirect_ur.'&grant_type=authorization_code&client_id='.$client_i.'&client_secret='.$client_secre);
curl_setopt($cur, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cur, CURLOPT_SSL_VERIFYPEER, false);
$resul = curl_exec($cur);
curl_close($cur);
$tokenInf = json_decode($resul, true);
if (isset($tokenInf['access_token']) && isset($public_ke)) {
$sig = md5("application_key={$public_ke}format=jsonmethod=users.getCurrentUser" . md5("{$tokenInf['access_token']}{$client_secre}"));
$param = array(
'method' => 'users.getCurrentUser',
'access_token' => $tokenInf['access_token'],
'application_key' => $public_ke,
'format' => 'json',
'sig' => $sig
);
$userInf = json_decode(file_get_contents('http://api.odnoklassniki.ru/fb.do?method=users.getCurrentUser&access_token='.$tokenInf['access_token'].'&application_key='.$public_ke.'&format=json&sig='.$sig), true);
if (isset($userInf['uid'])) {
$resul = true;
}
if ($resul) {
$query_us = mysql_query("SELECT id,login,pass FROM users WHERE login='{$userInf['uid']}' AND pass='' LIMIT 1") or die(mysql_error());
//Результат
}
}
}
echo "<table class='wdt gray-table'>
<tbody><tr>
<td class='white td-cell' align='center'>
<b>Авторизация через:
</b>
<br>
<br><script src='//ulogin.ru/js/ulogin.js'></script>
<div id='uLogin' data-ulogin='display=panel;fields=first_name,last_name,photo;providers=vkontakte,odnoklassniki,mailru,facebook;hidden=;redirect_uri=http://sgraces.ru/ulogin.php' data-ulogin-inited='1443427822531'><div style='margin: 0px; padding: 0px; outline: none; border: none; border-radius: 0px; cursor: default; float: none; position: relative; display: inline-block; width: 168px; height: 32px; left: 0px; top: 0px; box-sizing: content-box;'><div data-uloginbutton='vkontakte' title='VK' style='margin: 0px 10px 0px 0px; padding: 0px; outline: none; border: none; border-radius: 0px; cursor: pointer; float: left; position: relative; display: inherit; width: 32px; height: 32px; left: 0px; top: 0px; box-sizing: content-box; background: url(style/img/icons/ulogin.png) 0px -38px no-repeat;'></div><div data-uloginbutton='mailru' title='Mail.ru' style='margin: 0px 10px 0px 0px; padding: 0px; outline: none; border: none; border-radius: 0px; cursor: pointer; float: left; position: relative; display: inherit; width: 32px; height: 32px; left: 0px; top: 0px; box-sizing: content-box; background: url(style/img/icons/ulogin.png) 0px -108px no-repeat;'></div><div data-uloginbutton='odnoklassniki' title='Odnoklassniki' style='margin: 0px 10px 0px 0px; padding: 0px; outline: none; border: none; border-radius: 0px; cursor: pointer; float: left; position: relative; display: inherit; width: 32px; height: 32px; left: 0px; top: 0px; box-sizing: content-box; background: url(style/img/icons/ulogin.png) 0px -73px no-repeat;'></div><div data-uloginbutton='facebook' title='Facebook' style='margin: 0px 10px 0px 0px; padding: 0px; outline: none; border: none; border-radius: 0px; cursor: pointer; float: left; position: relative; display: inherit; width: 32px; height: 32px; left: 0px; top: 0px; box-sizing: content-box; background: url(style/img/icons/ulogin.png) 0px -143px no-repeat;'></div></div></div></td>
</tr>
</tbody></table>
";
$s = file_get_contents('http://ulogin.ru/token.php?token=' . $_POST['token'] . '&host=' . $_SERVER['HTTP_HOST']);
$user = json_decode($s, true);
//$user['network'] - соц. сеть, через которую авторизовался пользователь
//$user['identity'] - уникальная строка определяющая конкретного пользователя соц. сети
//$user['first_name'] - имя пользователя
//$user['last_name'] - фамилия пользователя
echo "<table class='wdt gray-table'>";
echo "<tr><td class='white td-cell' width = '50%'><form action='/dev/auth.php' method='get'><input class='race-btn' type='submit' value='Вход'/></form></td>";
echo "<td class='white td-cell'><form action='/dev/reg.php' method='get'><input class='race-btn' type='submit' value='Регистрация'/></form></td></tr></table>";
echo "<table class='wdt gray-table'>";
echo "</td></tr></table>";
list($msec, $sec) = explode(chr(32), microtime());
echo "<table class='wdt black'><tr>";
echo "<td align='center' class='orange'>Gen ".round(($sec + $msec) - $conf['headtime'], 3)." сек</br><a class='orange' style='font-size: 10pt' href='/dev/help.php'>Об игре</a>";
echo " | <a class='orange' style='font-size: 10pt' href='http://vk.com/sgraces'>Группа</a>";
echo "<br>";
echo "<br>";
echo "<a class='yellow' style='font-size: 10pt' href='http://vk.com/ilyasarmani'>Администратор</a>";
echo "<br>";
echo "<br>";
}
?>
<!-- Rating@Mail.ru counter -->
<script type="text/javascript">
var _tmr = window._tmr || (window._tmr = []);
_tmr.push({id: "2694563", type: "pageView", start: (new Date()).getTime()});
(function (d, w, id) {
if (d.getElementById(id)) return;
var ts = d.createElement("script"); ts.type = "text/javascript"; ts.async = true; ts.id = id;
ts.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//top-fwz1.mail.ru/js/code.js";
var f = function () {var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ts, s);};
if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); }
})(document, window, "topmailru-code");
</script><noscript><div style="position:absolute;left:-10000px;">
<img src="//top-fwz1.mail.ru/counter?id=2694563;js=na" style="border:0;" height="1" width="1" alt="Рейтинг@Mail.ru" />
</div></noscript>
<!-- //Rating@Mail.ru counter -->
<!-- Rating@Mail.ru logo -->
<a href="http://top.mail.ru/jump?from=2694563">
<img src="//top-fwz1.mail.ru/counter?id=2694563;t=387;l=1"
style="border:0;" height="18" width="88" alt="Рейтинг@Mail.ru" /></a>
<!-- //Rating@Mail.ru logo -->
<script type="text/javascript" src="http://mobtop.ru/c/105732.js"></script><noscript><a href="http://mobtop.ru/in/105732"><img src="http://mobtop.ru/105732.gif" alt="MobTop.Ru - рейтинг мобильных сайтов"/></a></noscript>
</td></tr></table>
<!--- DO NOT EDIT - GlobalSign SSL Site Seal Code - DO NOT EDIT ---><table width=125 border=0 cellspacing=0 cellpadding=0 title="CLICK TO VERIFY: This site uses a GlobalSign SSL Certificate to secure your personal information." ><tr><td><span id="ss_img_wrapper_gmogs_image_110-45_en_dblue"><a href="https://www.globalsign.com/" target=_blank title="GlobalSign Site Seal" rel="nofollow"><img alt="SSL" border=0 id="ss_img" src="//seal.globalsign.com/SiteSeal/images/gs_noscript_110-45_en.gif"></a></span><script type="text/javascript" src="//seal.globalsign.com/SiteSeal/gmogs_image_110-45_en_dblue.js"></script></td></tr></table><!--- DO NOT EDIT - GlobalSign SSL Site Seal Code - DO NOT EDIT --->