
El archivo login.php es el que debe asignar los valores a las variables de sesion... La parte donde tu despliegas el supuesto "email" no sucede por dos razones, esto en el archivo account.php
1. NO se solicita ese campo a la base de datos (no revise si al registrar el usuario inserta ese campo, pero se checa rapido)
2. NUNCA se crea la variable antes de llegar al punto donde la despliegas, aqui esta:
Archivo login.php:
/**
* Checks to see if the user has submitted his
* username and password through the login form,
* if so, checks authenticity in database and
* creates session.
*/
if(isset($_POST['sublogin'])){
/* Check that all fields were typed in */
if(!$_POST['user'] || !$_POST['pass']){
die('You didn\'t fill in a required field.');
}
/* Spruce up username, check length */
$_POST['user'] = trim($_POST['user']);
if(strlen($_POST['user']) > 30){
die("Sorry, the username is longer than 30 characters, please shorten it.");
}
/* Checks that username is in database and password is correct */
$md5pass = md5($_POST['pass']);
$result = confirmUser($_POST['user'], $md5pass);
/* Check error codes */
if($result == 1){
die('That username doesn\'t exist in our database.');
}
else if($result == 2){
die('Incorrect password, please try again.');
}
/* Username and password correct, register session variables */
$_POST['user'] = stripslashes($_POST['user']);
$_SESSION['username'] = $_POST['user'];
$_SESSION['password'] = $md5pass;
Código:
Las que estan en negritas son las unicas variables de sesion que se crean.
Archivo account.php
<?
/* Include Files *********************/
session_start();
include("database.php");
include("login.php");
/*************************************/
?>
<html>
<meta http-equiv="Content-Language" content="es">
<title>Jpmaster77's Login Script</title>
<body>
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="679" height="528" id="AutoNumber1">
<tr>
<td width="679" height="71" colspan="3"> </td>
</tr>
<tr>
<td width="117" height="24"> </td>
<td width="446" height="24"> </td>
<td width="109" height="24">
<p align="center">LOGIN</td>
</tr>
<tr>
<td width="117" height="416"> </td>
<td width="446" height="416"><p><u><strong>Datos de cuenta:<br>
<br>
</strong></u>Nombre:<u><strong> <? echo $_SESSION[username] ?></strong></u></p>
</strong></u>Nombre:<u><strong> <? echo $_SESSION[longname] ?></strong></u></p>
</strong></u></p></td>
<td width="109" height="416"> <? displayLogin(); ?>
<br><br></td>
</tr>
<tr>
Código:
Las variables en negritas es donde das salida a los datos, pero NUNCA se creo la variable que está en rojo...
tan solo haz una busqueda de esa variable $_SESSION[longname] por todo el codigo y solo aparece una vez...
Espero haber ayudado
