View file include/user.php

File size: 8.67Kb
<?
$id = intval($_GET['id']);
$th = intval($_GET['th']);
if( !mysql_result(mysql_query("SELECT COUNT(*) FROM `rating` WHERE rat_user = $id AND `moder` = '$username'"), 0))
{
if(($status == "moderator" OR $status == "admin") AND !empty($_GET['rat']) AND $_GET['rat'] == 1)
		{
			mysql_query("UPDATE users
			             SET rating=rating+".intval($_GET['rat'])."
			             WHERE id=".$id);
			
			mysql_query("INSERT INTO `rating` VALUES('".$username."', '".$id."')");
		}

if(($status == "moderator" OR $status == "admin") AND !empty($_GET['antirat'])  AND $_GET['antirat'] == 1)
{
			mysql_query("UPDATE users
			     SET antirating = antirating + ".intval($_GET['antirat'])."
			     WHERE id=".$id);
			mysql_query("INSERT INTO `rating` VALUES('".$username."', '".$id."')");
}
}
$query = mysql_query("SELECT * FROM users WHERE id=".$id);
$q = mysql_fetch_assoc($query);
$arruser = $q['username'];
	if(mysql_num_rows($query) < 1)
	{
		if($version == "wml")
		{
			header('Content-type: text/vnd.wap.wml; charset=utf-8');
			header("Cache-Control: no-cache");
			echo(doctype("Ошибка").$tag.'Пользователя не существует! <br />

<a href="./?p=0&amp;v=wml&amp;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><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=0&amp;v=xhtml&amp;sid='.$sid.'">Форумы</a> '.$tagC.'
</td></tr></table>
</body></html>');
		}
		exit;
	}
    else
	{
			if($version == "wml")
			{
				header('Content-type: text/vnd.wap.wml; charset=utf-8');
				header("Cache-Control: no-cache");
				echo(doctype("Анкета ".$arruser."").$tag);
				$photo=$q['photo'];
			if(!empty($photo))
			{
			echo('<p align="center"><img src="http://'.$photo.'" alt="'.$arruser.'" /></p><br />');
			}
if(($status == "moderator" or $status == "admin") AND (!mysql_result(mysql_query("SELECT COUNT(*) FROM `rating` WHERE rat_user = ".$q['id']." AND `moder` = '$username'"), 0)) AND ($username != $q['username']))
{
echo("<b>Рейтинг:</b>  <b><a href=\"./?p=6&amp;rat=1&amp;id=".$q['id']."&amp;sid=".$sid."&amp;v=".$version."\">+</a>".$q['rating']."/<a href=\"./?p=6&amp;antirat=1&amp;id=".$q['id']."&amp;sid=".$sid."&amp;v=".$version."\">-</a>" . $q['antirating'] . "</b><br />");
}
else
{
			echo('<b>Рейтинг:</b> +'.$q['rating'].'/-' . $q['antirating'] . '<br/>');}
			echo('<b>ID:</b> '.$q['id'].'<br/>');
				echo(empty($q['regdate']) ? '<b>Дата регистрации:</b><br/>' : '<b>Дата регистрации:</b> '.date("d/m/Y", $q['regdate']).'<br/>');
				echo(empty($q['realname']) ? '<b>Реальное имя:</b><br/>' : '<b>Реальное имя:</b> '.$q['realname'].'<br/>');
				if($q['sex'] == "m")
				{
					echo('<b>Пол:</b> М<br/>');
				} elseif($q['sex'] == "f")
				{
					echo('<b>Пол:</b> Ж<br/>');
				}
				elseif($q['sex'] == "n")
				{
				echo('<b>Пол:</b><br/>');
				}
		$rdate_arr=explode('/',$q['rdate']);
		$q['rdate']=mktime(0,0,0,$rdate_arr[1],$rdate_arr[0],$rdate_arr[2]);
		$q['let']=date("Y")-$rdate_arr[2];
		if (date("n")<$rdate_arr[0])$q['let']=$q['let']-1;
		elseif (date("n")==$rdate_arr[0]&& date("j")<$rdate_arr[1])$q['let']=$q['let']-1;
		echo(empty($q['rdate']) ? '<b>Возраст:</b><br/>' : '<b>Возраст:</b> '.$q['let'].'<br/>');
		echo(empty($q['mail']) ? '<b>E-mail:</b><br/>' : '<b>E-mail:</b> '.$q['mail'].'<br/>');
		echo(empty($q['icq']) ? '<b>ICQ:</b><br/>' : '<b>ICQ:</b> '.$q['icq'].'<br/>');
		echo(empty($q['site']) ? '<b>Сайт:</b><br/>' : '<b>Сайт:</b> <a href="go/?http://'.$q['site'].'">http://'.$q['site'].'</a><br/>');
		echo(empty($q['about']) ? '<b>О себе:</b><br/>' : '<b>О себе:</b> '.$q['about'].'<br/>');
			} 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>Анкета '.$arruser.'</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">');
echo('<tr><td align="center" bgcolor="'.$style['title'].'"  colspan="2">');
echo('<font color="#FFFFFF"><b>Анкета '.$arruser.'</b></font>');
echo('</td></tr>');
echo('<tr><td bgcolor="'.$style['bottom'].'" colspan="2">');
			$photo=$q['photo'];
			if(!empty($photo))
			{
			echo('<p align="center"><img src="http://'.$photo.'" alt="'.$arruser.'"/></p>');
			}
			else
			{
			echo "<p align=\"center\"><img src=\"avatar/image.gif\" alt=\"".$arruser."\"/></p>\n";
			}
echo('</td></tr>');
echo('<tr bgcolor="'.$style['text'].'"><td>');
echo('Рейтинг:');
echo('</td><td>');
if(($status == "moderator" or $status == "admin") AND (!mysql_result(mysql_query("SELECT COUNT(*) FROM `rating` WHERE rat_user = ".$q['id']." AND `moder` = '$username'"), 0)) AND ($username != $q['username']))
{
echo("<b><a href=\"./?p=6&amp;rat=1&amp;id=".$q['id']."&amp;sid=".$sid."&amp;v=".$version."\">+</a>".$q['rating']."/<a href=\"./?p=6&amp;antirat=1&amp;id=".$q['id']."&amp;sid=".$sid."&amp;v=".$version."\">-</a>" . $q['antirating'] . "</b><br />");
}
else
{
			echo('+'.$q['rating'].'/-' . $q['antirating'] . '');}
			echo('</td></tr>');
			echo('<tr bgcolor="'.$style['text'].'"><td>');
			echo('ID:');
			echo('</td><td>');
			echo(''.$q['id'].'');
			echo('<tr bgcolor="'.$style['text'].'"><td>Дата регистрации:</td><td>'.date("d/m/Y", $q['regdate']).'</td></tr>');
				echo(empty($q['realname']) ? '<tr bgcolor="'.$style['text'].'" nowrap><td>Реальное имя:</td><td width="100%"></td></tr>' : '<tr bgcolor="'.$style['text'].'" nowrap><td>Реальное имя:</td><td width="100%">'.$q['realname'].'</td></tr>');
				if($q['sex'] == "m")
				{
					echo('<tr bgcolor="'.$style['text'].'"><td>Пол:</td><td>М</td></tr>');
				} elseif($q['sex'] == "f")
				{
					echo('<tr bgcolor="'.$style['text'].'"><td>Пол:</td><td>Ж</td></tr>');
				}
		$rdate_arr=explode('/',$q['rdate']);
		$q['rdate']=mktime(0,0,0,$rdate_arr[1],$rdate_arr[0],$rdate_arr[2]);
		$q['let']=date("Y")-$rdate_arr[2];
		if (date("n")<$rdate_arr[0])$q['let']=$q['let']-1;
		elseif (date("n")==$rdate_arr[0]&& date("j")<$rdate_arr[1])$q['let']=$q['let']-1;
		echo(empty($q['rdate']) ? '<tr bgcolor="'.$style['text'].'"><td>Возраст:</td><td></td></tr>' : '<tr bgcolor="'.$style['text'].'"><td>Возраст:</td><td>'.$q['let'].'</td></tr>');
		echo(empty($q['mail']) ? '<tr bgcolor="'.$style['text'].'"><td>E-mail:</td><td></td></tr>' : '<tr bgcolor="'.$style['text'].'"><td>E-mail:</td><td>'.$q['mail'].'</td></tr>');
		echo(empty($q['icq']) ? '<tr bgcolor="'.$style['text'].'"><td>ICQ:</td><td></td></tr>' : '<tr bgcolor="'.$style['text'].'"><td>ICQ:</td><td>'.$q['icq'].'</td></tr>');
		echo(empty($q['site']) ? '<tr bgcolor="'.$style['text'].'"><td>Сайт:</td><td></td></tr>' : '<tr bgcolor="'.$style['text'].'"><td>Сайт:</td><td><a href="go/?http://'.$q['site'].'">http://'.$q['site'].'</a></td></tr>');
		echo(empty($q['about']) ? '<tr bgcolor="'.$style['text'].'"><td>О себе:</td><td></td></tr>' : '<tr bgcolor="'.$style['text'].'"><td>О себе:</td><td>'.$q['about'].'</td></tr>');
    	if($status == "admin" or $status == "moderator")
		{
echo('<tr bgcolor="'.$style['text'].'"><td>Последний раз появлялся:</td><td>'.date('d.m.Y H:i:s', $q['last_time']).'</td></tr>
<tr bgcolor="'.$style['text'].'"><td>Постов:</td><td>'.mysql_result(mysql_query("SELECT COUNT(*) FROM `posts` WHERE `name`='".$q['username']."'"), 0).'</td></tr>');
		}
    }
		if($version == "wml")
		{
echo($tag.'<anchor>Назад<prev /></anchor>'.$tagC.'
</p></card></wml>');
		} elseif($version == "xhtml")
		{
echo($tag);
echo('<tr><td bgcolor="'.$style['bottom'].'"  colspan="2">');
echo('<a href="javascript:history.back()">Назад</a>'.$tagC.'
</td></tr></table>
</body></html>');
		}
		}
?>