battles/zavis.php

44 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/* Отвязал от functions.php но так и не понял что этот файл делает.
* */
header("Content-Type: text/html; charset=utf-8");
session_start();
if ($_SESSION['uid'] == null) header("Location: index.php");
include "config.php";
//$user = mysql_fetch_array(mysql_query("SELECT `battle` FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
$user = ($db->query('SELECT `battle` FROM `users` WHERE `id` = ?i LIMIT 1', $_SESSION['uid']))->fetch_assoc_array();
if ($user['battle'] != 0) {header('location: fbattle.php'); die();}
function addchp($text, $who, $room = 0)
{
global $user;
if ($room == 0) $room = $user['room'];
$fp = fopen("tmp/chat.txt", "a"); //открытие
flock($fp, LOCK_EX); //БЛОКИРОВКА ФАЙЛА
fputs($fp, ":[" . time() . "]:[{$who}]:[" . ($text) . "]:[" . $room . "]\r\n"); //работа с файлом
fflush($fp); //ОЧИЩЕНИЕ ФАЙЛОВОГО БУФЕРА И ЗАПИСЬ В ФАЙЛ
flock($fp, LOCK_UN); //СНЯТИЕ БЛОКИРОВКИ
fclose($fp); //закрытие
}
addchp('Сообщение об ошибке, <strong>' . $user['login'] . '', '{[]}' . nick7($user['id'] = 10133) . '{[]}');
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel=stylesheet href="css/main.css?v=1">
</head>
<body bgcolor=e2e0e0>
<p style="text-align: center;font-style: italic;">Сообщение отправлено!</p>
<script>
function cityg(){
location.href='main.php';
}
setTimeout('cityg()', 3000);
</script>
</body>
</html>