Файл: tjersy.worldbyte.net/inc/system.php
Строк: 57
<?php
if(!isset($_SESSION)){
ob_start();
session_start();
}
$db = mysql_connect('localhost','tje4_moto','moto');
mysql_query('SET NAMES`utf8`',$db);
mysql_select_db('tje4_moto',$db);
define("H", $_SERVER["DOCUMENT_ROOT"].'/');
$opdirbase = opendir(H.'inc/functions/');
while ($filebase = readdir($opdirbase)){
if (preg_match('#.php$#i', $filebase)){
require_once(H.'inc/functions/' . $filebase);
}
}
$act = isset($_GET['act']) ? htmlspecialchars($_GET['act']) : '';
///Кукки///
if(isset($_COOKIE['nick']) && isset($_COOKIE['pass'])) {
$user = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `nick` = '".check($_COOKIE['nick'])."' && `password` = '".check($_COOKIE['pass'])."' LIMIT 1"));
if(($user['nick'] !== $_COOKIE['nick']) or ($user['password'] !== $_COOKIE['pass']))
{
setcookie("nick", "", time() - 3600*24*30*12, "/");
setcookie("pass", "", time() - 3600*24*30*12, "/");
echo "Ошибка прочтения COCKIE данных";
header('Location: /index.php');
}
$my_moto = mysql_fetch_assoc(mysql_query("SELECT * FROM `garage` WHERE `id_user` = '$user[id]' AND `use` = '1'"));
$countmoto = mysql_num_rows(mysql_query("SELECT * FROM `garage` WHERE `id_user` = '$user[id]'"));
mysql_query("UPDATE `user` SET `online` = '".time()."' WHERE `id` = '$user[id]'");
/* ВРЕМЕННО*/
$swlevel = $user['level'];
switch($swlevel){
case 1: $swleveln = 260; break;
case 2: $swleveln = 480; break;
case 3: $swleveln = 720; break;
case 4: $swleveln = 1040; break;
case 5: $swleveln = 1700; break;
case 6: $swleveln = 1930; break;
case 7: $swleveln = 2090; break;
case 8: $swleveln = 2440; break;
case 9: $swleveln = 3120; break;
case 10: $swleveln = 3780; break;
case 11: $swleveln = 4290; break;
case 12: $swleveln = 5010; break;
case 13: $swleveln = 5960; break;
case 14: $swleveln = 6470; break;
case 15: $swleveln = 7240; break;
case 16: $swleveln = 8360; break;
case 17: $swleveln = 9520; break;
case 18: $swleveln = 11370; break;
case 19: $swleveln = 12040; break;
case 20: $swleveln = 12690; break;
}
$levelimg = ceil($user['opit']*100/$swleveln);
if($user['opit'] >= $swleveln){
$newlvl = $user['level']+1;
$resm = $user['money']+$newlvl*1000;
$resr = $user['raiting']+10;
mysql_query("UPDATE `user` SET `opit`= '0', `level`= '$newlvl',`money`='$resm',`raiting`='$resr',`fuel`='100' WHERE `id` ='$user[id]'");
}
/* ВРЕМЕННО*/
}
///Выход///
if(isset($_GET['exit'])){
setcookie('nick', '', time() - 100, '/');
setcookie('pass', '', time() - 100, '/');
header('Location: /index.php');
}
?>