<?php
session_start();
include_once "inc/db_connect.php";
include_once "inc/fnc.php";
header('Content-Type: text/html;charset=utf8');
$err = "";
if(isset($_POST['regok'])){unset($_SESSION['reg_ok']);}
if(!isset($_SESSION['user'])){
	header("Location: index.php?");
	exit();
}else{
	$data_user = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE nick='".$_SESSION['user']."'")) or die(mysql_error());

	if(isset($_GET['id'])){
		$id = abs((int)$_GET['id']);
		$cars = mysql_query("SELECT * FROM `mycars` WHERE id_user='".$id."'") or die(mysql_error());
		$row_infos = mysql_query("SELECT * FROM `users` WHERE id='".$id."'") or die(mysql_error());
		$row_cars = mysql_fetch_array($cars);
		$row_info = mysql_fetch_array($row_infos);
}
include 'head.php';
?>
<div class="title"><font color='white'><?=$row_info['nick']?> </font> - Автопарк</div>
<?php
do{
	echo "<table class='wdt menu'>
	<tr>
		<td style='vertical-align:top;padding-top:15px;'>
<img src='".$row_cars['car']."' alt='".$row_cars['carname']."' width='200' align='left'/><br />
		</td>
		<td style='vertical-align:top;padding-top:10px;'>
<br>
		<font color='#000'><b>".$row_cars['carname']."</b></font><br/>
		Мощность: <img src='img/speed.png' alt='speed' /> <font color='#fff'><b>".$row_cars['speed']." л.с</b></font>
		</td>
	</tr>
	</table>
	";
}while($row_cars = mysql_fetch_array($cars));
?>
</div>
</body>
</html>
<?
}
include 'foot.php';
?>