Buenos dias estimados amigos foristas :
Tengo el siguiente problema....
Tengo mi formulario donde a través de un post envío mi nombre de usuario y contraseña (logueo.php)
Código HTML:
Ver original<!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"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sistema de Requisiciones Electrónicas SISREL
</title>
body {
background-image: url(images/inicio.jpg);
}
<form action="acceso.php" method="POST"> <p align="center"> </p> <table width="460" height="102" align="center" > <td width="452" height="41" border="1">Bienvenidos al Sistema de Requisiciones Electrónicas del GRUPO ALC
</td> <td><div align="center" border="1">Favor inicie sesión para ingresar al Sistema
</div></td> <table width="240" align ="center" border="1"> <td width="143"><input type="text" name="usuario" size="20" /></td> <td><input type="password" name="clave" size="20" /></td> <td colspan="2" align="center"><input type="submit" value="Ingresar" name="ingresar"/></td>
Ahora bien... En acceso.php lo que busco es que si el usuario y clave son correctos (previa consulta en mi base de datos en mysql) levanto mis sesiones
Código PHP:
Ver original<?php
include("conecta.php");
$link=conectarse();
$usuario=$_POST['usuario'];
$clave=$_POST['clave'];
$result = mysql_query("SELECT * FROM usuario WHERE usuario='$usuario' and clave='$clave'",$link);
$_SESSION['nombre'] = $row['nombre'];
$_SESSION['cod_rol'] = $row['cod_rol'];
$_SESSION['autentificado'] = 'SI';
}
echo "<script language=\"javascript\">window.location=\"index2.php\"</script>";
?>
Que pasa... cuando solo me quedo en acceso.php y hago un echo de $_SESSION['autentificado'], puedo ver que me dice que si, pero cuando me voy a index2.php no me imprime el valor de la variable.....
Si uso href para irme a index2.php no paso de acceso.php a index2.php, sin embargo, si uso esta instruccion
Código Javascript
:
Ver originalecho "<script language=\"javascript\">window.location=\"index2.php\"</script>";
Si paso a index2.php PERO no veo el valor de mis variables de session....
Será que estoy haciendo algo mal ???? tengo ya 2 dias dandome golpes y no puedo pasar de esta sección...
Saludos.
Carlos.