<?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); //закрытие } /** * FIXME Обращение к определённому персонажу в чате. Ещё сломается, если персонажа не существует. * addchp('Сообщение об ошибке, <strong>' . $user['login'] . '', '{[]}' . nick::id(10133)->short() . '{[]}'); */ ?> <!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>