Ver Mensaje Individual
  #17 (permalink)  
Antiguo 22/04/2011, 04:46
adewalt
 
Fecha de Ingreso: agosto-2004
Mensajes: 21
Antigüedad: 19 años, 7 meses
Puntos: 1
Respuesta: Problema con Registrados y invitados

Cita:
Iniciado por _Ruben_ Ver Mensaje
La forma de hacerlo ya te la han dado, si no enseñas el código en el que haces el login es imposible saber en que variable guardas el nick del usuario.
Lo siento, pense que habia quedado estancado y que no tenia que facilitar nada jeje

Aqui te dejo el codigo del login que uso:

Código PHP:
<?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['pass'];
  
$MM_fldUserAuthorization "";
  
$MM_redirectLoginSuccess "index.php";
  
$MM_redirectLoginFailed "login.php";
  
$MM_redirecttoReferrer false;
  
mysql_select_db($database_escalada$escalada);
  
  
$LoginRS__query=sprintf("SELECT nick, password FROM usuario WHERE nick=%s AND password=%s",
    
GetSQLValueString($loginUsername"text"), GetSQLValueString($password"text")); 
   
  
$LoginRS mysql_query($LoginRS__query$escalada) or die(mysql_error());
  
$loginFoundUser mysql_num_rows($LoginRS);
  if (
$loginFoundUser) {
     
$loginStrGroup "";
    
    
//declare two session variables and assign them
    
$_SESSION['MM_Username'] = $loginUsername;
    
$_SESSION['MM_UserGroup'] = $loginStrGroup;          

    if (isset(
$_SESSION['PrevUrl']) && false) {
      
$MM_redirectLoginSuccess $_SESSION['PrevUrl'];    
    }
    
header("Location: " $MM_redirectLoginSuccess );
  }
  else {
    
header("Location: "$MM_redirectLoginFailed );
  }
}
?>
<!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=utf-8" />
<title>Documento sin título</title>
</head>

<body>
<form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction?>">
  <table width="746" border="1">
    <tr>
      <td>&nbsp;</td>
      <td colspan="2"><label>
        <input type="text" name="usuario" id="usuario" />
      </label></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2"><label>
        <input type="text" name="pass" id="pass" />
      </label></td>
    </tr>
    <tr>
      <td><label>
        <input type="submit" name="button" id="button" value="Enviar" />
      </label></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
Gracias.