Hola de nuevo, he intentado lo que me has dicho pero no me sale de ninguna forma, siempre me deja loguear solo a la secretaria, aca esta el codigo por si alguien me puede colaborar.
Código:
<?php
session_start();
?>
<html>
<body>
<?php
$basedatos = mysql_connect("localhost","root");
if(!$basedatos)
{
echo "Ha ocurrido un problema accesando a la BD, intentelo de nuevo mas tarde, <a href='acceso.php'><b>Regresar</b></a>";
exit;
}
mysql_select_db("kerberos2",$basedatos);
$consulta="SELECT id,password,grupo from kerberos";
$re = mysql_query($consulta,$basedatos);
$fila = mysql_fetch_array($re);
if(empty($password) && empty($id))
{
}
else
{
if( $fila["password"] == $password && $fila["id"] == $id)
{
$sesion=$id;
session_register("sesion");
}
else
{
echo "mal";
}
}
?>
<?php
if(session_is_registered("sesion"))
{
include('comprobacion.php');
}
else
{
echo "<center>";
echo "<form action=\"index.php\" method='post'>";
echo "<table width=257 border=1>";
echo "<tr>";
echo " <td>";
echo " Usuario:";
echo " </td>";
echo "<td>";
echo " <input type=text name=id>";
echo " </td>";
echo "</tr>";
echo "<tr>";
echo " <td>";
echo " Contraseña:";
echo " </td>";
echo " <td>";
echo " <input type=password name=password>";
echo " </td>";
echo "</tr>";
echo "<tr>";
echo " <td colspan=2 align=right>";
echo " <input type=submit value=Ingresar>";
echo " </td>";
echo "</tr>";
echo "</table>";
echo "</form>";
echo "</center>";
}
?>
</body>
</html>
Código:
<html>
<body>
<?php
$consulta3="select grupo from kerberos where grupo=\"secretaria\"";
$res=mysql_query($consulta3,$basedatos);
$num=mysql_num_rows($res);
if($num>0)
{
echo "<a href='logout.php'>logout</a>";
echo "<br>Bien";
}
$consulta4="select grupo from kerberos where grupo=\"docente\"";
$re2=mysql_query($consulta4,$basedatos);
$num2=mysql_num_rows($re2);
if($num2>0)
{
echo "<a href='logout.php'>logout</a>";
echo "<br>Bien2";
}
?>
</body>
</html>
Ojala me puedan ayudar, gracias de ante mano.