<!DOCTYPE html>
<html lang="en">     
  <head>              
    <title>Wasah</title>              
    <meta name="viewport" content="width=device-width, initial-scale=1.0">              
    <meta charset="utf-8">              
    <!-- External CSS libraries -->                
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">              
    <link rel="stylesheet" type="text/css" href="css/bootstrap-submenu.css">              
    <link rel="stylesheet" type="text/css" href="css/animate.min.css">              
    <link rel="stylesheet" type="text/css" href="css/slider.css">              
    <link rel="stylesheet" type="text/css" href="fonts/font-awesome/css/font-awesome.min.css">              
    <link rel="stylesheet" type="text/css" href="fonts/linearicons/style.css">              
    <link rel="stylesheet" type="text/css" href="fonts/flaticon/font/flaticon.css">              
    <link href="css/bootstrap-select.min.css" type="text/css" rel="stylesheet">              
    <!-- Custom stylesheet -->                
    <link rel="stylesheet" type="text/css" href="css/style.css">              
    <link rel="stylesheet" type="text/css" id="style_sheet" href="css/colors/default.css">              
    <!-- Favicon icon -->                
    <link rel="shortcut icon" href="img/favicon.gif" type="image/x-icon" >              
    <!-- Google fonts -->                
    <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800%7CPlayfair+Display:400,700%7CRoboto:100,300,400,400i,500,700">              
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->                
    <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">              
    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->                
    <!--[if lt IE 9]><script type="text/javascript" src="js/ie8-responsive-file-warning.js"></script><![endif]-->        
<script type="text/javascript" src="js/ie-emulation-modes-warning.js"></script>                
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->                
    <!--[if lt IE 9]>
                <script type="text/javascript" src="js/html5shiv.min.js"></script>
                <script type="text/javascript" src="js/respond.min.js"></script>
                <![endif]-->       
  </head>     
  <body>         
    <div class="page_loader">             
      <img src="img/loader.gif" alt="Loader">         
    </div>         
    <!-- Top Header start -->            
    <?php include_once ("styl/vrchni_panel.php");?>           
    <!-- Top Header end -->           
    <!-- Main header start -->           
    <?php include_once ("styl/panel.php");?>           
    <!-- Main header end -->           
    <!-- Sub banner start -->           
    <div class="sub-banner">                  
      <div class="overlay">                     
      </div>         
    </div>         
    <!-- Sub banner end -->       
