Файл: region_clean/avt.php
Строк: 273
<?php
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################
require_once "start.php";
require_once "sid.php";
header("Cache-Control: no-cache");
if ($ver == "wml") header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else header("Content-Type:text/html; charset=UTF-8");
require_once "inc.php";
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);
require_once "version.php";
$us = $row['user'];
if (!is_numeric($nk)) { header ("Location: index.php?isset=403"); }
$mod = isset($_GET['mod']) ? $_GET['mod'] : NULL;
switch ($mod) {
default:
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n
<card id="avtoritet" title="Авторитет">n
<p align="left" mode="wrap">n";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Авторитет</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="left">";
}
$nk = intval($_GET['nk']);
if (!is_numeric($nk))
{
header('Location: index.php?isset=403');
}
$komu = mysql_fetch_array(mysql_query("SELECT `id`,`user` FROM `users` WHERE `id`='".(int)$nk."'"));
echo '<div class="c4">Комментарии '.$komu['user'].'</div><br/>';
$p = intval($_GET['p']);
if (empty($_GET['p'])) $page = 1;
else $page = $_GET['p'];
if (!is_numeric($p))
{
header("Location: index.php?isset=403");
}
$result = mysql_query("SELECT count(`id`) FROM `avtoritet` WHERE `id_user`='".(int)$nk."'");
$cntData = mysql_fetch_row($result);
$count_users = $cntData[0];
$max_page = ceil ($count_users / 10);
$page = ($page > $max_page) ? (($max_page == 0)? $page : $max_page) : $page;
$start = 10*($page-1);
$end = 10;
$start = intval($start);
$end = intval($end);
$resultx = mysql_query("SELECT * FROM `avtoritet` where id_user='".(int)$nk."' ORDER BY `id` DESC LIMIT $start,$end;");
$count_users_on_pagex = mysql_num_rows($resultx);
if ($count_users_on_pagex == 0) { echo 'Отзывов: 0<br/>'; }
for($i = 0; $i < $count_users_on_pagex; $i++)
{
$row = mysql_fetch_array($resultx);
$id_user = $row['id_user'];
$id_who = $row['id_who'];
$time_vers = $row['time'];
$colc = $row['col'];
$message = $row['message'];
$time_vers = date("d.m.Y/H:i",$time_vers);
$view = mysql_query("SELECT `id`,`user` FROM `users` WHERE `id`='" . intval($id_user) . "';");
$rowd = mysql_fetch_array($view);
$id1 = $rowd[0];
$nick1 = $rowd[1];
$view2 = mysql_query("SELECT `id`,`user` FROM `users` WHERE `id`='" . intval($id_who) . "';");
$rowd2 = mysql_fetch_array($view2);
$id2 = $rowd2[0];
$nick2 = $rowd2[1];
if ($colc == 0) { $x = '<font color="#FF0000"><small>[Отрицательный]</small></font>'; }
if ($colc == 1) { $x = '<font color="#22C602"><small>[Положительный]</small></font>'; }
if (!empty($nick2)) {
echo '<div class="d1"><a href="info.php?nk='.$id2.'&'.$ses.'"><b>'.col_n($nick2).'</b></a> ('.$time_vers.')'.$x.'</div>
'.$message.'<br/>';
} else {
echo '<div class="d1"><b>Юзер удален</b> ('.$time_vers.')'.$x.'</div>
'.$message.'<br/>';
}
}
if ($max_page > 1)
{
$ba = ceil($count_users/10);
$ba2 = $ba * 10 - 10;
echo 'Страницы:';
$asd = $start - (10 * 4);
$asd2 = $start + (10 * 5);
if ($asd < $count_users and $asd > 0) {
echo ' <a href="avt.php?'.$ses.'&p=1&nk='.$nk.'&type='.$type.'">1</a> ... ';
}
for($i = $asd; $i < $asd2;)
{
if ($i < $count_users and $i >= 0) {
$ii = floor(1+$i/10);
if ($start == $i) {
echo ' <b>('.$ii.')</b>';
}
else
{
echo ' <a href="avt.php?'.$ses.'&p='.$ii.'&nk='.$nk.'&type='.$type.'">'.$ii.'</a>';
}
}
$i = $i + 10;
}
if ($asd2 < $count_users) {
echo ' ... <a href="avt.php?'.$ses.'&p='.$ba.'&nk='.$nk.'&type='.$type.'">'.$ba.'</a>';
}
}
echo '<br/><div class="d1"><a href="avt.php?'.$ses.'&mod=adds&nk='.$nk.'">Добавить</a><br/>
<a href="enter.php?'.$ses.'&ref='.$ref.'">Прихожая</a></div>';
include_once 'foot.php';
break;
#===========================================#
case 'adds':
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n
<card id="avtoritet" title="Авторитет">n
<p align="left" mode="wrap">n";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Авторитет</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="left">";
}
$nk = intval($_GET['nk']);
if (!is_numeric($nk)) {
header('Location: index.php?isset=403');
}
$komu = mysql_fetch_array(mysql_query("SELECT `user` FROM `users` WHERE `id`='".(int)$nk."'"));
echo "<div class='c4'>Авторитет ".$komu['user']."</div><br/>
[<a href="avt.php?$ses&nk=$nk&type=1&mod=add">Плюс <img src = 'icon/plus.gif' alt='+'/></a>] |
[<a href="avt.php?$ses&nk=$nk&type=0&mod=add">Минус <img src = 'icon/minus.gif' alt='-'/></a>]<br/>";
echo '<br/><div class="d1"><a href="enter.php?'.$ses.'&ref='.$ref.'">Прихожая</a></div>';
include_once 'foot.php';
break;
#===========================================#
case 'add':
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n
<card id="avtoritet" title="Авторитет">n
<p align="left" mode="wrap">n";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Авторитет</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="left">
<form method="POST" action="avt.php?$ses&mod=add_ok&type=$type&nk=$nk&ref=$ref" name="auth">n";
}
$nk = intval($_GET['nk']);
if (!is_numeric($nk)) {
header('Location: index.php?isset=403');
}
$type = intval($_GET['type']);
if ($type != 1 && $type != 0) {
header('Location: index.php?isset=403');
}
$komu = mysql_fetch_array(mysql_query("SELECT `user` FROM `users` WHERE `id`='".(int)$nk."'"));
echo 'Твой отзыв к анкете: <b>'.col_n($komu['user']).'</b><br/>
<br/><input type="text" maxlength="50" name="message"/><br/>';
if ($ver == "wml") {
echo $fsize1;
echo "<anchor title="Sign">Добавить<go href="avt.php?$ses&mod=add_ok&type=$type&nk=$nk" method="post">n
<postfield name="message" value="$(message)"/>n
</go></anchor><br/>n";
echo $fsize2;
} else {
echo "<br/><input type=submit class="ibutton" value="Добавить"/></form>n";
}
echo '<br/><div class="d1"><a href="enter.php?'.$ses.'&ref='.$ref.'">Прихожая</a></div>';
include_once 'foot.php';
break;
#===========================================#
case 'add_ok':
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n
<card id="avtoritet" title="Авторитет">n
<p align="left" mode="wrap">n";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Авторитет</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="left">";
}
$nk = intval($_GET['nk']);
if (!is_numeric($nk)) {
header('Location: index.php?isset=403');
}
$type = intval($_GET['type']);
if ($type != 1 && $type != 0) {
header('Location: index.php?isset=403');
}
if ($id == $_GET['nk']) {
echo 'Нельзя ставить себе авторитет!<br/>';
include_once 'foot.php';
break;
}
if (empty($_POST['message'])) {
echo 'Укажи свой комментарий к отзыву!<br/>';
include_once 'foot.php';
break;
}
$rb = mysql_fetch_row(mysql_query("SELECT count(`id`) FROM `avtoritet` WHERE `id_user`='".(int)$nk."' AND `id_who`='$id'"));
$pv = $rb[0];
$rbv = mysql_fetch_row(mysql_query("SELECT `posts` FROM `users` WHERE `id`='$id'"));
$pvc = $rbv[0];
$srok = mysql_fetch_array(mysql_query("SELECT `date` FROM `users` WHERE `id`='$id'"));
$srok_m = $srok['date'];
$tsmp = strtotime($srok_m);
$seconds = time() - $tsmp;
$days = $seconds/86400;
$days = round(intval($days), 1);
if ($days < 3) {
echo 'Ошибка! Твой ник должен быть зареган не менее 3х дней!<br/>';
include_once 'foot.php';
break;
}
if ($pv == 0 and $nk != $id and $pvc > 200) {
$message = mysql_real_escape_string(check($message));
if ($_GET['type'] == 0) { mysql_query("UPDATE `users` SET `avtoritet1`=`avtoritet1`+'1' WHERE `id`='".(int)$nk."'"); }
if ($_GET['type'] == 1) { mysql_query("UPDATE `users` SET `avtoritet`=`avtoritet`+'1' WHERE `id`='".(int)$nk."'"); }
$time = time();
mysql_query("INSERT INTO `avtoritet` SET `id_user`='".(int)$nk."', `id_who`='$id', `col`='".$_GET['type']."', `time`='".$time."' , message='".$message."'");
} else {
echo 'Нельзя дважды ставить авторитет или у тебя недостаточно постов!<br/>';
include_once 'foot.php';
break;
}
$komu = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".(int)$nk."'"));
if ($_GET['type'] == 0) {
echo 'Твой отрицательный голос за <b>'.col_n($komu['user']).'</b> принят!<br/><br/>
<div class="d1"><a href="enter.php?'.$ses.'&ref='.$ref.'">Прихожая</a></div>';
}
if ($_GET['type'] == 1) {
echo 'Твой положительный голос за <b>'.col_n($komu['user']).'</b> принят!<br/><br/>
<div class="d1"><a href="enter.php?'.$ses.'&ref='.$ref.'">Прихожая</a></div>';
}
$adm = mysql_query("Select id, user from users where id='$nk'");
$z = mysql_fetch_array($adm);
$data = date("d-M-Y [H:i]");
$kol = rand(0,99999999);
$time = time();
$topic = "Поставлен Авторитет!";
if ($_GET['type'] == 1) {
$message = "Пользователь <b>" . $us . "</b> поставил тебе (+)плюс в авторитет :)";
} else {
$message = "Пользователь <b>" . $us . "</b> поставил тебе (-)минус в авторитет :(";
}
mysql_query("Insert into zapiski set klu4='".$kol."', idwho ='1', message = '".$message."', towhom = '$id', idtowhom = '".(int)$nk."', time = '".$time."', readd = '0', topic = '".$topic."', date='".$data."'");
echo $fsize2;
include_once "foot.php";
}
?>