Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/05/2006, 22:25
heba80
 
Fecha de Ingreso: noviembre-2004
Mensajes: 496
Antigüedad: 19 años, 5 meses
Puntos: 0
Pregunta Mostrar nombre de usuario al iniciar sesion!

hola tengo una pagina donde se restringe el acceso por usuarios, pero quiero q al conectarse se muestre el nombre del usuario:

////////////// aqui la cabecera de la pagina!

<?php
session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "conexion.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?><?php
//initialize the session
session_start();

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
session_unregister('MM_Username');
session_unregister('MM_UserGroup');

$logoutGoTo = "index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>

<?php
session_start();
$colname_nomap = "1";
if (isset($_SESSION['login'])) {
$colname_nomap = (get_magic_quotes_gpc()) ? $_SESSION['login'] : addslashes($_SESSION['login']);
}
mysql_select_db($database_conexkaos, $conexkaos);
$query_nomap = sprintf("SELECT apellidos, nombre FROM users WHERE login = '%s'", $colname_nomap);
$nomap = mysql_query($query_nomap, $conexkaos) or die(mysql_error());
$row_nomap = mysql_fetch_assoc($nomap);
$totalRows_nomap = mysql_num_rows($nomap);

?>


////////////Saludos........heba80.