Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/06/2005, 15:49
Saldu
Invitado
 
Mensajes: n/a
Puntos:
Exclamación Registro,ayuda...

Hola,tengo un problema muy básico...estoy seguro que todos ustedes,muchos me pueden ayudar.Si es que se puede "rescatar" un poco este archivo que voy a poner a continuación.O si ustedes me pueden dar uno que cumpla las mismas funciones o más...
Resulta que yo tengo el archivo, registrar.php que es este:

Código:
<html>
<head>





</head>
<body>
<body bgcolor=#009900 text=#FFFFFF link=#FFFFFF alink=#FFFFFF vlink=#FFFFFF>


<?php
error_reporting(E_ALL);
require_once("conexion.php");  
$nombre = isset($_GET['nombre'])? $_GET['nombre'] : ''; 
$apellidos = isset($_GET['apellido']) ? $_GET['apellido'] : ''; 
$email = isset($_GET['user_email'])? $_GET['user_email'] : ''; 
$username = isset($_GET['username']) ? $_GET['username']: ''; 
$password = isset($_GET['user_password']) ? $_GET['user_password'] : '';
mysql_query("INSERT into usuarios (nombre,apellido,user_email,username,user_password) values ('".$nombre."','".$apellido."','".$user_email."','".$username."','".$user_password."')",$link) or die ( mysql_error());

 function quitar($mensaje){ 
	$mensaje = str_replace("<","&lt;",$mensaje); 
	$mensaje = str_replace(">","&gt;",$mensaje); 
	$mensaje = str_replace("\'","'",$mensaje); 
	$mensaje = str_replace('\"',"&quot;",$mensaje); 
	$mensaje = str_replace("\\\\","\",$mensaje); 
	return $mensaje; 
} 
if(trim($HTTP_POST_VARS["username"]) != "" && trim($HTTP_POST_VARS["user_email"]) != "" && trim($HTTP_POST_VARS["user_password"]) != "") 
{ 
$sql ="SELECT codigo FROM usuarios WHERE username='".quitar($HTTP_POST_VARS["username"])."'"; 
$result = mysql_query($sql); 
if($row = mysql_fetch_array($result))
{ 
echo "Error,el nick escogido,o el nombre de equipo ya han sido registrados,porfavor vuelva a intentar";  
} 
else 
{ 
$sql = "INSERT INTO usuarios (username,user_password,nombre,apellido,user_email) VALUES ("; 
$sql .= "'".quitar($HTTP_POST_VARS["username"])."'"; 
$sql .= ",'".quitar($HTTP_POST_VARS["user_password"])."'"; 
$sql .= ",'".quitar($HTTP_POST_VARS["nombre"])."'"; 
$sql .= ",'".quitar($HTTP_POST_VARS["apellido"])."'"; 
$sql .= ",'".quitar($HTTP_POST_VARS["user_email"])."'";  
$sql .= ","; 
mysql_query($sql); 
echo "Registro exitoso!,ahora mismo le enviaremos un email para activar su cuenta"; 
} 
mysql_free_result($result); 
} 
else 
{ 
echo "Debe completar Todo el formulario para poder continuar..."; 
}  
?>

</body>
</html>

Bueno,tengo un problemón...el tema es,que cuando un usuario se registra "satisfactoriamente",osea,llena el formulario(que luego voy a poner) satisfactoriamente,esos datos del registro,se me suman a la tabla usuarios...pero no todos...osea,se me suman,el apellido,el password y el user_email... el nombre y el nombre de usuario,quedan en la nada!!!

Y encima,después,suponete que yo lleno el formulario asi nomás... esos datos,quedan igual...y si los datos están repétidos,tambien se incoporan...no séque hacer,me está volviendo pelotudo...les ruego,ayudenme!!!!


Este es el formulario.php :


Código:
<?php 

session_start(); 

if(!isset($_SESSION['inc'])){ 
    $_SESSION['inc'] = 'spanish'; 
} 

include("lang/".$_SESSION['inc'].".inc.php"); 

?> 


<html>





<head>

<script language="JavaScript"> 
function pregunta(){ 
    if (confirm('Estas seguro de enviar este formulario?')){ 
       document.tuformulario.submit() 
    } 
} 
</script>



<style type="text/css">
<!--
body {
SCROLLBAR-FACE-COLOR:#6699CC; 
SCROLLBAR-HIGHLIGHT-COLOR: #6699CC; 
SCROLLBAR-SHADOW-COLOR: #6699CC; 
SCROLLBAR-3DLIGHT-COLOR: #FFFFFF;
SCROLLBAR-ARROW-COLOR: #FFFFFF; 
SCROLLBAR-TRACK-COLOR: #E3E3E3; 
SCROLLBAR-DARKSHADOW-COLOR: #000000;
}
-->
</style>



<script>
function ChequearTodos(chkbox)
{
for (var i=0;i < document.forms[0].elements.length;i++)
{
var elemento = document.forms[0].elements[i];
if (elemento.type == "checkbox")
{
elemento.checked = chkbox.checked
}
}
}
</script>




<style type="text/css">
<!--
input { font-family: Tahoma, Verdana, Arial; font-size: 11px; color: #FFFFFF; background-color: #009900; border:blue; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
select { font-family: Tahoma, Verdana, Arial; font-size: 11px; color: #FFFFFF; background-color: #009900; border: #blue; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}

-->
</style>

</head>

<body>
<body bgcolor=#009900 link=#009900 alink=#009900 vlink=#009900>


<div align=left>
<form name="Formulario" method="post" action="registrar.php">


<p><?php echo nombreform;?>
<input type="text" name="nombre"SIZE="12">
</p>
<p><?php echo apellidoform;?>
<input type="text" name="apellido"SIZE="12">
<p><?php echo emailform;?>
<input type="text" name="user_email"SIZE="12">
</p>


<table width="340" border="1" align="left" cellpadding="2" cellspacing="1">
<tr> 
<td width="12" bgcolor="#009900"><input type="checkbox" name="checkbox" value="checkbox">&nbsp;<?php echo musicaform;?></td>
</tr>
<tr> 
<td bgcolor="#009900"><input type="checkbox" name="checkbox2" value="checkbox">&nbsp;<?php echo culturahistoriaform;?></td>
</tr>
<tr> 
<td bgcolor="#009900"><input type="checkbox" name="checkbox3" value="checkbox">&nbsp;<?php echo viajesform;?></td>
</tr>
<tr> 
<td bgcolor="#009900"><input type="checkbox" name="checkbox4" value="checkbox">&nbsp;<?php echo teatroform;?> </td>
</tr>
<tr> 
<td bgcolor="#009900"><input type="checkbox" name="checkbox5" value="checkbox">&nbsp;<?php echo tecnologiaform;?></td>
</tr>
<tr> 
<td bgcolor="#009900"><input type="checkbox" name="checkbox6" value="checkbox">&nbsp;<?php echo entretenimientoform;?></td>
</tr>
<tr> 
<td bgcolor="#009900"><input type="checkbox" name="checkbox7" value="checkbox">&nbsp;<?php echo literaturaform;?></td>
</tr>
<tr> 
<td bgcolor="#009900"><input type="checkbox" name="checkbox8" value="checkbox">&nbsp;<?php echo internetform;?></td>
</tr>
<tr> 
<td bgcolor="#009900"><input type="checkbox" name="checkbox9" value="checkbox">&nbsp;<?php echo videosform;?></td>
</tr>
<tr> 
<td bgcolor="#009900"><input type="checkbox" name="checkbox10" value="checkbox">&nbsp;<?php echo sportsform;?> </td>
</tr>
<tr align=left> 
<td bgcolor="#009900"><input type="checkbox" name="checkbox11" value="checkbox" onClick="ChequearTodos(this);">&nbsp;<?php echo todosform;?></td>
</tr>
</table>


<br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br>

<br><br><br>
<p> <?php echo nombredeusuarioform;?>
<input type="text" name="username"SIZE="12">
</p>
<p> <?php echo contrasenaform;?>
<input type="password" name="user_password"SIZE="12">
</p>


<p> 
<input type="submit" name="BTN_ENVIAR" value="<?php echo registrarmeform;?>">
</p>

<p>
<input type="reset" value="<?php echo reseteoform;?>">
</p>


</FORM>
</div>


</body>


</script>
<noscript>
<plaintext>

</html>

Y por último,esta es la tabla usuarios:

CREATE TABLE `usuarios` (
`codigo` int(4) unsigned NOT NULL auto_increment,
`nombre` varchar(255) default NULL,
`apellido` varchar(255) default NULL,
`username` varchar(255) NOT NULL default '',
`user_password` varchar(255) NOT NULL default '',
`user_email` varchar(255) NOT NULL default '',
`activo` tinyint(1) unsigned NOT NULL default '0',
`equipo` int(4) unsigned NOT NULL,
PRIMARY KEY (`codigo`)
)TYPE=MyISAM


espero que sepan ayudarme,y puedan,se lo suplico,porfavor,ayuda!!!!!!!!