<?php
session_start();
If (isset($_POST["user"]) and isset($_POST["pass"])and isset ($_REQUEST["tipo_usu"])) {
$usuario = $_POST["user"];
$pass = $_POST["pass"];
$tipo=$_REQUEST["tipo_usu"];
//validaciones de las variables
$conexion = pg_pconnect("host=localhost
port=5432 dbname=rancho user=postgres password=123456
");
if (!$conexion) {
echo "<CENTER>
Problemas de conexion con la base de datos.
</CENTER>";
}
$sql = "select usuario,pass_usua from usuario where usuario='$usuario' and pass_usua='$pass'";
$query = pg_query($sql);
If (pg_num_rows($query) == 1) {
$row = pg_fetch_row($query);
$_SESSION["usuario"] = $row[0];
$_SESSION["pass"] = $row[1];
if(isset ($_SESSION["usuario"])and isset ($_SESSION["pass"])and $tipo){
$tipo=medico;
header('Location:ingreso.php');
}else{
if(isset ($_SESSION["usuario"])and isset ($_SESSION["pass"])and $tipo){
$tipo=auxiliar;
header('Location:menu.php');
}else{
if(isset ($_SESSION["usuario"])and isset ($_SESSION["pass"])and $tipo){
$tipo=administracion;
header('Location:registro.php');
}
else {
header('Location:index.php');
}
} }
?>
(
![triste](http://static.forosdelweb.com/fdwtheme/images/smilies/frown.png)
![triste](http://static.forosdelweb.com/fdwtheme/images/smilies/frown.png)
![triste](http://static.forosdelweb.com/fdwtheme/images/smilies/frown.png)
![triste](http://static.forosdelweb.com/fdwtheme/images/smilies/frown.png)
![triste](http://static.forosdelweb.com/fdwtheme/images/smilies/frown.png)