Foros del Web » Programando para Internet » PHP »

Ayuda con este problema

Estas en el tema de Ayuda con este problema en el foro de PHP en Foros del Web. hi estoy haciendo una aplicacion sencilla pero mi trauma es trabajar con sesiones, quiero que al ingresar al sistemam me indique quien se ha logueado, ...
  #1 (permalink)  
Antiguo 24/12/2010, 17:45
 
Fecha de Ingreso: junio-2007
Mensajes: 4
Antigüedad: 16 años, 10 meses
Puntos: 0
Ayuda con este problema

hi estoy haciendo una aplicacion sencilla pero mi trauma es trabajar con sesiones, quiero que al ingresar al sistemam me indique quien se ha logueado, y esa persona sea quien registre los pacientes de mi web, estoy haciendo para un laboratorio como trabajo final y no puedo terminar estoy perdido..
les paso el codigo, estoy trabajando con una base de datos que tiene como a tres administradores del sistema los q usen pero no los puedo enlazar si me pudieran dar una manito...por fis....

Código PHP:
<?php
session_start
();
?>
<!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>Administrador de Sistema de Pacientes</title>
<link rel="stylesheet" href="index.css" type="text/css"/>
<style type="text/css">
<!--
.Estilo2 {color: #000099; font-weight: bold; }
</style>
<style type="text/css">
#pie1{
        padding: 4px 4px 4px 0px;
        vertical-align: middle;
        }
</style>        
<style type="text/css">
#navi {  
    list-style:none;
    margin:0;
    padding:0;
}
#navi li {
    margin:6px;
    padding:0; //Ya no necesito el padding, tambien quitare el borde que puse antes.
    border:none;
    float:left;
}
#navi li a {
    display:block;
    width:100px;
    padding:4px 0;
    text-decoration:none;
    text-align:center;
    font-size:11px;
    color:#FFFFFF;
    background-color:#000000;
    border-left:10px solid #666666;
}

   #navi li a:hover {
    color:#99CC00;
    background-color:#003366;
    border-left-color:#99CC00; //Luego le cambio el color al borde en el evento hover.
}
#Layer1 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:1;
}
</style>
<link href="index.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body{background:#0099FF;}
.Estilo16 {
    color: #FFFFFF;
    font-weight: bold;
    font-size: 18px;
}
.Estilo17 {
    color: #FFFFFF;
    font-weight: bold;
    font-size: 16px;
}
.Estilo20 {color: #FFFFFF; font-weight: bold; font-size: 20px; }
.Estilo21 {font-size: smaller}
</style>
</head>
<body>
<table width="1024" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <th height="111" colspan="2" rowspan="2" bgcolor="#CCCCCC" scope="col"><img src="LOGO GENOMA.jpg" width="541" height="189" /></th>
    <th width="705" height="73" scope="col" bgcolor="#0099FF">
    <marquee align="middle" scrolldelay="0" direction="left" behavior="alternate"> 
     <img src="image01.jpeg" width="200" height="189" align="middle" /><img src="image02.jpeg" width="200" height="189" align="middle" /><img src="image03.jpeg" width="200" height="189" align="middle" />
     <img src="image04.jpg"  width="200" height="189" align="middle" />
    </marquee>    </th>
  </tr>
</table>
<table width="1022" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th width="366" height="21" bgcolor="#CCCCCC" scope="col"><div align="left" class="Estilo2">
      <div align="center">jr 28 de julio N&ordm; 101 - Cercado - SICUANI </div>
    </div></th>
    <th width="656" bgcolor="#CCCCCC" class="Estilo2" scope="col"><div align="center">Telf. 351404 - Cel. 984905425 </div></th>
  </tr>
</table>
<ul id="navi" dir="ltr">
<li><a href="histori.html">HOME</a></li>
<li><a href="historia.html">HISTORIA</a></li>
<li><a href="staff.html">STAFF</a></li>
<li><a href="equipos.html">EQUIPOS</a></li>
<li><a href="pacientes.html">PACIENTES</a></li>
<li><a href="histori.html">RESULTADOS</a></li>
<li><a href="histori.html">PRESUPUESTO</a></li>
<li><a href="histori.html">CONTACTOS</a></li>
</ul>

<p>&nbsp;</p>
<div align="center">
<h1 align="center" class="Estilo17">Administrador del SISTEMA</h1></div> 
<form action="subsistema.php" method="post">

<table cellpadding="0" cellspacing="0" border="1" align="center" width="400" bgcolor="#CCCCCC" bordercolor="#FFFFFF" bordercolordark="#FF0000">
  <tr>
    <td align="center" bgcolor="#0033CC" height="10" width="400"><div align="center" class="Estilo16">INGRESO AL SISTEMA</div></td>
  </tr>
</table>
<table cellpadding="0" cellspacing="0" border="1" align="center" width="400" bgcolor="#CCCCCC" bordercolor="#FFFFFF" bordercolordark="#FF0000" background="image18.jpeg">
  <tr>
    <td align="center" bgcolor="#FF9933"><span class="Estilo20">USUARIO</span></td>
    <td align="center"><input align="middle" name= usuario type=text size="20" maxlength="15"/></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FF9933"><span class="Estilo20">CONTRASEÑA</span></td>
    <td align="center"><input name=pass type=password size="20" maxlength="10"</td>
  </tr>
 </table>
 <table cellpadding="0" cellspacing="0" border="1" align="center" width="400" bordercolor="#FF9933" bgcolor="#FF00FF">
 <td align="center"><input type=submit value="INGRESAR"/>
 </td>
 </table> 
</form>
<hr color="#CCCCCC" width="100%" size="3"/>
<div id="pie1" align="center">
<span class="Estilo21">&reg;DERECHOS RESERVADOS LABORATORIO GENOMA 2010 - VERSION 1.0.0.1&reg;</span>
</body>
</html>
ahora como hago eso estaba tratando pero no consigo...estyve viendo los ejemplos que hay en el foro pero no los entiendo muy bien
  #2 (permalink)  
Antiguo 24/12/2010, 18:36
Avatar de Akiracr  
Fecha de Ingreso: septiembre-2006
Mensajes: 114
Antigüedad: 17 años, 7 meses
Puntos: 3
Respuesta: Ayuda con este problema

No entiendo bien la pregunta, pero ya abierta la session en archivo donde la necesitas, tu puedes guardar en el arreglo $_SESSION lo que quieras y luego en donde necesites sacarla.

Es importante siempre tienes que abrir session cuando quieres leer o escribir.
__________________
http://www.maxmendez.net/
  #3 (permalink)  
Antiguo 25/12/2010, 01:08
 
Fecha de Ingreso: agosto-2010
Mensajes: 100
Antigüedad: 13 años, 7 meses
Puntos: 2
Respuesta: Ayuda con este problema

Compatriota leí muy por arriba tu código, y así por como lo veo a las etiquetas input les falta el atributo id. Sin el, no podrías recuperar los datos desde el script php de verificación de datos mediante $_POST.
Bueno suponiendo que tengas manejado eso. Una vez desde el script que valida al usuario podrías hacer esto:
consultar a la bd si el usuario tiene permisos de administrador (podrías tener una tabla para pacientes y otra para admins, o como fuera que hayas diseñado la bd).
Luego redirigir a la pagina correspondiente mediante un header, osea si la consulta te devuelve que es admin que redirija a admins.php sino a public.php.
Es una ejemplo, pero seria la idea.
Saludos y suerte.

EDITO: podrías subir el código php pertinente también.

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:09.