Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/04/2012, 17:32
elkumanes1
 
Fecha de Ingreso: marzo-2012
Mensajes: 17
Antigüedad: 12 años
Puntos: 0
Información como pongo el nombre de usuario cuando se logen

hola amigos estoy haciendo un sistema de registro de usuarios para mi web ya puse el registro y el logueo lo que quiero que cuando un usuario se loguee salga el nombre de ese usuario en la pagina estos son mis codigo


index.php contiene el logueo y una funcion que llama el registro.php


base de dato





-- Base de datos: `account`


CREATE TABLE IF NOT EXISTS `account` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`login` varchar(30) NOT NULL DEFAULT '',
`password` varchar(45) NOT NULL DEFAULT '',
`real_name` varchar(16) NOT NULL DEFAULT '',
`email` varchar(64) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `login` (`login`)
) ENGINE=MyISAM DEFAULT CHARSET=big5 AUTO_INCREMENT=7591 ;





codigo de registro.php


Código PHP:
//conexion a base de dato

<?php require_once('Connections/conexion_user.php'); ?>



//validador de registro

<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$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;
}
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO account (login, password, real_name, email) VALUES (%s, %s, %s, %s)",
                       
GetSQLValueString($_POST['login'], "text"),
                       
GetSQLValueString($_POST['password'], "text"),
                       
GetSQLValueString($_POST['real_name'], "text"),
                       
GetSQLValueString($_POST['email'], "text"));

  
mysql_select_db($database_conexion_user$conexion_user);
  
$Result1 mysql_query($insertSQL$conexion_user) or die(mysql_error());

  
$insertGoTo "registro.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}

$maxRows_Recordset1 30;
$pageNum_Recordset1 0;
if (isset(
$_GET['pageNum_Recordset1'])) {
  
$pageNum_Recordset1 $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 $pageNum_Recordset1 $maxRows_Recordset1;

mysql_select_db($database_conexion_user$conexion_user);
$query_Recordset1 "SELECT * FROM account";
$query_limit_Recordset1 sprintf("%s LIMIT %d, %d"$query_Recordset1$startRow_Recordset1$maxRows_Recordset1);
$Recordset1 mysql_query($query_limit_Recordset1$conexion_user) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);

if (isset(
$_GET['totalRows_Recordset1'])) {
  
$totalRows_Recordset1 $_GET['totalRows_Recordset1'];
} else {
  
$all_Recordset1 mysql_query($query_Recordset1);
  
$totalRows_Recordset1 mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!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>
<style type="text/css">
.red {
    color: #F00;
}
</style>
</head>

<body>    <br />    
<br />
<br />
<br />    

//formulario de registro

<div class=&lt;h2>
<h3 align="center" class="red"><strong>Registrate Gratis </strong></h3>
                    </h2>
                
                </div>
  <p align="center"class="red">Todos los campos son obligatorios y deben ser completados.</p>
<form action="<?php echo $editFormAction?>" method="post" name="form1" id="form1">
  <table align="center">
    <tr valign="baseline">
      <td width="70" align="right" nowrap="nowrap">Cuenta:</td>
      <td width="228"><input name="login" type="text" value="" size="16" maxlength="16" />
      3-16 Caracteres </td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Password:</td>
      <td><input name="password" type="password" value="" size="16" maxlength="16" />
      3-16 Caracteres </td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Nombre:</td>
      <td><input name="real_name" type="text" value="" size="20" maxlength="20" />
      3-20 Caracteres </td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Email:</td>
      <td><input name="email" type="text" value="" size="20" maxlength="40" />
      Max 40 Caracteres </td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td><input type="submit" value="Registrar" />
        <label>
          <input type="reset" name="button" id="button" value="Limpiar" />
      </label></td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1" />
</form>
</div>

  </div> 
                
                
                  
    </div></div>

</body>
</html>
<?php
mysql_free_result
($Recordset1);
?>