19/6/09
Notice: Undefined index: sesion in C:wampwwwshagPruebaindex.php on line 43Por: juanno se en donde tengo el error
session_start();
if ($_SESSION['sesion']==true){ //Si ya hay sesión no te permite entrar al index y te envia al menú.
header("Location: menuprincipal.php");
}
//print_r($_POST);
if(isset($_POST['enviar'])){
$nombre_usuario=$_POST['nombre_usuario'];
$clave=$_POST['clave'];
if ($nombre_usuario=="juan"){
if ($clave=="123"){
$_SESSION['sesion']="sesion";
header('Location: menuprincipal.php');
} else {
$mensaje="CLAVE INCORRECTO";
}
} else {
$mensaje="NOMBRE DE USUARIO INCORRECTO";
}
}
echo $_SESSION['sesion'];
?>
<FORM name='form' method='post' action='index.php'>
<TABLE align='center'>
<tr align='right'>
<td>USUARIO: <input type='text' size='15' maxlength='15' value='<?php echo @$nombre_usuario; ?>' name='nombre_usuario'></td>
</tr>
<tr align='right'>
<td>CONTRASEÑA: <input type='password' size='15' maxlength='10' value='<?php echo @$clave; ?>' name='clave'></td>
</tr>
<tr align='right'>
<td><input type='submit' value='INICIAR SESIÓN' name='enviar'></td>
</tr>
</TABLE>
</FORM>
<label><?php echo $mensaje; ?></label>
no se si me podrias ayudar