<?php  
    if (isset($_GET["serazeni"])) {
      $p_serazeni = htmlspecialchars($_GET["serazeni"]);
      $p_znacka = htmlspecialchars($_GET["znacka"]);
      $p_rok = htmlspecialchars($_GET["rok"]);
      $p_pripojeni = htmlspecialchars($_GET["pripojeni"]);
      $p_palivo = htmlspecialchars($_GET["palivo"]);
      $p_prevodovka = htmlspecialchars($_GET["razeni"]);
      $p_system = htmlspecialchars($_GET["system"]);
      $p_vybava = htmlspecialchars($_GET["vybava"]);  
      
      
      //je to vše zdlouhavě vypsané - jedna z možností ochrany, kdyby kdokoliv cokoliv zadal, nemá šanci něco provést
      if   ($p_serazeni=="all") {$p_serazeni=" ";}   
      else if ($p_serazeni=="ASC") {$p_serazeni=" order by rok_vyroby asc"; }  
      else if ($p_serazeni=="DSC") {$p_serazeni=" order by rok_vyroby desc";}  
      else {$p_serazeni=" ";}
    
      if ($p_rok=="all") {$p_rok="%";}
      else if ($p_rok=="2015") {$p_rok="2015";}
       else if ($p_rok=="2016") {$p_rok="2016";}
        else if ($p_rok=="2017") {$p_rok="2017";}
         else if ($p_rok=="2018") {$p_rok="2018";}
      else {$p_rok="%";} 
       
       if ($p_palivo=="all") {$p_palivo="%";}
      else if ($p_palivo=="cng") {$p_palivo="CNG";}
       else if ($p_palivo=="diesel") {$p_palivo="Diesel";}
        else if ($p_palivo=="benzin") {$p_palivo="Benzín";}
         else if ($p_palivo=="electric") {$p_palivo="Electric";}
         else if ($p_palivo=="hybrid") {$p_palivo="Hybrid";}
      else {$p_palivo="%";}
      
      if ($p_znacka=="all") {$p_znacka="%";}
      else if ($p_znacka=="Škoda") {$p_znacka="Škoda";}
       else if ($p_znacka=="Audi") {$p_znacka="Audi";}
        else if ($p_znacka=="Volkswagen") {$p_znacka="Volkswagen";}
         else if ($p_znacka=="Seat") {$p_znacka="Seat";}
      else {$p_znacka="%";} 
      
      
           if ($p_pripojeni=="all") {$p_pripojeni="%";}
      else if ($p_pripojeni=="bluetooth") {$p_pripojeni="bluetooth";}
       else if ($p_pripojeni=="wifi") {$p_pripojeni="wifi";}
        else if ($p_pripojeni=="usb") {$p_pripojeni="usb";}
         else if ($p_pripojeni=="wlan") {$p_pripojeni="wlan";}
      else {$p_pripojeni="%";} 
      
       if ($p_prevodovka=="all") {$p_prevodovka="%";}
      else if ($p_prevodovka=="automatic") {$p_prevodovka="automatic";}
       else if ($p_prevodovka=="manual") {$p_prevodovka="manual";}
      else {$p_prevodovka="%";} 
      
        if ($p_system=="all") {$p_system="%";}
      else if ($p_system=="columbus") {$p_system="columbus";}
       else if ($p_system=="amundsen") {$p_system="amundsen";}
       else if ($p_system=="bolero") {$p_system="bolero";}
       else if ($p_system=="swing") {$p_system="swing";}
      else {$p_system="%";} 
      
        if ($p_vybava=="all") {$p_vybava="%";}
      else if ($p_vybava=="style") {$p_vybava="style";}
           else if ($p_vybava=="active") {$p_vybava="ctive";}
                else if ($p_vybava=="ambition") {$p_vybava="ambition";}
                     else if ($p_vybava=="scoutline") {$p_vybava="scoutline";}
                          else if ($p_vybava=="monte") {$p_vybava="monte";}
                               else if ($p_vybava=="audi") {$p_vybava="audi";}
                                    else if ($p_vybava=="fresh") {$p_vybava="fresh";}
                                         else if ($p_vybava=="rs") {$p_vybava="rs";}
                                              else if ($p_vybava=="scout") {$p_vybava="scout";}
                                                   else if ($p_vybava=="l&k") {$p_vybava="l&k";}
      
      else {$p_vybava="%";} 
                 
       }
                              
          ?>            
    <!-- Car list start-->
      <center>  <?php  if (isset($_GET["auto_smazano"])) { echo "<h2 style='color: red'><p>Auto bylo smazáno!</p></h2>"; } ?>  </center>          
    <div class="car-list content-area">                  
      <div class="container">                          
        <div class="row">                                  
          <div class="col-lg-8 col-md-8 col-xs-12 col-md-push-4">                                          
            <!-- Block heading Start-->                                            
            <div class="block-heading">                                                  
              <div class="row">                                                          
                <div class="col-lg-6 col-md-5 col-sm-5 col-xs-2">                                                                    
                  <div class="section-heading">                                                                            
                    <div class="media">                                                                                        
                      <div class="media-left">                                                                                            
                        <i class="flaticon-sedan-car-front"></i>                                                                                        
                      </div>                                                                                           
                      <div class="media-body">                                             <h4>Vyhledávání automobilů</h4>                                                                                                     
                        <div class="border">                                                 
                        </div>                                                                                           
                      </div>                                                                                      
                    </div>                                                                    
                  </div>						                                  
                </div>                                                          
                <div class="col-lg-6 col-md-7 col-sm-7 col-xs-10 cod-pad">                                                                  
                  <div class="sorting-options">                                                                                                                           
                    <a href="Car_list.php" class="change-view-btn active-view-btn">                                             
                      <i class="fa fa-th-list"></i></a>                                                                          
                    <a href="Car_grid.php" class="change-view-btn">                                             
                      <i class="fa fa-th-large"></i></a>                                                                  
                  </div>                                                          
                </div>                                                  
              </div>                                          
            </div>                                          
            <!-- Block heading end -->                                            
            <div class="clearfix">                         
            </div>                                          
            <!-- Car list start -->                    
<?php      //******************************************************VÝPIS AUT Z DATABÁZE*********************************
                include_once ("databaze/pripojit.php");
                 
//$dotaz="SELECT * FROM auta WHERE infotainment='Columbus' AND palivo='CNG'";
//'".$p_serazeni."'
//AND propojeni AND palivo AND prevodovka AND vybava AND infotainment
if   (isset($_GET["serazeni"])) { 

$dotaz="SELECT * FROM auta WHERE (rok_vyroby like '%".$p_rok."%' AND palivo like '%".$p_palivo."%' AND znacka like '%".$p_znacka."%' AND propojeni like '%".$p_pripojeni."%' AND prevodovka like '%".$p_prevodovka."%' AND infotainment like '%".$p_system."%' AND vybava like '%".$p_vybava."%')  ".$p_serazeni." ";}

