Estoy haciendo un login en dreamweaver, y que al loguearme me lleve a una pagina donde ademas de mostrarme le nombre de usuario tambien quiero que me muestre otros datos, pero no lo he podido conseguir, me muestra errores por favor necesito de su ayuda a ver que estoy haciendo mal.
Pagina de logueo:
Código PHP:
<?php require_once('../Connections/conex.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['Usuario'])) {
$loginUsername=$_POST['Usuario'];
$password=$_POST['Password'];
$MM_fldUserAuthorization = "Estatus";
$MM_redirectLoginSuccess = "PanelControl/Administradores/Validar.php";
$MM_redirectLoginFailed = "Error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conex, $conex);
$LoginRS__query=sprintf("SELECT Usuario, Password, Estatus FROM usuarios WHERE Usuario=%s AND Password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$row = mysql_fetch_assoc($LoginRS);//ESTO LO PUSE A VER SI FUNCIONABA
$LoginRS = mysql_query($LoginRS__query, $conex) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'Estatus');
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
$_SESSION['MM_Nombres'] = $row['Nombres'];
$_SESSION['MM_NumIngreso'] = $row['NumIngreso'];//ESTO LO NECESITO IMPLEMENTAR
$_SESSION['MM_UltimoIngreso'] = $row['UltimoIngreso'];//ESTO LO NECESITO IMPLEMENTAR
$_SESSION['MM_IngresoHora'] = $row['IngresoHora'];//ESTO LO NECESITO IMPLEMENTAR
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
pagina donde voy despues de loguear:
Código PHP:
<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<!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>Insertar datos en MySQL</title>
<style type="text/css">
<!--
body {
font-family: "Trebuchet MS", Tahoma, Arial;
font-size: 12px;
color: #333333;
}
h2 {
font-size: 16px;
color: #CC0000;
}
input, select {
font-family: "Trebuchet MS", Tahoma, Arial;
font-size: 11px;
color: #666666;
}
-->
</style>
</head>
<body>
<p><strong>Bienvenido:</strong> <?php echo $_SESSION['MM_Username']; ?></p>
<p><strong>Permiso:</strong> <?php echo $_SESSION['MM_UserGroup']; ?></p>
<p><strong>Nombres:<?php echo $_SESSION['MM_Nombres']; ?></strong></p>
<p><strong>Numero ingresos:</strong><?php echo $_SESSION['MM_NumIngreso']; ?></p>
<p><strong>Dia de ultimo ingreso:</strong><?php echo $_SESSION['MM_UltimoIngreso']; ?></p>
<p><strong>Hora de Ultimo ingreso:</strong><?php echo $_SESSION['MM_IngresoHora']; ?></p>
<p> </p>
<p> </p>
</body>
</html>