Ver Mensaje Individual
  #8 (permalink)  
Antiguo 23/05/2005, 05:12
Legolas_Bilbao
 
Fecha de Ingreso: mayo-2005
Mensajes: 423
Antigüedad: 18 años, 11 meses
Puntos: 1
Código:
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="STYLESHEET" type="text/css" href="./recursos/Estilo1.css">
<title>Pagina de inicio</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script>
<!--
function validar(nombre,pass)
{
		
	if (nombre.value.length == 0 )
	{alert("nombre vacio");
	return false;}
	else 
	if(pass.value.length==0){
	alert("pass no introducida");
	return false;}
	else 
	return true;
  	
}


</script>
</head>

<body >

<br>
<br><br>
<br><br>
<br><br>
<? if($_POST){
			$pass = $_POST["pass"];
			$nombre = $_POST["nombre"];
			$dbhost="xxxxx";  // host del MySQL (generalmente localhost)
			$dbusuario="xxxx"; // aqui debes ingresar el nombre de usuario
                              // para acceder a la base
			$dbpassword="xxxx"; // password de acceso para el usuario de la
            		             // linea anterior
			$db="xxx";        // Seleccionamos la base con la cual trabajar
			$conexion = mysql_connect($dbhost, $dbusuario, $dbpassword)
							or die ("Error conectando a la base de datos.");
			mysql_select_db($db, $conexion);
			$query ="Select * from usuarios where nombre='".$_POST["nombre"]."'"; 
			$result = mysql_query($query,$conexion)or
				 die ("error en secuencia BD sleect ");
				 $url="http://localhost:9090/php/MenuMedico.php";
				 
			if ($row = mysql_fetch_row($result))
				{
					if ($row[1] == $pass){
						//echo"suuarios validado";
						//echo $row[3];
						if($row[3] == "Medico"){
						
						header("Location:http://www.php.net");
						//echo " <br><a href='".urlencode($url)."'>$url</a>";
						
						}
						//exit();

						
						}
				}
 }
 else{?>
	<form name="inicio" method="post" action="Index.php" onSubmit="return validar(this.nombre,this.pass)">
	<center>
		<table>
			<tr>
				<td style="font-weight:bolder">Nombre</td>
				<td><input type="text" name="nombre" size="20"></td>
		   </tr>
			<tr>
				<td style="font-weight:bold">Contraseña</td>
				<td><input type="password" name="pass" size="20"></td>
			</tr>
			<tr>
				<td align="right"><acronym title="Login"><input type="submit" name="Registro" value="Login"></acronym></td>
				<td><input type="reset" value="Borrar"></td>
			</tr>
	</table>
	</center>
</form>
<? } ?>
</body>
</html>
ese es :S