Aca esta el loguin:
Código:
una ves que me envio al panel.php, en el mismo se encuentra incluido el archivo ses.php :$q="select * from usuarios where nick='$nick' and password='$password'"; //ejecuta la consulta $q sobre el enlace $link, $res es una variable numerica de entero $res=mysql_query($q,$link); //guarda en $cant la cantidad de filas que se vieron afectadas en la ultima consulta ejecutada $cant=mysql_affected_rows($link); if ($cant>0) { //significa que hay filas q recuperar, entonces las recuperas $r=mysql_fetch_array($res); session_name( 'usuario' ); session_start(); $_SESSION["usuario"] = $r["id"]; echo "<script>document.location.href='users_panel/panel.php';</script>\n";
Código:
Este es el panel por si lo quieren ver:<? session_name( 'usuario' ); session_start(); //si isset($_SESSION["Usuario"] no fue fijada te lleva al index.php, sino continua (!=not) if (!isset($_SESSION["usuario"])){ echo "<script>alert('Nombre de usuario o contraseña incorrecta, por favor intente nuevamente'); document.location.href='index.php';</script>\n"; } ?>
Código:
El problema reside en que me toma siempre que la sesion "no fue fijada".... <? include_once("../conex/ses.php"); include_once("../conex/conex.php"); $link=Conectarse(); ?> <!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>Untitled Document</title> </head> <body> <div><b><a href="?admin=inicio">Bienvenido al Panel de Administracion</a></b></div> <table width="950" height="auto" border="0" style="border:2px solid black"> <tr> <td width="15%" valign="top" style="border-right:2px solid black"><? include_once("left.php");?></td> <td width="85%" valign="top"> <? $admin=$_GET['admin']; if (empty($_GET['admin'])or($admin=="inicio")) { include_once("cuerpo.php"); } switch ($admin) { case 'datos': echo '<iframe name="I1" border="0" frameborder="0" width="100%" height="500" align="center" src="includes_panel/datos.php"></iframe>'; break; case 'img': echo '<iframe name="I1" border="0" frameborder="0" width="100%" height="500" align="center" src="includes_panel/imagen.php"></iframe>'; break; case 'addons': echo '<iframe name="I1" border="0" frameborder="0" width="100%" height="500" align="center" src="addons"></iframe>'; break; case 'imagenes': echo '<iframe name="I1" border="0" frameborder="0" width="100%" height="500" align="center" src="imagenes"></iframe>'; break; case 'otros': echo '<iframe name="I1" border="0" frameborder="0" width="100%" height="500" align="center" src="otros"></iframe>'; break; } ?></td> </tr> </table> </body> </html>