No. Se se supone que la pagina anterior ha validado un usuario y contraseña y en esta segunda debe dar la bienvenida al usuario nombre validado.
El codigo de la primera pagina es:
Código :
<?php
if ($_POST['usuario'] && $_POST['pwd'])
{
$link = mysql_connect('localhost', 'root', '')
or die('Could not connect: ' . mysql_error());
mysql_select_db('portal') or die('Could not select database');
// Performing SQL query
$query = "SELECT nombre,pwd FROM usuario where nombre='".$_POST['usuario']."'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
$row = mysql_fetch_row($result);
if ($_POST['pwd']==$row['1'])
{
echo "hola ".$_POST['usuario'];
$usuari_session=0;
echo "<script>document.location.href='1.php'</script>";
}
$error= "Usuario incorrecto!! Prueba de nuevo...";
}
?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="STYLESHEET" type="text/css" href="estilos.css">
<title>ACCESO EMPLEADOS</title>
</head><big>ACCESO EMPLEADOS</big><hr /><?php echo gmdate ("d / n / y"); ?>
<body>
<blockquote>
<fieldset title="Accede a Gestion de empleados.">
<legend>Administracion Empleados</legend>
<form method="post" action="20.php">
<table border="0" cellpadding="4" cellspacing="2">
<tbody><tr>
<td><label for="usuario">Usuario:</label></td>
<td><input name="usuario" id="usuario" type="text"></td>
</tr>
<tr>
<td><label for="Password">Password: </label></td>
<td><input name="pwd" id="pwd" type="password"></td>
</tr>
<tr>
<td></td>
<td><input name="enviar" id="enviar" value="Aceptar" type="submit"></td>
</tr>
</form>
<tr>
<td></td>
<td><?php echo $error ?></td>
</tr>
</tbody>
</table>
</fieldset>
</body>
</html>
<?php
?>
y en la segunda pagina:
Código :
<?php require("global.php")?>
<?php
$query = "SELECT nombre FROM Usuario
ORDER BY nombre";
$result=mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ACCESO</title>
</head><link rel="STYLESHEET" type="text/css" href="estilos.css"><big>AREA PERSONAL<br /></big><i>Bienvenido Sr
<?php
while ($row = mysql_fetch_row($result)) {
echo $row['0'];
}
?>
</i><hr />
<br /><br /><a id="x"/>
<body><br /><br />
<center>
<blockquote>
<form method="post" action="2.php">
<tr>
<td></td>
<td><input name="datosperso" title="Datos personales" type="submit" value="Datos Personales" /></a><br /></td>
</tr>
</form><br />
<form method="post" action="3.php">
<input name="ultinomina" title="Ultima nomina" type="submit" value="Ultimas nominas" /></a><br />
</form><br />
<form method="post" action="4.php">
<input name="beneficios" title="Solicitud y gestion de beneficios" type="submit" value="Solicitud y Gestion de Beneficios" /></a><br />
</form><br />
</blockquote>
</center>
<form method="post" action="20.php">
<tr>
<td></td>
<td><input id="submit" title="Desconexion" type="submit"value="Desconectar"></td>
</tr>
</form>
</body>
</html>
[BOFH] Por Keyra, te conjuro a que aprendas a utilizar la etiqueta [ code ] [ / code ], encerrando entre sus pespectivos inicio y fin tu código....[/BOFH]