File size: 4.83Kb
<?php
session_start();
include $_SERVER['DOCUMENT_ROOT'].'/includes/db.php';
include $_SERVER['DOCUMENT_ROOT'].'/includes/gzip.php';
include $_SERVER['DOCUMENT_ROOT'].'/includes/fnc.php';
if(file_exists($_SERVER['DOCUMENT_ROOT']."/setup/index.php")){
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ошибка!</title>
<style type="text/css">
body{
font-size:x-small;
color:#000000;
background-color:#FF0000;
margin:auto;
max-width:500px;
}
a:link,a:visited{
text-decoration:none;
color:#000000;
}
.ab{
border-style:solid;
border-width:1px;
background-color:#fff;
border-color:#000 #fff #fff #000;
margin:3px;
}
.bc{
border-style:solid;
border-width:1px;
background-color:#d4d0c8;
border-color:#fff #000 #000 #fff;
}
.cd{
background-color:#0000ff;
color:#fff;
}
</style></head><body>
<div class="bc">
<div class="cd"><b> Установка чата</b></div>
<div align="center">
Удалите файл <b>/setup/index.php</b>!<br/><br/>
<a class="bc" href="/install/delete.php"> OK </a><br/><br/>
</div></div></body></html>';
exit;
}
if(isset($_SESSION['auth']) and $_SESSION['auth']==1){
$usr = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `login` = '".$_SESSION['login']."' LIMIT 1"));
$now_user_agent = $usr['user_agent'];
$now_ip = $usr['ip'];
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$ip = $_SERVER['REMOTE_ADDR'];
if($_SESSION['login']=="" or $_SESSION['password']=="" or $_SESSION['login']!==$usr['login'] or $_SESSION['password']!==$usr['password']){
unset($_SESSION['id']);
unset($_SESSION['login']);
unset($_SESSION['auth']);
unset($_SESSION['password']);
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ошибка!</title>
<style type="text/css">
body{
font-size:x-small;
color:#000000;
background-color:#FF0000;
margin:auto;
max-width:500px;
}
a:link,a:visited{
text-decoration:none;
color:#000000;
}
.ab{
border-style:solid;
border-width:1px;
background-color:#fff;
border-color:#000 #fff #fff #000;
margin:3px;
}
.bc{
border-style:solid;
border-width:1px;
background-color:#d4d0c8;
border-color:#fff #000 #000 #fff;
}
.cd{
background-color:#0000ff;
color:#fff;
}
</style></head><body>
<div class="bc">
<div class="cd"><b> Предупреждение!</b></div>
<div align="center">Ваши данные устарели или Вас удалили из базы данных чата!
<br><br>
<a class="bc" href="/enter.php?"> Продолжить </a><br/><br/>
</div></div></body></html>';
exit;
}
$ban_q = mysql_query('SELECT `do` FROM `ban` WHERE `id_user`='.$usr[id].' ORDER BY `do` DESC LIMIT 1');
if(mysql_num_rows($ban_q)){
$ban_time = mysql_result($ban_q,0);
if($ban_time<time()){
mysql_query('DELETE FROM `ban` WHERE `do`<'.time().' and `user`='.$user.'');
}else{
$ban = true;
}}
$url = $_SERVER['SCRIPT_NAME'];
if($url!=="/go.php"){
if($ban){
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ошибка!</title>
<style type="text/css">
body{
font-size:x-small;
color:#000000;
background-color:#FF0000;
margin:auto;
max-width:500px;
}
a:link,a:visited{
text-decoration:none;
color:#000000;
}
.ab{
border-style:solid;
border-width:1px;
background-color:#fff;
border-color:#000 #fff #fff #000;
margin:3px;
}
.bc{
border-style:solid;
border-width:1px;
background-color:#d4d0c8;
border-color:#fff #000 #000 #fff;
}
.cd{
background-color:#0000ff;
color:#fff;
}
</style></head><body>
<div class="bc">
<div class="cd"><b> Бан!</b></div><div align="center">
Вы забанены до '.date('d.m / H:i',$ban_time).'
<br><br>
<a class="bc" href="/go.php?exit"> Выход </a><br/><br/>
</div></div></body></html>';
exit;
}
}
///запись статусов
if(empty($usr['status'])){
mysql_query("update users set status='1' where id='$usr[id]';" );
}
if(500<=$usr['posts'] && $usr['posts']<2500 && $usr['status'] == "1"){
mysql_query( "update users set status='2' where id='$usr[id]';");
}
if(2500 <= $posts && $posts < 5000 && $status == "2" ){
mysql_query( "update users set status='3' where id='$usr[id]';" );
}
///mysql_query("UPDATE `users` SET `time` = ".time()." WHERE `login` = '$_SESSION[login]' LIMIT 1");
///mysql_query("update users set balls=balls+1 where id_user='$id_user' limit 1");
}
include $_SERVER['DOCUMENT_ROOT'].'/includes/template.php';
?>