<?php require 'sebasloc.php'; ?>
<?php
$ref= getenv("HTTP_REFERER");
$find= "calygat";

if (strpos($ref,$find)==true){   
header('Location: http://www.somesport.com');   
}

else {



if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
	  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
}


mysql_select_db($database_sebasloc, $sebasloc);

$query_mt2 = "SELECT distinct Cat FROM A_Veg_23_Sol WHERE Pov=2 ORDER BY Cat" ;
$mt2 = mysql_query($query_mt2, $sebasloc) or die(mysql_error());
$row_mt2 = mysql_fetch_assoc($mt2);
$totalRows_mt2 = mysql_num_rows($mt2);


$categoria = $_POST["busca"];

if(!$categoria){
	$categoria = $row_mt2['Cat'];
}



$query_mt1 = "SELECT Dorsal, PG, T, TN, Nom, PC, M, Cat, Club FROM A_Veg_23_Sol WHERE Cat='" . $categoria ."' AND Pov=2 ORDER BY PG ASC";
$mt1 = mysql_query($query_mt1, $sebasloc) or die(mysql_error());
$row_mt1 = mysql_fetch_assoc($mt1);
$totalRows_mt1 = mysql_num_rows($mt1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Classificaci&oacute; per Categories IX Cursa solidària Contra el Càncer El Verger 2023</title>
<link href="clasvergi23.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
	background-color: #999999;
}
</style>
</head>

<body class="bon_fon">
<div class="tot"><div class="smdt"><a href="http://www.somesport.com" class="sm">Som Esport</a></div>
<div class="cap"><a href="https://www.somesport.com"><img src="Solidaria_Verger_23_banner_ns.png" width="960" alt="Som Esport" longdesc="http://www.somesport.com" /></a></div>
<div class="cap1">
  <div align="center">
    <div class="abra">
<div class="drt"> <span class="tit18">CLASSIFICACI&Oacute; PER CATEGORIES IX CURSA SOLIDÀRIA CONTRA EL CÀNCER EL VERGER 2023<a href="https://www.somesport.com" class="txt12ng"><br />
</a></span><a href="https://www.somesport.com" class="txt12ng"><br />
</a><span class="txt14ng">Cronometratge <a href="https://www.somesport.com">www.somesport.com</a></span><br />
<?php echo $totalRows_mt1 ?> corredores arribats a Meta<br />
<br />
<form id="form1" name="form1" method="post" action="categories_solidaria_verger_23..php">
  <select name="busca" id="busca" class="mn">
    <?php  do { ?>
    <option value="<?php echo $row_mt2['Cat']; ?>" <?php 
	if($categoria==$row_mt2['Cat']){
		echo "selected";
	}
	
	
	?>><?php echo $row_mt2['Cat']; ?></option>
    <?php } while ($row_mt2 = mysql_fetch_assoc($mt2)); ?>
  </select>
  <input name="submit" type="submit" class="bta" id="Consulta" value="Consulta" />
  
</form>
<br />
<br />
        <table width="96%" border="0" align="center">
                  <!--DWLayoutTable-->
<tr bgcolor="#000000" class="txt12nj">
                    <td width="46"><div align="right">P.Gral</div></td>
          <td width="219"><div align="left">Nombre</div></td>
<td width="45"><div align="right">P.Cat.</div></td>
          <td width="148" ><div align="left">Categoria</div></td>
          <td width="180" ><div align="left">Club</div></td>
          <td width="56"><div align="center">Tiempo</div></td>
          <td width="56"><div align="center">T. Real</div></td>
<td width="51"><div align="center">T/KM<br />
</div></td>
</tr>
    <?php do { ?>
      <tr bgcolor="#EBE9EA">
        <td><div align="right" class="mon2"><?php echo $row_mt1['PG']; ?></div></td>
        <td><div align="left" class="mon2"><?php echo $row_mt1['Nom']; ?></div></td>
        <td><div align="right" class="mon2"><?php echo $row_mt1['PC']; ?></div></td>
        <td><div align="left" class="mon2"><?php echo $row_mt1['Cat']; ?></div></td>
        <td><div align="left" class="mon2"><?php echo $row_mt1['Club']; ?></div></td>
        <td><div align="center">
          <div align="center" class="mon2"><?php echo $row_mt1['T']; ?></div>
        </div></td>
        <td bgcolor="#D2D3BE"><div align="center">
          <div align="center" class="mon2"><?php echo $row_mt1['TN']; ?></div>
        </div></td>
        <td bgcolor="#CCCCCC"><div align="center">
          <div align="center"><?php echo $row_mt1['M']; ?></div>
        </div></td>
        </tr>
      <?php } while ($row_mt1 = mysql_fetch_assoc($mt1)); ?>
        </table></div>
     
</div>
      <br />
</div>
</div>
</div>
<div id="footer">
	<a href="https://www.somesport.com">Som Esport&nbsp; |&nbsp; Disseny Web Som Esport&nbsp;  |&nbsp;Dorsals | Arcs de Meta | Gesti&oacute; d'inscripcions</a>
  <br />
  <br />
  &copy; Todos los derechos reservados </a>
    <br />
Queda terminantemente prohibida la reproducción total o parcial de los contenidos ofrecidos a través de esta web, salvo autorización expresa de somesport.com. <br />
Así mismo, queda prohibida toda reproducción a los efectos del artículo 32.1, párrafo segundo, Ley 23/2006 de la Propiedad intelectual.<br />
Se autoriza la utilización con fines personales de los resultados en webs de clubs de atletismo, páginas y blogs personales, <br />
siempre que sea bajo las mismas condiciones aqu&iacute; expresadas.<br />
Queda expresamente prohibida la utilización con fines comerciales y la realización de obra derivada. 
</div>
</body>
</html>
<?php
mysql_free_result($mt1);
mysql_free_result($mt2);
mysql_close($sebasloc);
?>