<?php require_once('Connections/VETERINARIA.php');
mysql_select_db($database_VETERINARIA, $VETERINARIA); 

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;
  }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>

<body>
<?php
extract($_REQUEST);
$consultasql = "SELECT * from Usuario where Usuario_Cve =  '$Usuario_Cve'";

$resultadosql = mysql_query($consultasql) or die("  Error en: $busqueda: " . mysql_error());


$nro_registros = mysql_num_rows($resultadosql);

if  ($row=mysql_fetch_array($resultadosql))
    {
    echo "<tr> ";
    echo " <td> Clave del Usuario </td>";
    echo " <td width=\"150\"> ". $row["Usuario_Cve"] . " </td>";
    echo " <td> <input type=\"hidden\" Name=\"Usuario_Cve\"
          value=\"".$row["Usuario_Cve"]."\" ></td>";
    echo "</tr>";
    if  ($row["Usuario_Pass"] == "$Usuario_Pass")
	  	{
	   	if  ($row["Usuario_Tipo"] == "AD") 
	        {
			header("Location: AdmonSistema.html"); 	 
	        }
		else
		    {
			echo "<h2 style='text-align:center;'>El Usuario no es administrador</h2>";		
		    }
		}
	else
		{
		echo "<h2 style='text-align:center;'>Password invalido para esta clave de usuario</h2>";	
		}
    }
else
    {
    echo "<h2 style='text-align:center;'>Usuario inexistente</h2>";
    }	
	
echo "<table>";
echo " <tr> ";
echo " <td> ";
echo " Cve. Usuario";
echo " </td>";
echo " <td>".$Usuario_Cve. "</td>";
echo " </tr>";
echo " <tr> ";
echo " <td > ";
echo " Password";
echo " </td>";
echo " <td >".$Usuario_Pass. "</td>";
echo " </tr>";
echo "</table>";
?>
</body>
</html>
