<?php
include ("txt/header.php");
?> 
<table width="560" border="0" cellspacing="0" cellpadding="0">
<tr> 
<td height="22" class="menu">
<div align="center">
Профиль пользователя
</div>
</td>
</tr>
<tr> 
<td align="center" valign="top" class="menu"><table width="560" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="center" valign="top" bgcolor="#FFFFFF"><table width="550" border="0" cellspacing="5" cellpadding="0">
<tr> 
<td>
<center>
<?php
if (isset($_GET['user'])) {
$user=$_GET['user'];
}
if (!isset($user) || $user==" ") {
die('Не выбран пользователь!');
} 
$user=mysql_escape_string($user);
$query="select * from users where (crcname='$user')";
$res=mysql_query($query);
$myrow=mysql_fetch_assoc($res);
$seller=$myrow["name"];
$firstname=$myrow["firstname"];
$firstname=stripslashes($firstname);
$lastname=$myrow["lastname"];
$lastname=stripslashes($lastname);
$country=$myrow["country"];
$country=stripslashes($country);
$city=$myrow["city"];
$city=stripslashes($city);
?>
<table class='t' width=60%>
<tr bgcolor=white>
<td width=25%><b>Ник:</b></td><td><center><?php echo $seller; ?></td>
</tr>
<tr bgcolor=white>
<td><b>Имя:</b></td><td><center><?php echo $firstname; ?></td>
</tr>
<tr bgcolor=white>
<td><b>Фамилия:</b></td><td><center><?php echo $lastname; ?></td>
</tr>
<tr bgcolor=white>
<td><b>Страна:</b></td><td><center><?php echo $country; ?></td>
</tr>
<tr bgcolor=white>
<td><b>Город:</b></td><td><center><?php echo $city; ?></td>
</tr>
</table>
<br>
Товары продавца:<br><br>
<?php
$nowtime=time();
$query="select * from goods where (seller='$user' and srok>$nowtime  and quantity>0)";
$res=mysql_query($query);
$number_of_goods=mysql_num_rows($res);
if ($number_of_goods>0) {
echo "<table class='t'>";
echo "<tr bgcolor=white><td><center><font size=2>Название</td>";
echo "<td><center><font size=2>Продавец</td>";
echo "<td><center><font size=2>Осталось времени</td>";
echo "<td><center><font size=2>Ставка</td></tr>";
while ($myrow=mysql_fetch_assoc($res)) {
$name_of_good=$myrow["name"];
$quantity=$myrow["quantity"];
$name_of_good=stripslashes($name_of_good);
$name_of_good=substr($name_of_good,0,20);
$name_of_good=$name_of_good."...";
$end=$myrow["srok"];
$stay=$end-$nowtime;
$days=$stay/86400;
$days_show=floor($days);
$hours=$stay/3600-$days_show*24;
$hours_show=floor($hours);
$minutes=$stay/60-$days_show*1440-$hours_show*60;
$minutes_show=floor($minutes);
$bid_of_good=$myrow["bid"];
if ($bid_of_good==0) {
$bid_of_good="нет";
}
$seller_crc=$myrow["seller"];
$query="select name from users where (crcname='$seller_crc')";
$ress=mysql_query($query);
$myrows=mysql_fetch_assoc($ress);
$seller=$myrows["name"];
$id=$myrow["first"];
echo "<tr bgcolor=white><td><center><a href=\"commodity.php?com=$id\">$name_of_good</a></td>";
echo "<td><center><a href=\"profile.php?user=$seller_crc\">$seller</a></td>";
echo "<td><center>";
if ($days_show>0) {
echo "$days_show дней ";
}
if ($hours_show>0) {
echo "$hours_show час. "; 
}
echo "$minutes_show мин.</td>";
echo "<td><center>$bid_of_good</td>";
echo "</tr>";
}
echo "</table>";
}
else {
echo "Товаров данного продавца сейчас нет в продаже";
}
?>
</td>
</tr>
</table></td>
</tr>
</table></td></tr></table>
<br>
</td>
</tr>
</table></td>
</tr>
<?php
include ("txt/footer.php");
?> 