else {$dotaz="SELECT * FROM auta";}
$vysledek = mysqli_query($link, $dotaz);
if(!$vysledek) {
    echo "error car_list";
    exit();
  }    
    $pocet = mysqli_num_rows($vysledek);
  for ($i = 0; $pocet > $i; $pocet--) {
                	$radek=mysqli_fetch_object($vysledek);
             
                                                    ?>                                                                                        
            <div class="car-list-box clearfix wow fadeInUp delay-03s">                                                  
              <div class=" row-table row-flush">                                                          
                <div class="col-lg-4  col-md-5 col-sm-4 col-xs-12 car-pic">                                                                  
                  <div class="car-box-thumbnail">                                                                         
                    <img src="<?php echo $radek->obrazek; ?>" alt="                                          
                    <?php echo $radek->model; ?>  " height="100%" width="100%">                                                                   
                  </div>                                                          
                </div>                                                                                                            
                <!-- Detail Body -->                                                             
                <div class="col-lg-8 col-md-7 col-sm-8 col-xs-12 detail">                                                                  
                  <!-- Header -->                                                                    
                  <header>                                                                          
                    <!-- Title -->                                                                            
                    <h3 class="title">                                                                                  
                      <a target="_blank" href="Car_list_vypis.php?ID=<?php echo $radek->ID;  ?>">                                                  
                        <?php echo $radek->znacka." "; echo $radek->model; ?></a>                                </h3>                                                                          
                    <!-- Custom List -->                                                                    
                  </header>                                                                  
                  <div class="clearfix">                                     
                  </div>                                                                  
                  <!-- paragraph -->                                                                    
                  <!-- Facilities List -->                                                                    
                  <ul class="facilities-list clearfix">                               	                                          
                    <li>                                                                                      
                     <i class="fa fa-info"></i>                                                                                    
                    <span>                                             
                      <?php echo $radek->infotainment; ?>                                          
                    </span>                                                                                  
                    </li>                                                                                  
                    <li>                                                                                      
                    <i class="flaticon-gasoline-pump"></i>                                                                                      
                    <span>                                             
                      <?php echo $radek->palivo; ?>                                          
                    </span>                                                                                  
                    </li>                                                                                  
                    <li>                                                                                      
                    <i class="flaticon-transport"></i>                                                                                      
                    <span>                                             
                      <?php echo $radek->prevodovka; ?>                                          
                    </span>                                                                                  
                    </li>                                                                                  
                    <li>                                                                                      
                    <i class="flaticon-road-with-broken-line"></i>                                                                                      
                    <span>                                             
                      <?php echo $radek->najeto_km; ?>                                          
                    </span>                                                                                  
                    </li>                                                                                  
                    <li>                                                                                      
                     <i class="fa fa-balance-scale"></i>                                                                                     
                    <span>                                             
                      <?php echo $radek->vybava; ?>                                          
                    </span>                                                                                  
                    </li>                                                                                  
                    <li>                                                                                      
                     <i class="fa fa-wifi"></i>                                                                                     
                    <span>                                             
                      <?php echo $radek->propojeni; ?>                                          
                    </span>                                                                                  
                    </li>                                                                                  
                    <li>                                                                                      
                    <i class="flaticon-time"></i>                                                                                      
                    <span>                                             
                      <?php echo $radek->rok_vyroby; ?>                                          
                    </span>                                                                                  
                    </li>										                                          
                    <li>                                                                                      
                    <i class="flaticon-wrench"></i>                                                                                      
                    <span>Vin:                                               
                      <?php echo $radek->vin; ?>                                           
                    </span>                                                                                  
                    </li>                                                                  
                  </ul>                                                                  
                  <!-- Btn Div -->                                                            
                </div>                                                  
              </div>                                          
            </div>                                           
            <?php } ?>                                            
            <!-- Car list end-->                                                                             
          </div>                                  
          <div class="col-lg-4 col-md-4 col-xs-12 col-md-pull-8">                                          
            <!-- Sidebar start-->                           
            <?php include_once ("styl/hledat_auta_list.php");?>                                            
            <!-- Sidebar End-->                                    
          </div>                          
        </div>                  
      </div>         
    </div>         
    <!-- Car list end-->          
    <!-- Footer start-->          
    <?php include_once ("styl/spodek.php");?>          
    <!-- Footer end--> 
<script type="text/javascript" src="js/jquery-2.2.0.min.js"></script> 
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-slider.js"></script> 
<script type="text/javascript" src="js/wow.min.js"></script> 
<script type="text/javascript" src="js/jquery.scrollUp.js"></script> 
<script type="text/javascript" src="js/bootstrap-select.min.js"></script> 
<script type="text/javascript" src="js/bootstrap-submenu.js"></script>          
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> 
<script type="text/javascript" src="js/ie10-viewport-bug-workaround.js"></script>          
    <!-- Custom javascript --> 
<script type="text/javascript" src="js/app.js"></script>      
  </body>
</html>