<?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>
<?php
include ("auth_user.php");
$query="select first,name,srok,quantity from goods where (seller='$crc_username') order by srok asc";
$res=mysql_query($query);
?>
<center>
<?php include ("txt/menu_cp.php"); ?>
<br>
<?php
$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><td><center><font size=2>Осталось времени</td><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"];
$nowtime=time();
$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);
$id=$myrow["first"];
if ($quantity<1) {
$name_of_good="<font color=red>$name_of_good</font>";
}
echo "<tr bgcolor=white><form action='lot.php' name=form method=post><td><center>$name_of_good</td>";
echo "<td><center>";
if ($stay>0) {
if ($days_show>0) {
echo "$days_show дней ";
}
if ($hours_show>0) {
echo "$hours_show час. "; 
}
echo "$minutes_show мин.";
}
else {
echo "<font color=red>Завершился</font>";
}
echo "</td>";
echo "<td><input type=hidden name=lot value='$id'><input type=submit value='Подробнее'></td></form></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");
?> 

