Вход Регистрация
Файл: public_html/system/system.php
Строк: 106
<?php
session_start
();
if(
mysql_connect('localhost','db1499341099','1349973')) {
}else{
echo 
'Невозможно соединиться с MYSQL';
exit();
}
if(
mysql_select_db('db1499341099')) {
mysql_query('SET NAMES UTF8');
}
function 
_string($string) {
$string trim($string);
$string mysql_escape_string($string);
$string htmlspecialchars($string);
return 
$string;
}
function 
_num($i) {
$i = (int) abs($i);
return 
$i;
}
function 
vremja($i) {
$d  floor($i 86400); 
$h  floor(($i 3600) - $d 24); 
$m  floor(($i $h 3600 $d 86400) / 60); 
$s  $i - ($m 60 $h 3600 $d 86400);
if(
$d 0) {
$result ''.$d.' д '.$h.' ч';
}
elseif(
$h 0)
{
$result ''.$h.' ч '.$m.' м';
}elseif(
$m 0)
{
$result ''.$m.' м '.$s.' с';
}elseif(
$s >= 0)
{
$result $s.' с';          
}
return 
$result.'';
}
$id _string(_num($_COOKIE['id']));
$password _string($_COOKIE['password']);
if(
$id AND $password) {
$auth mysql_query('SELECT * FROM `users` WHERE `id` = "'.$id.'" && `password` = "'.$password.'"');
$user mysql_fetch_array($auth);
}
$system mysql_query('SELECT * FROM `system`');
$configuring mysql_fetch_array($system);
if(!
$user) {
setCookie('id''');
setCookie('password''');
}
function 
pages($pages){
$pages trim($pages);
$pages htmlspecialchars($pages);
$pages mysql_escape_string($pages);
return 
$pages;
}
function 
page($k_page=1) {
$page 1;
$page pages($page);
$k_page pages($k_page);
if(isset(
$_GET['selection'])) {
if (
$_GET['selection']=='top')
$page pages(intval($k_page));
elseif(
is_numeric($_GET['selection'])) 
$page pages(intval($_GET['selection']));
}
if (
$page<1)$page=1;
if (
$page>$k_page)$page=$k_page;
return 
$page;
}
function 
k_page($k_post 0,$k_p_str 10) {
if (
$k_post != 0) {
$v_pages ceil($k_post/$k_p_str);
return 
$v_pages;
}
else return 
1;
}
function 
str($link='?',$k_page=1,$page=1){
if (
$page<1)$page=1;
$page pages($page);
$k_page pages($k_page);
echo 
'<div class="selection">';
if (
$page>1)echo ' ';
else echo 
" ";
echo 
" ";
if (
$page<$k_page)echo ' ';
else echo 
" ";
echo 
' ';
if (
$page != 1)
echo 
'<a href="'.$link.'selection=1" class="navigation"><img src="/images/icons/bklh.png"></a>';
else echo 
' ';
for (
$ot=-3$ot<=3$ot++){
if (
$page+$ot>&& $page+$ot<$k_page){
if (
$ot==-&& $page+$ot>2)echo " ..";
if (
$ot!=0)echo ' <a href="'.$link.'selection='.($page+$ot).'" class="navigation"><img src="/images/icons/bk.png"></a>';
else echo 
' ';
if (
$ot==&& $page+$ot<$k_page-1)echo " ..";}}
if (
$page!=$k_page)echo ' <a href="'.$link.'selection=top" class="navigation"><img src="/images/icons/bkph.png"></a>';
elseif (
$k_page>1)echo ' ';
echo 
'</div>';
}
function 
smiles($text){
$smiles mysql_query("SELECT `name`,`adres` FROM `smiles`");
while(
$s mysql_fetch_array($smiles)){
$text=str_replace($s['name'],'<img src="'.$s['adres'].'">'$text);
}
return 
nl2br($text);
}
if(
$user) {
$time_url time() + 1;
$url mysql_result(mysql_query('SELECT COUNT(*) FROM `url_logs` WHERE `id_user` = "'.$user['id'].'" AND `time` >= "'.$time_url.'" AND `url` = "'.$_SERVER['PHP_SELF'].'"'),0);
if(
$url <= 0) {
mysql_query("INSERT INTO `url_logs` SET `id_user` = '".$user['id']."', `time` = '".time()."', `url` = '".$_SERVER['PHP_SELF']."', `ip` = '".$_SERVER['REMOTE_ADDR']."', `ua` = '".$_SERVER['HTTP_USER_AGENT']."'");
}
if(
$user['online'] <= (time() - 60)) {
mysql_query("update `users` set `online` = '".time()."', `ua` = '".$_SERVER['HTTP_USER_AGENT']."', `ip` = '".$_SERVER['REMOTE_ADDR']."' where `id` = '".$user['id']."'");
}
if(
$user['health'] < $user['max_health']) {
$time_hp time() - $user['update_health'];
$hp $time_hp;
$u_hp $user['max_health'] - $user['health'];
if(
$hp $u_hp) {
$add_hp $user['max_health'] - $user['health'];
}else{
$add_hp $hp;
}
mysql_query("update `users` set `health` = `health` + '".$add_hp."', `update_health` = '".time()."' where `id` = '".$user['id']."'");
}
if(
$user['health'] >  $user['max_health']) {
mysql_query("update `users` set `health` = `max_health` where `id` = '".$user['id']."'");
header('location: ?');
}
if(
$user['energy'] < $user['max_energy']) {
$time_energy time() - $user['update_energy'];
$energy $time_energy;
$u_energy $user['max_energy'] - $user['energy'];
if(
$energy $u_energy) {
$add_energy $user['max_energy'] - $user['energy'];
}else{
$add_energy $energy;
}
mysql_query("update `users` set `energy` = `energy` + '".$add_energy."', `update_energy` = '".time()."' where `id` = '".$user['id']."'");
}
if(
$user['energy'] >  $user['max_energy']) {
mysql_query("update `users` set `energy` = `max_energy` where `id` = '".$user['id']."'");
header('location: ?');
}
}
?>
Онлайн: 1
Реклама