Файл: minichat_by_KoT/minichat_by_KoT/index.php
Строк: 56
<?php
##########################################
# ~ Разработка отдельных модулей ~~~~~~~ #
# ~ и написание скриптов на php (c)KoT ~ #
# ~ ICQ: 7675072 ~~~~~~~~~~~~~~~~~~~~~~~ #
# ~ Site: 4atlove.ru ~~~~~~~~~~~~~~~~~~~ #
# ~ E-mail: notefree@bk.ru ~~~~~~~~~~~~~ #
##########################################
require 'sid.php'; // старт сессий
header("Cache-Control: no-cache");
header('Content-Type:text/html; charset=UTF-8');
require 'config.php';
$link = connect_db();
include 'head.php'; // шапка
include 'pages.php'; // постр. навигация
include 'ip_ua.php'; // вычисляем айпи/софт
$ref = mt_rand(10000,1000000);
$welcome = $div1 . 'Добро пожаловать!' . $div5; // приветствие
echo '<b>' . $welcome . '</b><hr/>';
if (isset($_GET['isset']) == 403) // посылаем на куй при невозможном запросе
{
echo $bad . 'ERROR 403<br/>Недопустимый запрос</b>' . $div5;
}
if (extension_loaded('ffmpeg')) echo 'OK'; else echo 'NO';
if ($ip && $ua)
{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `guests` WHERE `ip` = '$iplong' AND `ua` = '".mysql_real_escape_string(check($ua))."' LIMIT 1"), 0) == 1)
{
$guests = mysql_fetch_assoc(mysql_query("SELECT * FROM `guests` WHERE `ip` = '$iplong' AND `ua` = '".mysql_real_escape_string(check($ua))."' LIMIT 1"));
mysql_query("UPDATE `guests` SET `date_last` = ".time().", `url` = '".mysql_real_escape_string($_SERVER['SCRIPT_NAME'])."', `pereh` = '".($guests['pereh'] + 1)."' WHERE `ip` = '$iplong' AND `ua` = '".mysql_real_escape_string(check($ua))."' LIMIT 1");
}
else
{
mysql_query("INSERT INTO `guests` (`ip`, `ua`, `date_aut`, `date_last`, `url`) VALUES ('$iplong', '".mysql_real_escape_string(check($ua))."', '".time()."', '".time()."', '".mysql_real_escape_string($_SERVER['SCRIPT_NAME'])."')");
}
}
$col_g = mysql_result(mysql_query("SELECT COUNT(*) FROM `guests` WHERE `date_last` > ".(time() - 400)." AND `pereh` > '0'"), 0);
$kol = mysql_result(mysql_query("SELECT count(`id`) FROM `users` WHERE `onl` + '100' > '$time'"),0);
echo $div3 . '
В чате: [<b>' . $kol . '</b>]<br/>
За стеклом: [<a href="online_g.php?'.$ref.'"><b>' . $col_g . '</b></a>]<hr/>
<a href="auth.php?'.$ref.'"><b>Войти в чат</b></a><br/>
<small>Переписка чата:</small><br/>';
$k_post = mysql_result(mysql_query("SELECT count(*) FROM `message` WHERE `msg`!='' AND `user_id`!='1'"), 0);
$k_page = k_page($k_post, 6);
$page = page($k_page);
$start = 6 * $page - 6;
$vRoom = mysql_query("SELECT * FROM `message` WHERE `msg`!='' AND `user_id`!='1' ORDER BY `id` DESC LIMIT ".abs(intval($start)).", 6");
echo $div3;
if (mysql_affected_rows() != 0) {
while ($view = mysql_fetch_assoc($vRoom)) {
if (!empty($view['komu'])) {
$view['komu'] = user_inf($view['komu'], 'user') . ', ';
} else {
$komu = '';
}
if ($view['color'] == 0) $message = $view['komu'] . text($view['msg']);
elseif ($view['color'] == 1) $message = $view['komu'] . '<font color="#0000FF">' . text($view['msg']) . '</font>';
elseif ($view['color'] == 2) $message = $view['komu'] . '<font color="#FF0000">' . text($view['msg']) . '</font>';
elseif ($view['color'] == 3) $message = $view['komu'] . '<font color="#309d0e">' . text($view['msg']) . '</font>';
elseif ($view['color'] == 4) $message = $view['komu'] . '<font color="#80FF00">' . text($view['msg']) . '</font>';
elseif ($view['color'] == 5) $message = $view['komu'] . '<font color="#00FFFF">' . text($view['msg']) . '</font>';
elseif ($view['color'] == 6) $message = $view['komu'] . '<font color="#FF8000">' . text($view['msg']) . '</font>';
elseif ($view['color'] == 7) $message = $view['komu'] . '<font color="#C0C0C0">' . text($view['msg']) . '</font>';
elseif ($view['color'] == 8) $message = $view['komu'] . '<font color="#FF00FF">' . text($view['msg']) . '</font>';
elseif ($view['color'] == 9) $message = $view['komu'] . '<font color="#000000">' . text($view['msg']) . '</font>';
echo '<small>' . col($view['user']) . ' (' . date($view['time']) . ')>' . $komu . text($message) . '</small><br/>';
}
} else {
echo '<small>Пусто...</small><br/>';
}
if ($k_page > 1) {
str('index.php?', $k_page, $page);
}
echo $div5;
$count = mysql_result(mysql_query("SELECT count(`id`) FROM `users`"), 0);
echo '<a href="pass.php?'.$ref.'"><b>Восстановление пасса</b></a>
<br/>Регистраций: ' . $count . $div5;
include 'foot.php'; // ноги
?>