Kolorwanie:
Status:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
<?php 
	//error_reporting(E_ALL); // poziom raportowania, http://pl.php.net/manual/pl/function.error-reporting.php
	//ini_set('display_errors', 1);
	
	include ('include/header.php');
	include('include/function.php');
	
	$cur_page = isset($_GET['pagetab']) ? $_GET['pagetab'] : 1;
	$results_per_page = 20; //Liczba wyników na stronę
	$skip = (($cur_page - 1) * $results_per_page);

?>

    <div> 
		<div id="navmap">
			<center>
			<form action="maps.php">
				<div id="diff">
					<input type="radio" name="diff" value="all" id="diff">All
					<input type="radio" name="diff" value="1" id="diff">Easy
					<input type="radio" name="diff" value="2" id="diff">Averange
					<input type="radio" name="diff" value="3" id="diff">Hard
					<input type="radio" name="diff" value="4" id="diff">Extreme
				</div>
				<div id="type">	
					<input type="radio" name="type" value="all" >All
					<input type="radio" name="type" value="1" >KZ (climbing)
					<input type="radio" name="type" value="2">BH
					<input type="radio" name="type" value="3">kz/BH
					<input type="radio" name="type" value="4">LJ/HJ Jumps
					<input type="radio" name="type" value="6">BHLJ Jumps
					<input type="radio" name="type" value="7">SLIDE
				</div>	
					<input type="submit" name="search" value="Search" />
				</form> 
			</center>
		</div>
        
						<?php
							if($_GET['search'] == 'Search')
							{
								echo ' <section class="container players-page p-t-0">
            <div class="card custom-card">
			   <div class="card-header">
                  <h1 class="card-title">Map search engine<small> - Find the map by selected tags</small></h1>
               </div>
               <div class="card-block p-y-0">
			   <table class="players-table table">
                        <thead>
                           <tr>
                              <th style="width:25%;text-align:left;">#</th>
                              <th style="width:30%;text-align:left;">Mapname</th>
                              <th style="width:15%;text-align:center;">Difficulty</th>
                              <th style="width:15%;text-align:center;">Type</th>
                              <th style="width:15%;text-align:center;">Time</th>
                           </tr>
                        </thead>
                        <tbody>';

								$data = mysqli_query($sql, $query); //pobieramy wszystkie wiersze
								$sql = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) or die("Unable to connect to MySQL.");
								if($_GET['diff'] == 'all')
									$q = "SELECT mapname, difficulty, maptype FROM kz_map WHERE maptype = '".$_GET['type']."'";
								elseif($_GET['type'] =='all')
									$q = "SELECT mapname, difficulty, maptype FROM kz_map WHERE difficulty = '".$_GET['diff']."'";
								else
									$q = "SELECT mapname, difficulty, maptype FROM kz_map WHERE difficulty = '".$_GET['diff']."' AND maptype = '".$_GET['type']."'";
								
								$data = mysqli_query($sql, $q);
								$total = mysqli_num_rows($data); //liczba wierszy zapisana na potrzeby stronicowania
								$num_pages = ceil($total / $results_per_page); //określenie liczby stron
								$q .=  " LIMIT $skip, $results_per_page"; //dopisujemy do wcześniejszego zapytania, klauzule LIMIT
								
								$r = mysqli_query($sql, $q);		
								while($a = mysqli_fetch_array($r))
								{
										$wr = get_record("data/xj.txt");
										$cc = get_record("data/cc.txt");
										switch ($a['maptype']) 
										{
																case 0:
																	$mapsql = 'Not Info';
																	break;
																case 1:
																	$mapsql = 'KZ';
																	break;
																case 2:
																	$mapsql = 'BH';
																	break;
																case 3:
																	$mapsql = 'KZ/BH';
																	break;
																case 4:
																	$mapsql = 'LJ Jumps';
																	break;
																case 5:
																	$mapsql = 'HJ Jumps';
																	break;
																case 6:
																	$mapsql = 'BHLJ Jumps';
																	break;
																case 7:
																	$mapsql = 'SLIDE';
																	break;															
										}
										switch ($a['difficulty']) 
										{
																case 0:
																	$mapdiffsql = 'Not Info';
																	break;
																case 1:
																	$mapdiffsql = 'Easy';
																	break;
																case 2:
																	$mapdiffsql = 'Averange';
																	break;
																case 3:
																	$mapdiffsql = 'Hard';
																	break;
																case 4:
																	$mapdiffsql = 'Extreme';
																	break;
																case 5:
																									
										}
										if ( $cc[$a['mapname']]['time']){
											$mapImage = 'https://cosy-climbing.net/img/maps/'.$a['mapname'].'.png';
											$tcc = $cc[$a['mapname']]['time'];
											$twr = 0;
										}
										elseif ( $wr[$a['mapname']]['time'] ){
											$mapImage = 'https://xtreme-jumps.eu/e107_files/downloadthumbs/'.$a['mapname'].'.png';
											$url_tn   = @file_get_contents($mapImage);
											if(!$url_tn) 
												$mapImage = 'https://xtreme-jumps.eu/e107_files/downloadthumbs/'.$a['mapname'].'.jpg';
											$twr = $wr[$a['mapname']]['time'];
											$tcc = 0;
										}
										else
											$mapImage = 'https://cosy-climbing.net/img/maps/'.$a['mapname'].'.png';
										
									echo'
									<tr>
									   <td style="text-align:left;"><img class="image-maps" alt="nazwamapy" src="'.$mapImage.'"></a></td>
									   <td style="text-align:left;"><a href="map.php?map='.$a['mapname'].'&page=1">'.$a['mapname'].'</a></td>
									   <td style="text-align:center;">'.$mapsql.'</td>
									   <td style="text-align:center;">'.$mapdiffsql.'</td>
									   <td style="text-align:center;"></td>
									</tr>';
								}
								echo '						</tbody>
               </table>';
			  if ($num_pages > 1) {
     echo generate_page_links($cur_page, $num_pages);
}
echo '			  </div>
			</div>
		</section>
	</div>	';
							include('include/footer.php'); 									
							}
						?>
	   












Copyrights 2014-2020 © Wklejaj.pl Wszelkie prawa zastrzeżone.