Файл: include/private.php
Строк: 582
<?php
if($authorize)
{
switch($_GET['d'])
{
default:
if(!empty($_GET['new']))
{
$new = "AND new=1 ";
}
if($version == "xhtml")
{
$thisPageSize = 1500;
}
else
{
$thisPageSize = 1500;
}
if($version == "wml")
{
header("content-type: text/vnd.wap.wml; charset=utf-8");
header("Cache-Control: no-cache");
echo(doctype("Приват - ".$username).$tag);
echo('<a href="./?p=24&d=1&sid='.$sid.'&v=wml">Сказать</a><br />
<a href="./?p=24&v=wml&sid='.$sid.'&rnd='.$ref."">Начало</a><br /><br />rn");
if( isset($_GET['clear']) )
{
echo("Вы уверены, что хотите удалить все сообщения?rn");
echo("<a href='./?p=24&d=4&v=wml&sid=$sid'>Да</a> | <a href='./?p=24&v=wml&sid=$sid'>Нет</a><br />rn");
}
$sql = "SELECT *
FROM private
WHERE name = '".$username."'
".$new."
ORDER BY `id` DESC ";
$count = mysql_num_rows(mysql_query($sql));
$start = intval($_GET['s']);
if(!empty($start))
{
$limit = "LIMIT ".$start.", ".abs($count - $start);
$int = $start;
}
else
{
$int = 0;
}
$sql .= $limit;
$query = mysql_query($sql);
while($mess = mysql_fetch_assoc($query))
{
static $s;
if($mess['new'] == 1 AND $mess['mod'] == 'i')
{
echo('*');
}
echo(date("d.m H:i", $mess['time']).']');
if($mess['mod'] == "o" AND preg_match("|^$username|iu", $mess['name']))
{
echo("<b>Я><a href="./?p=24&v=wml&sid=".$sid."&uid=".username2id($mess['tname'])."&d=1">".$mess['tname']."</a></b><br />rn");
}
else
{
echo("<b><a href="./?p=24&v=wml&sid=".$sid."&d=1&uid=".username2id($mess['tname'])."">".$mess['tname']."</a></b><br />rn");
}
echo(nl2br($mess['mess'])."<br />rn");
$int++;
$s += strlen($mess['time'].$mess['name'].$mess['tname'].$mess['mess']);
if($s + $thisPageSize + (110 * abs($int - $start)) > $pageSize)
{
if($int != $count)
{
$next = $int;
}
break;
}
}
echo("- - - - <br />rn");
if(!empty($next))
{
echo("<a accesskey="3" href="" . $_SERVER['PHP_SELF'] . "?p=24&v=wml&sid=".$sid."&s=".$next."">Дальше...(3)</a><br />rn");
}
echo("<a href='./?p=24&sid=$sid&v=wml&clear=1'>Очистить приват</a><br />rn");
echo("<a href="./?p=0&v=wml&sid=".$sid."" accesskey="1">В форум (1)</a>rn");
echo($tagC."</p></card></wml>");
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
echo('<html>
<head>
<title>Приват - '.$username.'</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'">
<font color="#FFFFFF"><b>Приват - '.$username.'</b></font>
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'">'.$tag.'
<a href="./?p=24&v=xhtml&sid='.$sid.'&d=1">Сказать</a><br />
<a href="./?p=24&v=xhtml&sid='.$sid.'&rnd='.$ref.'">Начало</a><br />');
if( isset($_GET['clear']) )
{
echo("Вы уверены, что хотите удалить все сообщения?rn");
echo("<a href='./?p=24&d=4&v=html&sid=$sid'>Да</a> | <a href='./?p=24&v=html&sid=$sid'>Нет</a><br />rn");
}
echo($tagC.'</td></tr>
<tr bgcolor="'.$style['text'].'"><td>'.$tag);
$sql = "SELECT *
FROM private
WHERE name = '".$username."'
".$new."
ORDER BY `id` DESC ";
$count = mysql_num_rows(mysql_query($sql));
$start = intval($_GET['s']);
if(!empty($start))
{
$limit = "LIMIT ".$start.", ".abs($count - $start);
$int = $start;
}
else
{
$int = 0;
}
$sql .= $limit;
$query = mysql_query($sql);
while($mess = mysql_fetch_assoc($query))
{
static $s;
if($mess['new'] == 1 AND $mess['mod'] == 'i')
{
echo('*');
}
echo(date("d.m H:i", $mess['time']).']');
if($mess['mod'] == "o" AND preg_match("|^$username|iu", $mess['name']))
{
echo("<b>Я><a href="./?p=24&v=xhtml&sid=".$sid."&uid=".username2id($mess['tname'])."&d=1">".$mess['tname']."</a></b><br />rn");
}
else
{
echo("<b><a href="./?p=24&v=xhtml&sid=".$sid."&d=1&uid=".username2id($mess['tname'])."">".$mess['tname']."</a></b><br />rn");
}
echo(nl2br($mess['mess'])."<br />rn");
$int++;
$s += strlen($mess['time'].$mess['name'].$mess['tname'].$mess['mess']);
if($s + $thisPageSize + (110 * abs($int - $start)) > $pageSize)
{
if($int != $count)
{
$next = $int;
}
break;
}
}
echo($tagC.'</td></tr>
<tr bgcolor="'.$style['bottom'].'"><td>'.$tag);
if(!empty($next))
{
echo("<a href="" . $_SERVER['PHP_SELF'] . "?p=24&v=xhtml&sid=".$sid."&s=".$next."">Дальше...</a><br />rn");
}
echo("<a href='./?p=24&sid=$sid&v=xhtml&clear=1'>Очистить приват</a><br />rn");
echo("<a href="./?p=0&v=xhtml&sid=".$sid."">В форум </a>rn");
echo($tagC.'</td></tr></table>
</body></html>');
}
mysql_query("UPDATE private SET new=0 WHERE name='".$username."'");
break;
case 1:
if($version == "wml")
{
header("content-type: text/vnd.wap.wml; charset=utf-8");
header("Cache-Control: no-cache");
echo(doctype("Приват - ".$username).$tag);
if(!empty($_GET['uid']))
{
$uid = intval($_GET['uid']);
$usernamee = mysql_query("SELECT username FROM users WHERE id=".$uid);
$query = mysql_query("SELECT * FROM users WHERE id=".$uid);
$q = mysql_fetch_assoc($query);
}
if(@mysql_num_rows($usernamee) != 0)
{
$link = mysql_fetch_assoc($usernamee);
echo("Кому: ");
if(!empty($_GET['t']))
{
$tq = mysql_fetch_assoc(mysql_query("SELECT * FROM themes WHERE id=".intval($_GET['t'])));
}
elseif(!empty($_GET['mt']))
{
$tq = mysql_fetch_assoc(mysql_query("SELECT * FROM mthemes WHERE id=".intval($_GET['mt'])));
}
if(!empty($_GET['t']) && $tq['close'] != "on")
{
$t = intval($_GET['t']);
echo('<a href="./?p=7&v=xhtml&sid='.$sid.'&f='.$t."&uid=".$uid."&rnd=".$ref."">[".$link['username'].']</a>');
}
elseif(!empty($_GET['mt']) && $tq['close'] != "on")
{
$t = intval($_GET['mt']);
echo('<a href="./?p=8&v=xhtml&sid='.$sid.'&f='.$t."&uid=".$uid."&rnd=".$ref."">[".$link['username'].']</a>');
}
else
{
echo('['.$link['username'].']');
}
echo(" <a href="./?p=6&v=wml&id=".$uid."&th=".$color."">[Анкета]</a> Рейтинг: rn".$tagC);
if(($status == "moderator" OR $status == "admin") AND (!mysql_result(mysql_query("SELECT COUNT(*) FROM `rating` WHERE rat_user = $uid AND `moder` = '$username'"), 0)) AND ($username != $q['username']))
{
echo("<b><a href="./?p=6&rat=1&id=".$uid."&sid=".$sid."&v=wml">+</a>".$q['rating']."/<a href="./?p=6&antirat=1&id=".$uid."&sid=".$sid."&v=wml">-</a>" . $q['antirating'] . "</b><br />");
}
else
{
echo("<b>+".$q['rating']."/-" . $q['antirating'] . "</b><br />");
}
if($q['username'] != $username)
{
echo("<a href='./?p=24&d=3&uid=$uid&v=wml&sid=$sid'>[В игнор]</a>rn");
echo(" <a href='./?p=24&d=5&uid=$uid&v=html&sid=$sid'>[В контакты]</a> <br />rn");
if( in_array($status, array('admin', 'moderator')) )
{
echo("<a href='./?p=26&v=wml&back=" . base64_encode(htmlspecialchars($_SERVER['REQUEST_URI'])) . "&username=" . $link['username'] . "&sid=$sid'>[Бан]</a><br />");
}
}
echo("<a href='./?p=29&stenid=$uid&v=html&sid=$sid'>Личная стена ".$q['username']."</a><br />rn");
}
else
{
echo($tag."Кому:".$tagC." <input type="text" name="to" maxlength="15" /><br />");
$sql = mysql_query("SELECT * FROM `contact` WHERE `uid` = $infoUserRows[id]");
if( mysql_num_rows($sql) )
{
echo('или <select name="contact">');
echo("<option></option>");
while($contacts = mysql_fetch_assoc($sql))
{
$print[] = "<option value='" . $contacts['contact_user'] . "'>" . $contacts['contact_user'] . "</option>rn";
}
echo("" . join($print) . "");
echo("</select>");
}
}
echo("<br />" . $tag."Сообщение:".$tagC." <input type="text" name="mess" /><br />
<anchor>[Сказать]
<go href="./?p=24&v=wml&sid=".$sid."&d=2&uid=" . $_GET['uid'] . "" method="post">
<postfield name="mess" value="$(mess)" />
<postfield name="to" value="$(to)".$link['username']."" />
</go></anchor><br />
".$tag."");
if($status == "admin" and $arruser != $username)
{
echo('<a href="./?p=27&v=wml&sid='.$sid.'&mode=moder&m=1&id='.$id.'">В модеры</a><br />');
}
echo("- - - - <br />
<a href='./?p=24&d=3&v=wml&sid=$sid'>Игнор-лист</a><br />
<a href='./?p=24&d=5&v=wml&sid=$sid'>Контакты</a><br />
<anchor>Назад<prev /></anchor><br />
<a href="./?p=24&v=wml&sid=".$sid."&rnd=".$ref."">В приват</a>
".$tagC."</p>
</card></wml>");
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
echo('<html>
<head>
<title>Приват - '.$username.'</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<form action="./?p=24&v=xhtml&sid='.$sid.'&d=2&uid=' . $_GET['uid'] . '" method="post">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr bgcolor="'.$style['title'].'"><td align="center" colspan="2">
<font color="#FFFFFF"><b>Приват - '.$username.'</b></font>
</td></tr>
<tr bgcolor="'.$style['bottom'].'">
<td colspan="2">
</td></tr>
<tr bgcolor="'.$style['text'].'"><td>');
if(!empty($_GET['uid']))
{
$uid = intval($_GET['uid']);
$usernamee = mysql_query("SELECT username FROM users WHERE id=".$uid);
$query = mysql_query("SELECT * FROM users WHERE id=".$uid);
$q = mysql_fetch_assoc($query);
}
if(@mysql_num_rows($usernamee) > 0)
{
$link = mysql_fetch_assoc($usernamee);
echo($tag."Кому:</td><td>");
if(!empty($_GET['t']))
{
$tq = mysql_fetch_assoc(mysql_query("SELECT * FROM themes WHERE id=".intval($_GET['t'])));
}
elseif(!empty($_GET['mt']))
{
$tq = mysql_fetch_assoc(mysql_query("SELECT * FROM mthemes WHERE id=".intval($_GET['mt'])));
}
if(!empty($_GET['t']) && $tq['close'] != "on")
{
$t = intval($_GET['t']);
echo(' <a href="./?p=7&v=xhtml&sid='.$sid.'&f='.$t."&uid=".$uid."&rnd=".$ref."">[".$link['username'].']</a> ');
}
elseif(!empty($_GET['mt']) && $tq['close'] != "on")
{
$t = intval($_GET['mt']);
echo(' <a href="./?p=8&v=xhtml&sid='.$sid.'&f='.$t."&uid=".$uid."&rnd=".$ref."">[".$link['username'].']</a> ');
}
else
{
echo(" [".$link['username']."] ");
}
if(empty($q['name']) and empty($q['realname']) and empty($q['rdate']) and empty($q['icq']) and empty($q['site']) and empty($q['mail']) and $q['sex'] == "n" and empty($q['about']))
{
echo("");
}
else
{
echo("<a href="./?p=6&v=xhtml&id=".$uid."&th=".$color."">[Анкета]</a> ");
}
echo("Рейтинг: ");
if(($status == "moderator" OR $status == "admin") AND (!mysql_result(mysql_query("SELECT COUNT(*) FROM `rating` WHERE rat_user = $uid AND `moder` = '$username'"), 0)) AND ($username != $q['username']))
{
echo("<b><a href="./?p=6&rat=1&id=".$uid."&sid=".$sid."&v=xhtml">+</a>".$q['rating']."/<a href="./?p=6&antirat=1&id=".$uid."&sid=".$sid."&v=xhtml">-</a>" . $q['antirating'] . "</b><br />");
}
else
{
echo("<b>+".$q['rating']."/-" . $q['antirating'] . "</b><br />");
}
if($q['username'] != $username)
{
echo("<a href='./?p=24&d=3&uid=$uid&v=html&sid=$sid'>[В игнор]</a>rn");
echo(" <a href='./?p=24&d=5&uid=$uid&v=html&sid=$sid'>[В контакты]</a><br />rn");
if( in_array($status, array('admin', 'moderator')) )
{
echo("<a href='./?p=26&v=xhtml&back=" . base64_encode(htmlspecialchars($_SERVER['REQUEST_URI'])) . "&username=" . $link['username'] . "&sid=$sid'>[Бан]</a><br />rn $tagC");
}
}
$hidden = "<input type="hidden" name="to" value="".$link['username']."" />rn";
echo("<a href='./?p=29&stenid=$uid&v=html&sid=$sid'>Личная стена ".$q['username']."</a><br />rn");
echo("</td></tr>");
}
else
{
echo($tag."Кому:".$tagC."</td><td> <input type="text" name="to" maxlength="15" /><br />");
$sql = mysql_query("SELECT * FROM `contact` WHERE `uid` = $infoUserRows[id]");
if( mysql_num_rows($sql) )
{
echo('или <select name="contact">');
echo("<option></option>");
while($contacts = mysql_fetch_assoc($sql))
{
$print[] = "<option value='" . $contacts['contact_user'] . "'>" . $contacts['contact_user'] . "</option>rn";
}
echo("" . join($print) . "");
echo("</select>");
}
echo("</td></tr>rn");
}
echo("<tr bgcolor="".$style['text'].""><td>
".$tag."Сообщение:".$tagC."</td><td><textarea name="mess" cols="30" rows="5"></textarea></td></tr>
<tr bgcolor="".$style['text'].""><td align="center" colspan="2">
".$hidden."
<input type="submit" value="Сказать" /></td></tr>
<tr bgcolor="".$style['bottom'].""><td colspan="2">
$tag");
if($status == "admin" and $q['username'] != $username)
{
echo("<a href="./?p=27&v=xhtml&sid=".$sid."&mode=moder&m=1&id=".$uid."">В модеры</a><br />");
}
echo("<a href="./?p=24&d=3&v=html&sid=".$sid."">Игнор-лист</a><br />
<a href="./?p=24&d=5&v=html&sid=".$sid."">Контакты</a><br />
<a href='javascript:history.back(1)'>Назад</a><br/>
<a href="./?p=24&v=xhtml&sid=".$sid."&rnd=".$ref."">В приват</a> $tagC
</td></tr></table>
</form>
</body></html>");
}
break;
case 2:
$mess = $_POST['mess'];
$to = $_POST['to'];
$uid = intval($_GET['uid']);
if(empty($to))
{
$to = $_POST['contact'];
}
if($transl == "on")
{
$mess = translate($mess);
}
$mess = preg_replace("|[rn]+|", " rn", $mess);
$mess = preg_replace("|[n]+|", "n", $mess);
$mess = sql(htmlspecialchars(trim(cutString($mess, 1024))));
$mess = preg_replace_callback("|<(d{1,20})>|", "smile", $mess);
if($status == "admin" or $starus == "moderator")
{
$mess = preg_replace("|[url=(.*)](.*)[/url]|is", "<a href="go/?\1">\2</a>", $mess);
$mess = preg_replace("|[b](.*)[/b]|i", "<b>\1</b>", $mess);
$mess = preg_replace("|[i](.*)[/i]|i", "<i>\1</i>", $mess);
}
if(strpos($mess, "http://") !== false)
{
if($status == "admin" or $starus == "moderator")
{
$mess = preg_replace("|[url=(.*)](.*)[/url]|is", "<a href="go/?\1">\2</a>", $mess);
}
$mess = preg_replace("|(http://[^s]+)|i", "<a href="go/?\1">\1</a>", $mess);
}
$to = substr($to, 0, 15);
////////////////////////////////////////////////////////Антифлуд
$R = mysql_query("SELECT * FROM `private`
WHERE `name`='".$username."'");
$aR = mysql_fetch_array($R);
$messR=$aR['mess'];
////////////////////////////////////////////////////////
if($status == "admin") $ip = "127.0.0.1"; else $ip = empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_FORWARDED_FOR'] ;
$ip = htmlspecialchars(sql($ip));
if($status == "admin") $user = "Admin"; else $user = htmlspecialchars(sql($_SERVER['HTTP_USER_AGENT']));
///////////Выбор писаря в приват
$pww = mysql_query("SELECT * FROM `users`
WHERE `username`='".$to."'");
$apww = mysql_fetch_array($pww);
$pw=$apww['pw'];
///////////
if(!mysql_result(mysql_query("SELECT COUNT(*) FROM users WHERE username='".$to."'"), 0))
{
if($version == "wml")
{
header('Content-type: text/vnd.wap.wml; charset=utf-8');
header("Cache-Control: no-cache");
echo(doctype("Ошибка").$tag.'
Пользователя не существует! <br />
- - - - <br />
<anchor>Назад<prev /></anchor><br />
<a href="./?p=24&v=wml&sid='.$sid.'">В приват</a>
'.$tag.'
</p></card></wml>');
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
echo('<html>
<head>
<title>Ошибка</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'">
<font color="#FFFFFF"><b>Ошибка</b></font>
</td></tr>
<tr><td bgcolor="'.$style['text'].'">
'.$tag.'Пользователя не существует!'.$tagC.'
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'">
'.$tag.'<a href="./?p=24&v=xhtml&sid='.$sid.'">В приват</a>'.$tagC.'
</td></tr></table>
</body></html>');
}
}
elseif(ban($username, $user, $ip))
{
if($version == "wml")
{
header('Content-type: text/vnd.wap.wml; charset=utf-8');
header("Cache-Control: no-cache");
echo(doctype("Ошибка").$tag.'
Ошибка! Вы заблокированы модератором '.$modername.'. <br />
Причина: '.$banmess.'! <br />
-
<a href="'.$_SERVER['HTTP_REFERER'].'">Назад</a><br />
<a href="./?p=0&v=wml&sid='.$sid.'">Форумы</a>
'.$tagC.'</p></card></wml>');
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
echo('<html>
<head>
<title>Ошибка</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr align="center" bgcolor="'.$style['title'].'"><td colspan="2">
<font color="#FFFFFF"><b>Ошибка</b></font>
<tr bgcolor="'.$style['text'].'"><td colspan="2">'.$tag.'Вы заблокированы модератором '.$modername.'</td></tr>
<tr bgcolor="'.$style['text'].'"><td>'.$tag.'Причина:'.$tagC.'</td><td>'.$tag.$banmess.$tagC.'</td></tr>
<tr bgcolor="'.$style['bottom'].'"><td colspan="2">'.$tag.'
<a href="./?p=0&v=xhtml&sid='.$sid.'">Форумы</a>
'.$tagC.'</td></tr></table>
</body></html>');
}
}
elseif($pw == "ce" && !mysql_result(mysql_query("SELECT COUNT(*) FROM `contact` WHERE `uid` = '$uid' AND `contact_user` = '".$username."'"), 0))
{
if($version == "wml")
{
header('Content-type: text/vnd.wap.wml; charset=utf-8');
header("Cache-Control: no-cache");
echo(doctype("Ошибка").$tag.'
Вы не можете писать этому пользователю в приват, т.к. Вы не добавлены у него в список Контактов. <br />
- - - - <br />
<anchor>Назад<prev /></anchor><br />
<a href="./?p=24&v=wml&sid='.$sid.'">В приват</a>
'.$tag.'
</p></card></wml>');
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
echo('<html>
<head>
<title>Ошибка</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'">
<font color="#FFFFFF"><b>Ошибка</b></font>
</td></tr>
<tr><td bgcolor="'.$style['text'].'">
'.$tag.'Вы не можете писать этому пользователю в приват, т.к. Вы не добавлены у него в список Контактов.<br />'.$tagC.'
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'">
'.$tag.'<a href="./?p=24&v=xhtml&sid='.$sid.'">В приват</a>'.$tagC.'
</td></tr></table>
</body></html>');
}
}
elseif($pw == "ci")
{
header("Location: ".$_SERVER['PHP_SELF'].'?p=24&v='.$version.'&sid='.$sid.'&rnd='.$ref);
}
else
{
if(!empty($_POST['mess']) && $to != $username && strtolower($mess) != strtolower($messR))
{
if(mysql_result(mysql_query("SELECT COUNT(*) FROM private WHERE name='".$username."' AND `mod`='o'"), 0) > 15)
{
mysql_query("DELETE FROM private WHERE name='".$username."' AND `mod`='o' ORDER BY id LIMIT 1");
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM private WHERE name='".$to."' AND `mod`='i'"), 0) > 15)
{
mysql_query("DELETE FROM private WHERE name='".$to."' AND `mod`='i' ORDER BY id LIMIT 1");
}
$uid = (int)$_GET['uid'];
if(!mysql_result(mysql_query("SELECT COUNT(*) FROM `ignore` WHERE uid = $uid AND `ignore_user` = '$username'"), 0))
{
mysql_query("INSERT INTO private VALUES(0, '".$mess."', '".$to."', 'i', '".$username."', 1, ".time().")");
mysql_query("INSERT INTO private VALUES(0, '".$mess."', '".$username."', 'o', '".$to."', 1, ".time().")");
}
}
header("Location: ".$_SERVER['PHP_SELF'].'?p=24&v='.$version.'&sid='.$sid.'&rnd='.$ref);
}
break;
case 3:
if( isset($_GET['uid']) )
{
if( mysql_result(
mysql_query("SELECT COUNT(*) FROM `users` WHERE `id` = " . intval($_GET['uid'])), 0))
{
$uid2name = mysql_fetch_assoc(mysql_query("SELECT username FROM users WHERE id = " . intval($_GET['uid'])));
if( !mysql_result(mysql_query("SELECT COUNT(*) FROM `ignore` WHERE uid = $infoUserRows[id] AND `ignore_user` = '$uid2name[username]'"), 0))
{
mysql_query("INSERT INTO `ignore` VALUES(0, $infoUserRows[id], '" . $uid2name['username'] . "')");
}
}
}
if( isset($_GET['del']) )
{
$id = (int)$_GET['id'];
if( mysql_result(mysql_query(
"SELECT COUNT(*) FROM `ignore` WHERE id = $id AND uid = $infoUserRows[id]"), 0) )
{
mysql_query("DELETE FROM `ignore` WHERE id = $id");
}
}
$sql = mysql_query("SELECT * FROM `ignore` WHERE `uid` = $infoUserRows[id]");
if( !mysql_num_rows($sql) )
{
$print[] = "Список игнорируемых пуст!<br />";
}
else
{
while($contacts = mysql_fetch_assoc($sql))
{
$sqlc = mysql_query("SELECT * FROM `users` WHERE `username` = '".$contacts['ignore_user']."'");
$idd = mysql_fetch_assoc($sqlc);
$dd = $idd['id'];
$print[] = "<a href="./?p=24&v=".$version."&sid=".$sid."&d=1&uid=".$dd.""><b>" . $contacts['ignore_user'] . "</b></a> - <a href='./?p=24&del=1&sid=$sid&d=3&id=" . $contacts['id'] . "&v=" . $version . "'>[Удалить]</a><br />rn";
}
}
if($version == "wml")
{
header('Content-type: text/vnd.wap.wml; charset=utf-8');
header("Cache-Control: no-cache");
echo(doctype("Игнор") . $tag .
" <br /> rn" .
join($print) . "
- - - - <br />
<anchor>Назад<prev /></anchor><br />
<a href='./?p=24&v=wml&sid=$sid'>В приват</a>
".$tag."
</p></card></wml>");
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
echo('<html>
<head>
<title>Игнор</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'">
<font color="#FFFFFF"><b>Игнор</b></font>
</td></tr>
<tr><td bgcolor="'.$style['text'].'">
'.$tag . join($print) . $tagC.'
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'">
'.$tag.'<a href="./?p=24&v=xhtml&sid='.$sid.'">В приват</a>'.$tagC.'
</td></tr></table>
</body></html>');
}
break;
case 4:
mysql_query("DELETE FROM private WHERE name = '$username'");
header("Location: ".$_SERVER['PHP_SELF'].'?p=24&v='.$version.'&sid='.$sid.'&rnd='.$ref);
break;
case 5:
if( isset($_GET['uid']) )
{
if( mysql_result(
mysql_query("SELECT COUNT(*) FROM `users` WHERE `id` = " . intval($_GET['uid'])), 0))
{
$uid2name = mysql_fetch_assoc(mysql_query("SELECT username FROM users WHERE id = " . intval($_GET['uid'])));
if( !mysql_result(mysql_query("SELECT COUNT(*) FROM `contact` WHERE uid = $infoUserRows[id] AND `contact_user` = '$uid2name[username]'"), 0))
{
mysql_query("INSERT INTO `contact` VALUES(0, $infoUserRows[id], '" . $uid2name['username'] . "')");
}
}
}
if( isset($_GET['del']) )
{
$id = (int)$_GET['id'];
if( mysql_result(mysql_query(
"SELECT COUNT(*) FROM `contact` WHERE id = $id AND uid = $infoUserRows[id]"), 0) )
{
mysql_query("DELETE FROM `contact` WHERE id = $id");
}
}
$sql = mysql_query("SELECT * FROM `contact` WHERE `uid` = $infoUserRows[id]");
if( !mysql_num_rows($sql) )
{
$print[] = "Список контактов пуст!<br />";
}
else
{
while($contacts = mysql_fetch_assoc($sql))
{
$sqlc = mysql_query("SELECT * FROM `users` WHERE `username` = '".$contacts['contact_user']."'");
$idd = mysql_fetch_assoc($sqlc);
$dd = $idd['id'];
$print[] = "<a href="./?p=24&v=".$version."&sid=".$sid."&d=1&uid=".$dd.""><b>" . $contacts['contact_user'] . "</b></a> - <a href='./?p=24&del=1&sid=$sid&d=5&id=" . $contacts['id'] . "&v=" . $version . "'>[Удалить]</a><br />rn";
}
}
if($version == "wml")
{
header('Content-type: text/vnd.wap.wml; charset=utf-8');
header("Cache-Control: no-cache");
echo(doctype("Контакты") . $tag .
" <br /> rn" .
join($print) . "
- - - - <br />
<anchor>Назад<prev /></anchor><br />
<a href='./?p=24&v=wml&sid=$sid'>В приват</a>
".$tag."
</p></card></wml>");
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
echo('<html>
<head>
<title>Контакты</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'">
<font color="#FFFFFF"><b>Контакты</b></font>
</td></tr>
<tr><td bgcolor="'.$style['text'].'">
'.$tag . join($print) . $tagC.'
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'">
'.$tag.'<a href="./?p=24&v=xhtml&sid='.$sid.'">В приват</a>'.$tagC.'
</td></tr></table>
</body></html>');
}
break;
}
}
?>