<?php
session_start();
ob_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());

}
?>
<?
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
echo '<html>';
echo '<head>';
	echo '<title>LowRaceClub</title>';
	echo '<meta http-equiv="Content-Type" content="text/html" charset="windows-1251" />';
	echo '<meta name="description" content="Мобильные онлайн гонки">';
if(empty($data_user['theme']) or $data_user['theme'] == 'default')
{
$style="/style/default/mobile.css";
}
if($data_user['theme'] == "twotheme")
{
$style="style/twotheme/mobile.css";
}
echo '<link rel="stylesheet" href="'.$style.'" type="text/css" />';
?>
<div class="title">
	<div class="block"><img src="img/benz.png" alt="Бензин"/> <?=$data_user['fuel']?></div>
	<div class="block"><img src="img/speed.png" alt="Скорость" /> <?=$data_user['speed']?> л.с</div>
	<div class="block"><img src="img/money2.png" alt="Золото" /> <?=$data_user['money2']?></div>
	<div class="block"><img src="img/money.png" alt="Баксы" /> <?=$data_user['money']?></div><br><br>
	<div class="progress">
	<div class="progress2" style="width:<?=$levelimg?>%">
	</div></div>
	</div>
<?
echo '<div class="mono"><center>';
        echo '<div class="block"><a href="index.php"><b>Гараж</b></a></div>';
        echo '<div class="block"><a href="/race.php"><b>Гонки</b></a></div>';
        echo '<div class="block"><a href="/bar.php"><b>Бар</b></a></div>';
		echo '<div class="block"><a href="/city.php"><b>Город</b></a></div>';
echo '</center></div>';
?>
<div class="title">Поиск</div>
<?
if(isset($_GET['q'])){

     if(is_numeric($_GET['q'])){
	     $q = intval(abs($_GET['q']));
		 $q_t = 'id';
	 } elseif(is_string($_GET['q'])) {
	     $q = mysql_real_escape_string(htmlspecialchars(trim($_GET['q'])));
		 $q_t = 'nick';
	 } else {
	     $q = mysql_real_escape_string(htmlspecialchars(trim($_GET['q'])));
		 $q_t = 'niсk';
	 }
	 
	 $query = mysql_query("select * from `users` where `$q_t` = '$q'");
	     if(mysql_num_rows($query) == 0){
echo "<div class='mono'><center>Никто не найден!</center></div>";
		 } else {
		     while($q = mysql_fetch_assoc($query)){
			     
				 ?>
<div class='mono'><img src='img/user.png'>  <a href="/info.php?id=<?=$q['id'];?>"><?=$q['nick'];?></a></div>
				 <?
				
			 }
		 }

}

echo "<div class='mono'><center>
<form action='' method='get'>
Введите Логин или ID:<br/>
<input type='text' name='q'/><br/>
<input type='submit' class='btn' value='Искать'/>
</form>
</center></div>";







include 'foot.php';
?>
</div>
</body>
</html>
