<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
<div class='main'>
<div class='top'>
<center><b><font color="white">Аккаунт</font></b></center>
<?

class AC{
function ACCAUNT(){
$tiem=time();

$ref=$_GET['ref'];
$_SESSION[s] = trim($_SESSION[s]);
$_SESSION[p] = trim($_SESSION[p]);	

if($_SESSION[s]==''){ 
print('<SCRIPT>location.href="menu.php";</SCRIPT>');
unset($_SESSION[s]);   
session_destroy();
die;}
    //если логин или пароль больше 25 символов обрезаем остальное
    $_SESSION[s] = substr($_SESSION[s], 0, 25);
    $_SESSION[p] = substr($_SESSION[p], 0, 25);
    

if(isset($ref) AND $ref=='refresh'){
$NICK = $_POST['NICK'];
$pass = $_POST['pass'];
//здесь создаем скрипт если игрок появился,то выводим это сообщение для всех игроков,кроме самого игрока	
$ltio=time();

$isco = mysql_query("SELECT * FROM users WHERE $ltio-gametime>=600 AND NICK=\"$_SESSION[s]\" AND online=\"0\"");//это оффлайн,работает!

if(mysql_num_rows($isco)>0) {
while($isco2 = mysql_fetch_assoc($isco)){
$smo = mysql_query("SET NAMES cp1251");
$ofono = time()+4;
$refTime=mysql_query("UPDATE users SET gametime=\"$tiem\" WHERE NICK=\"$_SESSION[s]\"");
$pruso = mysql_query("SELECT * FROM users WHERE $ltio-gametime<600 AND loc=\"$isco2[loc]\" AND online=\"1\"");
while($pruso2=mysql_fetch_assoc($pruso)){
$smo = mysql_query("INSERT INTO offon (con,NICK,loc,TIMER,myn,gametime) VALUES ('появился','$isco2[NICK]','$isco2[loc]','$ofono','$pruso2[NICK]','$pruso2[gametime]')");
$deliso = mysql_query("DELETE FROM offon WHERE $ltio-gametime>=600 AND myn=\"$isco2[NICK]\"");
$delswo = mysql_query("DELETE FROM offon WHERE NICK=\"$isco2[NICK]\" AND myn=\"$isco2[NICK]\"");
}
$smuo = mysql_query("UPDATE users SET online=\"1\" WHERE $ltio-gametime<600 AND NICK=\"$_SESSION[s]\" AND online=\"0\"");
 
}}


$refTime=mysql_query("UPDATE users SET gametime=\"$tiem\" WHERE NICK=\"$_SESSION[s]\"");
$smuo = mysql_query("UPDATE users SET online=\"1\" WHERE $ltio-gametime<600 AND NICK=\"$_SESSION[s]\" AND online=\"0\"");
 print('<SCRIPT>location.href="game.php";</SCRIPT>');

}
$PR_NICK = mysql_query("SET NAMES utf8");
$PR_NICK=mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\" AND pass=\"$_SESSION[p]\"");
$PR_NICK2=mysql_fetch_assoc($PR_NICK);
$PR_acco = mysql_query("SET NAMES utf8");
$PR_acco=mysql_query("SELECT * FROM accaunts WHERE NICK_AC=\"$_SESSION[s]\"");
$PR_acco2=mysql_fetch_assoc($PR_acco);

if($tiem-$PR_NICK2[gametime]>600){
echo"<div style=\"margin-left:10px;margin-top:10px;padding-bottom:10px;\">
<img src=\"img/ank.png\" width=\"24\" height=\"24\"> <a href=\"news/news.php\"><strong>Новости</strong></a><br/>
<strong>Добро пожаловать в игру</strong> <img src=\"img/grup.png\" width=\"24\" height=\"24\"> <font color=\"red\"><strong>$_SESSION[s]!</strong></font><br/>";
echo"<br/>
<img src=\"img/br.png\" width=\"24\" height=\"24\"> <a href=\"oplataBR\"><strong>купить бриллианты</strong></a><br/>
<img src=\"img/attck.png\" width=\"24\" height=\"24\"> <a href=\"game.php?ref=refresh\"><strong>играть</strong></a></div>
";
?>
<?
include("footer.php");
?>
<?
die;
}
}
}
$AC = new AC;
?>
</div>
