BUENAS NOCHES; mi pregunta es sobre cambiar el nombre de usuario el cual se a registrado,seria hacer una consulta a la base de datos y cambiar el nombre de usuarios asta hay bien pero claro ese nombre de usuario esta encriptado con md5 y en la base de datos salen numeros en vez de letras hay mi duda.
como podria pasar el nombre de usuario encriptado;tengo esto:
<?php require_once('../Connections/JUEGO.php');
?>
<?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_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE usuarios SET usuario=%s, email=%s, contrasena=%s, fecha_ingreso=%s, cod_unico_usuario=%s, validado=%s, nombre_registrado=%s, dinero=%s, familia=%s, rango=%s, last_update=%s WHERE id=%s",
GetSQLValueString($_POST['usuario'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['contrasena'], "text"),
GetSQLValueString($_POST['fecha_ingreso'], "text"),
GetSQLValueString($_POST['cod_unico_usuario'], "text"),
GetSQLValueString($_POST['validado'], "text"),
GetSQLValueString($_POST['nombre_registrado'], "text"),
GetSQLValueString($_POST['dinero'], "double"),
GetSQLValueString($_POST['familia'], "text"),
GetSQLValueString($_POST['rango'], "text"),
GetSQLValueString($_POST['last_update'], "int"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_JUEGO, $JUEGO);
$Result1 = mysql_query($updateSQL, $JUEGO) or die(mysql_error());
$updateGoTo = "Lista_de_usuarios.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$varnombre_registrado_Recordset1 = "0";
if (isset($_GET["recordID"])) {
$varnombre_registrado_Recordset1 = $_GET["recordID"];
}
mysql_select_db($database_JUEGO, $JUEGO);
$query_Recordset1 = sprintf("SELECT * FROM usuarios WHERE usuarios.nombre_registrado = %s", GetSQLValueString($varnombre_registrado_Recordset1 , "int"));
$Recordset1 = mysql_query($query_Recordset1, $JUEGO) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!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"><!-- InstanceBegin template="/Templates/Baseadmin.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>ADMINISTRACION DEL SITIO</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="../estilo/thrColFixHdr.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body,td,th {
color: #FF0;
}
body {
background-color: #000;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<div align="justify"><a href="#"><img src="" alt="Insertar logotipo aquí" name="Insert_logo" width="180" height="90" id="Insert_logo" style="background: #C6D580; display:block;" /></a>
<!-- end .header --> </div>
</div>
<div class="sidebar1">
<div align="justify">
<?php
include('../includes/cabeceraadmin.php');
?>
<ul class="nav">
<li><a href="Lista_de_usuarios.php">LISTA DE USUARIOS</a></li>
<li><a href="#">Vínculo dos</a></li>
<li><a href="#">Vínculo tres</a></li>
<li><a href="#">Vínculo cuatro</a></li>
</ul>
</div>
<p align="justify"> </p>
<div align="justify"><!-- end .sidebar1 --> </div>
</div>
<div class="content">
<div align="justify"><!-- InstanceBeginEditable name="contenido" -->
<p>CAMBIAR NOMBRE
<p>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Usuario:</td>
<td><input type="text" name="usuario" value="<?php echo htmlentities($row_Recordset1['usuario'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Email:</td>
<td><input type="text" name="email" value="<?php echo htmlentities($row_Recordset1['email'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Contrasena:</td>
<td><input type="text" name="contrasena" value="<?php echo htmlentities($row_Recordset1['contrasena'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Fecha_ingreso:</td>
<td><input type="text" name="fecha_ingreso" value="<?php echo htmlentities($row_Recordset1['fecha_ingreso'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Cod_unico_usuario:</td>
<td><input type="text" name="cod_unico_usuario" value="<?php echo htmlentities($row_Recordset1['cod_unico_usuario'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Validado:</td>
<td><input type="text" name="validado" value="<?php echo htmlentities($row_Recordset1['validado'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nombre_registrado:</td>
<td><input type="text" name="nombre_registrado" value="<?php echo htmlentities($row_Recordset1['nombre_registrado'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Dinero:</td>
<td><input type="text" name="dinero" value="<?php echo htmlentities($row_Recordset1['dinero'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Familia:</td>
<td><input type="text" name="familia" value="<?php echo htmlentities($row_Recordset1['familia'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Rango:</td>
<td><input type="text" name="rango" value="<?php echo htmlentities($row_Recordset1['rango'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Last_update:</td>
<td><input type="text" name="last_update" value="<?php echo htmlentities($row_Recordset1['last_update'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Actualizar registro" /></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1" />
<input type="hidden" name="id" value="<?php echo $row_Recordset1['id']; ?>" />
</form>
<p> </p>
<p></p><!-- InstanceEndEditable -->
<!-- end .content --> </div>
</div>
<div class="sidebar2">
<h4 align="justify">Fondos</h4>
<p align="justify">Por naturaleza, el color de fondo de cualquier div sólo se muestra a lo largo del contenido. Si desea usar una línea divisora en lugar de un color, coloque un borde en el lado de la div de .content (pero sólo en el caso de que siempre vaya a tener más contenido).</p>
<div align="justify"><!-- end .sidebar2 --> </div>
</div>
<div class="footer">
<p align="justify">Administracion del sitio.</p>
<div align="justify"><!-- end .footer --> </div>
</div>
<div align="justify"><!-- end .container --> </div>
</div>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($Recordset1);
?>
---------y la encriptacion cuando se registra lo hago asi;
<?php
require('seguridad.php');
require('includes/constantes.php');
$nombre_registrado = @$_POST['usuario'];
$usuario = encriptacion(@$_POST['usuario']);
$email = @$_POST['email'];
$contrasena = encriptacion(@$_POST['contrasena']);
como podia pasarle el nombre de usuario a la base de datos encriptado.