View file my.php

File size: 22.64Kb
<?php
include_once("incs/conf.php");
include_once("incs/fmysql.php");
include_once("incs/fnc.php");
include_once("incs/head.php");

$id=fil($_GET['id']);
$a=fil($_GET['act']);

if($id==""){$id=$user[id];}

$my=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$id'"));
$friends=mysql_fetch_array(mysql_query("SELECT * FROM `friends` WHERE `id_user` = '$user[id]' AND `id_friends` = '$my[id]' OR `id_user` = '$my[id]' AND `id_friends` = '$user[id]'"));

if($my[nick]==""){
head("Ошибка",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "Ошибка</div>";
echo"Такого пользователя не существует!<br>";
include_once("incs/down.php");
}

$ban_ok=$user[ban]-$time;
if($ban_ok>0){
if($user[id]==$my[id] && $on==1){
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "Страничка пользователя <b>$my[nick]</b></div>";

echo "Вы забанены по причине:<br>";
echo "<b>$user[ban_prich]</b><br>";
echo "До окончания бана осталось: $ban_ok сек.<br>";
echo "Старайтесь больше не нарушать <a href=\"rules.php\">правила</a> сайта!<br>";
include_once("incs/down.php");
}
}

switch($a){

case 'opros':
if($user[id]==$my[id]){
if($user[id]==$my[id] && $on==1){
head("$my[nick] - Ответ на опрос",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "<a href=\"my.php?id=$my[id]\">$my[nick]</a> - Ответ на опрос</div>";
$skok=0;
$vote=mysql_query("SELECT * FROM `votes` WHERE `id` != '0' ORDER BY id DESC");
while ($votes = mysql_fetch_array($vote))
{
$opros = mysql_fetch_array(mysql_query("SELECT * FROM `votes_access` WHERE `id_votes` = '$votes[id]'"));
if($opros[id_user]!=$user[id]){
$skok++;
echo "<div class='menu'><a href=\"votes.php?id=$votes[id]\">$votes[name]</a></div>";
}
}
if($skok==0){echo "Вы ответили на все опросы<br>";}
include_once("incs/down.php");
}
}
break;

case 'friend_add':
if($friends[id]=="" && $id!=$user[id]){
mysql_query("INSERT INTO `friends` (`id_user`, `id_friends`) values('$user[id]', '$my[id]')");
}
break;

case 'stat':
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "Статистика пользователя <b>$my[nick]</b></div>";
$kol_them = mysql_num_rows(mysql_query("SELECT id FROM `forum` WHERE `id_user` = '$my[id]'"));
$kol_post = mysql_num_rows(mysql_query("SELECT id FROM `forum_post` WHERE `id_user` = '$my[id]'"));
$kol_chat_post = mysql_num_rows(mysql_query("SELECT id FROM `chat_post` WHERE `id_user` = '$my[id]'"));
$kol_qv_post = mysql_num_rows(mysql_query("SELECT id FROM `qv` WHERE `id_user` = '$my[id]'"));
$obmen_files = mysql_num_rows(mysql_query("SELECT id FROM `obmen` WHERE `id_user` = '$my[id]' AND `mod` = '1'"));
$books = mysql_num_rows(mysql_query("SELECT id FROM `lib` WHERE `id_user` = '$my[id]'"));

$t_reg=$my[date_reg];
$t_ot_r=$time-$t_reg;
$time_ot_reg=floor($t_ot_r/3600);
$tim_on_site=floor($my[time_online]/3600);

$one_s=$tim_on_site*3600;
$one_s=$my[time_online]-$one_s;
$one_s=floor($one_s/60);

$two_s=$time_ot_reg*3600;
$two_s=$t_ot_r-$two_s;
$two_s=floor($two_s/60);

echo "С момента регистрации прошло: $time_ot_reg часов $two_s мин.<br>";
echo "Провел на сайте: $tim_on_site часов $one_s мин.<br>";
echo "Сообщений в гостевой: $kol_qv_post<br>";
echo "Сообщений в чате: $kol_chat_post<br>";
echo "Тем в форуме: <a>$kol_them</a><br>";
echo "Сообщений в форуме: $kol_post<br>";
echo 'Статей в библиотеке: '.$books.'<br>';
echo "Файлов в обменнике: <a>$obmen_files</a><br>";

include_once("incs/down.php");
break;

case 'settings':
if($user[id]==$my[id] && $on==1){
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "<a href=\"my.php?id=$my[id]\">$my[nick]</a> - Настройки</div>";
echo "<div class=\"menu\"><a href=\"?act=avatar\">Настройка аватара</a></div>";
echo "<div class=\"menu\"><a href=\"?act=set_ank\">Настройка анкеты</a></div>";
echo "<div class=\"menu\"><a href=\"?act=azer\">Общие настройки</a></div>";
echo "<div class=\"menu\"><a href=\"?act=pass\">Смена пароля</a></div>";
include_once("incs/down.php");
}
break;

case 'avatar':
if($user[id]==$my[id] && $on==1){
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "<a href=\"my.php?id=$my[id]\">$my[nick]</a> - Настройка аватара</div>";
if(is_file("avatar/$my[id]$my[avatar]")){
echo "<br><img src='avatar/".$my[id].$my[avatar]."' width='240' height=320' alt='ava' border='0'/><br>";
}else{
echo "<br><img src=\"styles/img/user.png\" alt=\"\"/><br>";
}
echo "<b>Загрузить аватар(розрешимые форматы - PNG,GIF,JPG):</b><br/>";
echo "<form action=?act=up_ava method=post enctype=multipart/form-data>
<input type=file name=uploadfile>";
echo "<br><input type=submit value=Загрузить></form>";

include_once("incs/down.php");
}
break;

case 'up_ava':
if($user[id]==$my[id] && $on==1){
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "<a href=\"my.php?id=$my[id]\">$my[nick]</a> - Настройка аватара</div>";

$ids=$user[id];
$uploaddir = './avatar/';
$filename = basename($_FILES['uploadfile']['name']);
$fileformat = substr($filename,-4);
if($fileformat!==".png" && $fileformat!==".gif" && $fileformat!==".jpg"){
echo "Ошибка формата<br>";
}else{
$filename = $ids.$fileformat;
$uploadfile = $uploaddir.$filename;
if (copy($_FILES['uploadfile']['tmp_name'], $uploadfile)){
mysql_query("UPDATE `user` SET `avatar` = '$fileformat' WHERE `id` = $user[id]");
echo "Аватар загружен.<br>";
include_once("incs/down.php");
}else{
echo "Ошибка! Не удалось загрузить аватар на сервер!<br>";
echo "<a href=\"?act=avatar\">Назад</a><br>";
}
}
include_once("incs/down.php");
}
break;

case 'pass':
if($user[id]==$my[id] && $on==1){
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "<a href=\"my.php?id=$my[id]\">$my[nick]</a> - Смена пароля</div>";
echo "<form method='post' action='?act=pass_save'>";

echo "Введите старый пароль:<br><input type='password' name='pass' maxlength='32' /><br>";
echo "Введите новый пароль:<br><input type='password' name='new_pass' maxlength='32' /><br>";
echo "Повторите новый пароль:<br><input type='password' name='pov_new_pass' maxlength='32' /><br>";

echo "<input type='submit' value='Сменить пароль' />";
echo "</form>";
include_once("incs/down.php");
}
break;

case 'pass_save':
if($user[id]==$my[id] && $on==1){
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "<a href=\"my.php?id=$my[id]\">$my[nick]</a> - Смена пароля</div>";

$pas=filtr($_POST['pass']);
$new_pass=filtr($_POST['new_pass']);
$pov_new_pass=filtr($_POST['pov_new_pass']);
if(md5($pas)==$user[pass] && $new_pass==$pov_new_pass){
if($user[id]==$my[id] && $on==1){
$new_pass=md5($new_pass);
mysql_query("UPDATE `user` SET `pass` = '$new_pass' WHERE `id` = '$user[id]'");
echo "Пароль успешно сменен! Счас Вам надо <a href=\"aut.php\">авторизоваться</a>!<br>";
}
}else{
echo "Неверный старый пароль или пароли не совпадают!<br>";
}
include_once("incs/down.php");
}
break;

case 'azer':
if($user[id]==$my[id] && $on==1){
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "<a href=\"my.php?id=$my[id]\">$my[nick]</a> - Общие настройки</div>";
echo "<form method='post' action='?act=az_save'>";

echo "Мою страничку могут смотреть:<br><select name=\"dostup_my\">";
if ($user['dostup_my']==0)$pok=' selected="selected"';else $pok=NULL;
echo "<option value=\"0\"$pok>Все обитатели</option>";
if ($user['dostup_my']==1)$pok=' selected="selected"';else $pok=NULL;
echo "<option value=\"1\"$pok>Только друзья</option>";
echo "</select><br>";

echo "Сообщений на страницу:<br><input type='text' name='msg_for_page' value='$my[msg_for_page]' size='3' maxlength='3' /><br>";

echo "<input type='submit' name='az_save' value='Сохранить' />";
echo "</form>";
include_once("incs/down.php");
}
break;

case 'az_save':
if($user[id]==$my[id] && $on==1){
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "<a href=\"my.php?id=$my[id]\">$my[nick]</a> - Общие настройки</div>";

if (isset($_POST['dostup_my']) && $_POST['dostup_my']==0 OR $_POST['dostup_my']==1){
$dostup_my=$_POST['dostup_my'];
mysql_query("UPDATE `user` SET `dostup_my` = '$dostup_my' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Неверный формат доступа на страницу';

if (isset($_POST['msg_for_page']) && (is_numeric($_POST['msg_for_page']) && $_POST['msg_for_page']>0 && $_POST['msg_for_page']<=100 || $_POST['msg_for_page']==NULL))
{
$my['msg_for_page']=$_POST['msg_for_page'];
if ($my['msg_for_page']==null)$my['msg_for_page']='null';
mysql_query("UPDATE `user` SET `msg_for_page` = $my[msg_for_page] WHERE `id` = '$user[id]' LIMIT 1");
if ($my['msg_for_page']=='null')$my['msg_for_page']=NULL;
}
else $err='Неверный формат сообщений на страницу';
echo "Настройки успешно сохранены<br>";
include_once("incs/down.php");
}
break;

case 'set_ank':
if($user[id]==$my[id] && $on==1){
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "<a href=\"my.php?id=$my[id]\">$my[nick]</a> - Настройка анкеты</div>";
echo "<form method='post' action='my.php?'>";
echo "Имя:<br><input type='text' name='ank_name' value='$my[ank_name]' maxlength='32' /><br>";
echo "Фамилия:<br><input type='text' name='ank_fam' value='$my[ank_fam]' maxlength='32' /><br>";
echo "Отчество:<br><input type='text' name='ank_ot' value='$my[ank_ot]' maxlength='32' /><br>";
echo "Дата рождения:<br>";
echo "<select name=\"ank_d_r\">";
echo "<option value=\"1\">1</option>";
echo "<option value=\"2\">2</option>";
echo "<option value=\"3\">3</option>";
echo "<option value=\"4\">4</option>";
echo "<option value=\"5\">5</option>";
echo "<option value=\"6\">6</option>";
echo "<option value=\"7\">7</option>";
echo "<option value=\"8\">8</option>";
echo "<option value=\"9\">9</option>";
echo "<option value=\"10\">10</option>";
echo "<option value=\"11\">11</option>";
echo "<option value=\"12\">12</option>";
echo "<option value=\"13\">13</option>";
echo "<option value=\"14\">14</option>";
echo "<option value=\"15\">15</option>";
echo "<option value=\"16\">16</option>";
echo "<option value=\"17\">17</option>";
echo "<option value=\"18\">18</option>";
echo "<option value=\"19\">19</option>";
echo "<option value=\"20\">20</option>";
echo "<option value=\"21\">21</option>";
echo "<option value=\"22\">22</option>";
echo "<option value=\"23\">23</option>";
echo "<option value=\"24\">24</option>";
echo "<option value=\"25\">25</option>";
echo "<option value=\"26\">26</option>";
echo "<option value=\"27\">27</option>";
echo "<option value=\"28\">28</option>";
echo "<option value=\"29\">29</option>";
echo "<option value=\"30\">30</option>";
echo "<option value=\"31\">31</option>";
echo "</select>";
echo "<select name=\"ank_m_r\"><br>";
echo "<option type='1' value=\"1\">Январь</option>";
echo "<option type='2' value=\"2\">Февраль</option>";
echo "<option type='3' value=\"3\">Март</option>";
echo "<option type='4' value=\"4\">Апрель</option>";
echo "<option type='5' value=\"5\">Май</option>";
echo "<option type='2' value=\"6\">Июнь</option>";
echo "<option type='4' value=\"7\">Июль</option>";
echo "<option type='4' value=\"8\">Август</option>";
echo "<option type='4' value=\"9\">Сентябрь</option>";
echo "<option type='4' value=\"10\">Октябрь</option>";
echo "<option type='4' value=\"11\">Ноябрь</option>";
echo "<option type='4' value=\"12\">Декабрь</option>";
echo "</select>";

echo "<select name=\"ank_g_r\"><br>";
echo "<option type='1980' value=\"1980\">1980</option>";
echo "<option type='1981' value=\"1981\">1981</option>";
echo "<option type='1982' value=\"1982\">1982</option>";
echo "<option type='1983' value=\"1983\">1983</option>";
echo "<option type='1984' value=\"1984\">1984</option>";
echo "<option type='1985' value=\"1985\">1985</option>";
echo "<option type='1986' value=\"1986\">1986</option>";
echo "<option type='1987' value=\"1987\">1987</option>";
echo "<option type='1988' value=\"1988\">1988</option>";
echo "<option type='1989' value=\"1989\">1989</option>";
echo "<option type='1990' value=\"1990\">1990</option>";
echo "<option type='1991' value=\"1991\">1991</option>";
echo "<option type='1992' value=\"1992\">1992</option>";
echo "<option type='1993' value=\"1993\">1993</option>";
echo "<option type='1994' value=\"1994\">1994</option>";
echo "<option type='1995' value=\"1995\">1995</option>";
echo "<option type='1996' value=\"1996\">1996</option>";
echo "<option type='1997' value=\"1997\">1997</option>";
echo "<option type='1998' value=\"1998\">1998</option>";
echo "<option type='1999' value=\"1999\">1999</option>";
echo "<option type='2000' value=\"2000\">2000</option>";
echo "<option type='2001' value=\"2001\">2001</option>";
echo "</select><br>";
echo "Cтатус :<br><input type='text' name='status' value='$my[status]' maxlength='32' /><br>";
echo "Страна: <br>";
//страны 
echo "<select name=\"str\"><br>";
echo "<option type='str' value=\"7\">Россия</option>";
echo "<option type='str' value=\"38\">Украина</option>";
echo "</select><br>";

echo "Город:<br><input type='text' name='ank_city' value='$my[ank_city]' maxlength='32' /><br>";
echo "ICQ:<br><input type='text' name='ank_icq' value='$my[ank_icq]' maxlength='9' /><br>";
echo "E-mail:<br><input type='text' name='ank_mail' value='$my[ank_mail]' maxlength='32' /><br>";
echo "Номер телефона:<br>";
echo "<input type='text' name='ank_n_tel' value='$my[ank_n_tel]' maxlength='11' /><br>";
echo "О себе:<br><input type='text' name='ank_o_sebe' value='$my[ank_o_sebe]' maxlength='512' /><br>";

echo "<input type='submit' name='save_ank' value='Сохранить' />";
echo "</form>";
include_once("incs/down.php");
}
break;
}

$my_off=mysql_fetch_array(mysql_query("SELECT * FROM `friends` WHERE `id_user` = '$user[id]' AND `id_friends` = '$my[id]' AND `podtverd` = '1' OR `id_user` = '$my[id]' AND `id_friends` = '$user[id]' AND `podtverd` = '1'"));

if($my[dostup_my]==1 && $my[id]!=$user[id] && $my_off[id]==0 OR $my[dostup_my]==1 && $my[id]!=$user[id] && $my_off[id]==""){
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "Страничка пользователя <b>$my[nick]</b></div>";

echo"<br>Страницу могут просмотревать только друзья<br>";
if($friends[id]=="" OR $friends[id]==0){
echo "<img src=\"styles/vooz/img/friend.gif\" alt=\"\"/>";
echo "<a href=\"my.php?id=$my[id]&act=friend_add\">Предложить дружбу</a><br>";
}
include_once("incs/down.php");
}

if($user[id]==$my[id] && $on==1){
if (isset($_POST['save_ank'])){
head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "<a href=\"my.php?id=$my[id]\">$my[nick]</a> - Настройка анкеты</b></div>";
if (isset($_POST['ank_name']) && filtr(($_POST['ank_name']))<=32)
{
$my['ank_name']=filtr($_POST['ank_name']);
mysql_query("UPDATE `user` SET `ank_name` = '$my[ank_name]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Имя не может быть длиннее 32 символов';

if (isset($_POST['ank_fam']) && filtr(($_POST['ank_fam']))<=32)
{
$my['ank_fam']=filtr($_POST['ank_fam']);
mysql_query("UPDATE `user` SET `ank_fam` = '$my[ank_fam]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Фамилия не может быть длиннее 32 символов';

if (isset($_POST['ank_ot']) && filtr(($_POST['ank_ot']))<=32)
{
$my['ank_ot']=filtr($_POST['ank_ot']);
mysql_query("UPDATE `user` SET `ank_ot` = '$my[ank_ot]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Отчество не может быть длиннее 32 символов';

if (isset($_POST['ank_d_r']) && (is_numeric($_POST['ank_d_r']) && $_POST['ank_d_r']>0 && $_POST['ank_d_r']<=31 || $_POST['ank_d_r']==NULL))
{
$my['ank_d_r']=$_POST['ank_d_r'];
if ($my['ank_d_r']==null)$my['ank_d_r']='null';
mysql_query("UPDATE `user` SET `ank_d_r` = $my[ank_d_r] WHERE `id` = '$user[id]' LIMIT 1");
if ($my['ank_d_r']=='null')$my['ank_d_r']=NULL;
}
else $err='Неверный формат дня рождения';

if (isset($_POST['ank_m_r']) && (is_numeric($_POST['ank_m_r']) && $_POST['ank_m_r']>0 && $_POST['ank_m_r']<=12 || $_POST['ank_m_r']==NULL))
{
$my['ank_m_r']=$_POST['ank_m_r'];
if ($my['ank_m_r']==null)$my['ank_m_r']='null';
mysql_query("UPDATE `user` SET `ank_m_r` = $my[ank_m_r] WHERE `id` = '$user[id]' LIMIT 1");
if ($my['ank_m_r']=='null')$my['ank_m_r']=NULL;
}
else $err='Неверный формат месяца рождения';

if (isset($_POST['ank_g_r']) && (is_numeric($_POST['ank_g_r']) && $_POST['ank_g_r']>0 && $_POST['ank_g_r']<=date('Y') || $_POST['ank_g_r']==NULL))
{
$my['ank_g_r']=$_POST['ank_g_r'];
if ($my['ank_g_r']==null)$my['ank_g_r']='null';
mysql_query("UPDATE `user` SET `ank_g_r` = $my[ank_g_r] WHERE `id` = '$user[id]' LIMIT 1");
if ($my['ank_g_r']=='null')$my['ank_g_r']=NULL;
}
else $err='Неверный формат года рождения';

if (isset($_POST['str']) && (is_numeric($_POST['str']) && $_POST['str']>0 && $_POST['str']<=date('Y') || $_POST['str']==NULL))
{
$my['str']=$_POST['str'];
if ($my['str']==null)$my['str']='null';
mysql_query("UPDATE `user` SET `str` = $my[str] WHERE `id` = '$user[id]' LIMIT 1");
if ($my['str']=='null')$my['str']=NULL;
}
else $err='Быбери плиз свою страну!';

if (isset($_POST['ank_city']) && filtr($_POST['ank_city'])<=32)
{
$my['ank_city']=filtr($_POST['ank_city']);
mysql_query("UPDATE `user` SET `ank_city` = '$my[ank_city]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Название города не может быть длиннее 32 символов';

if (isset($_POST['status']) && filtr($_POST['status'])<=80)
{
$my['status']=filtr($_POST['status']);
mysql_query("UPDATE `user` SET `status` = '$my[status]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Статус не может быть длиннее 80 символов';



if (isset($_POST['ank_icq']) && (is_numeric($_POST['ank_icq']) && strlen($_POST['ank_icq'])>=5 && strlen($_POST['ank_icq'])<=9 || $_POST['ank_icq']==NULL))
{
$my['ank_icq']=$_POST['ank_icq'];
if ($my['ank_icq']==null)$my['ank_icq']='null';
mysql_query("UPDATE `user` SET `ank_icq` = $my[ank_icq] WHERE `id` = '$user[id]' LIMIT 1");
if ($my['ank_icq']=='null')$my['ank_icq']=NULL;
}
else $err='Неверный формат ICQ';

if (isset($_POST['ank_n_tel']) && (is_numeric($_POST['ank_n_tel']) && strlen($_POST['ank_n_tel'])>=5 && strlen($_POST['ank_n_tel'])<=11 || $_POST['ank_n_tel']==NULL))
{
$my['ank_n_tel']=$_POST['ank_n_tel'];
mysql_query("UPDATE `user` SET `ank_n_tel` = '$my[ank_n_tel]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Неверный формат номера телефона';

if (isset($_POST['ank_mail']) && (eregi('^[^@]*@[^@]*\.[^@]*$',$_POST['ank_mail']) || $_POST['ank_mail']==NULL))
{
$my['ank_mail']=filtr($_POST['ank_mail']);
mysql_query("UPDATE `user` SET `ank_mail` = '$my[ank_mail]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Неверный E-mail';


if (isset($_POST['ank_o_sebe']) && filtr($_POST['ank_o_sebe'])<=512)
{
$my['ank_o_sebe']=filtr($_POST['ank_o_sebe']);
mysql_query("UPDATE `user` SET `ank_o_sebe` = '$my[ank_o_sebe]' WHERE `id` = '$user[id]' LIMIT 1");
}
else  $err='О себе нужно писать меньше :)';
echo "$err<br>";
if (!isset($err))echo "Настройки анкеты успешно сохранены<br>";
include_once("incs/down.php");
}
}

head("$my[nick] [id:$my[id]]",$meuser,$auth);
echo "<div class='head'>";
echo "Страничка пользователя <b> $my[nick]</b></div>";
$a = mysql_num_rows(mysql_query("SELECT id FROM `forum` WHERE `id_user` = '$my[id]'"));
$b = mysql_num_rows(mysql_query("SELECT id FROM `forum_post` WHERE `id_user` = '$my[id]'"));
$c = mysql_num_rows(mysql_query("SELECT id FROM `qv` WHERE `id_user` = '$my[id]'"));
$d = mysql_num_rows(mysql_query("SELECT id FROM `obmen` WHERE `id_user` = '$my[id]' AND `mod` = '1'"));
$poz = mysql_num_rows(mysql_query("SELECT id FROM `lib` WHERE `id_user` = '$my[id]'"));
$v = $a+$b+$c+$d+$poz; 
echo '<div class="rowip">';
echo 'Рейтинг : '.$v.'<br>';
 include_once("incs/title.php");
 echo '</div>';
		  
          $status=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$id'"));
echo "Cтатус : ";
if($status[status]!=""){
	echo "<b>$status[status]</b>";
	}else{
    echo "<b>******</b>";}
	if($user[id]==$my[id] && $on==1)
	{   
		if (isset($_POST['status']) && filtr($_POST['status'])<=80)
    {
    $my['status']=filtr($_POST['status']);
    mysql_query("UPDATE `user` SET `status` = '$my[status]' WHERE `id` = '$user[id]' LIMIT 1");
    }
    else $err='Статус не может быть длиннее 80 символов';
	echo "<form method='post' action='my.php?'>";
	echo " <input type='text' name='status' value='$my[status]' maxlength='80' /><input type='submit' name='save' value='Изменить' /><br>";}
	echo '</form>';
	  
	
$kol_friends = mysql_num_rows(mysql_query("SELECT id FROM `friends` WHERE `id_user` = '$my[id]' AND `podtverd` = '1' OR `id_friends` = '$my[id]' AND `podtverd` = '1'"));

if(is_file("avatar/$my[id]$my[avatar]")){
echo "<br><img src='avatar/".$my[id].$my[avatar]."' width='240' height=320' alt='ava' border='0'/>";
}else{
echo "<br><img src=\"styles/img/user.png\" alt=\"\"/>";
}

echo "<div class=\"menu\"><img src=\"img/ank.gif\" alt=\"\"/>";
echo "<a href=\"anketa.php?id=$my[id]\">Анкета</a></div>";

echo "<div class=\"menu\"><img src=\"styles/img/friends.gif\" alt=\"\"/>";
echo "<a href=\"friends.php?id=$my[id]\">Друзья ($kol_friends)</a></div>";

if($user[id]==$my[id] && $on==1){
echo "<div class=\"menu\"><img src=\"img/privat.gif\" alt=\"\"/>";
echo "<a href=\"mail.php\">Почта";
if($user_msg_otri>0){
echo " (+$user_msg_otri)</a></div>";
}else{echo "</a></div>";}
echo "<div class=\"menu\"><img src=\"img/jurnal.gif\" alt=\"\"/>";
echo "<a href=\"jurnal.php\">Журнал</a></div>";
echo "<div class=\"menu\"><img src=\"img/settings.gif\" alt=\"\"/>";
echo "<a href=\"?act=settings\">Настройки</a></div>";
}

if($user[id]!=$my[id] && $on==1){
echo "<div class=\"menu\"><img src=\"img/privat.gif\" alt=\"\"/>";
echo "<a href=\"mail.php?id=$my[id]\">Написать сообщение</a></div>";
if($friends[id]==""){
echo "<div class=\"menu\"><img src=\"styles/img/friend.gif\" alt=\"\"/>";
echo "<a href=\"my.php?id=$my[id]&act=friend_add\">Предложить дружбу</a></div>";
}
}

$opros = mysql_num_rows(mysql_query("SELECT id FROM `votes_access` WHERE `id_user` = '$my[id]'"));
$opros_vse = mysql_num_rows(mysql_query("SELECT id FROM `votes`"));
$opros_new=$opros_vse-$opros;
if($user[id]==$my[id] && $on==1 && $opros_new>0){
echo "<a href=\"my.php?id=$my[id]&act=opros\"><span style=\"color:#ff0000;\">Ответить на опрос</span></a><br>";
}

include_once("incs/down.php");
?>