this is something i made yesterday, i hope its usefull. There is lots of junk text, but im i an hurry.
<?
$db = mysql_connect("localhost","user","password");
mysql_select_db("DB",$db);
?>
<?
if($agree AND !$enviar)
{
?>
<head>
<title>Registrate</title>
<script language=javascript>
function validateingresar(){
if (document.forms["register"].user.value == ""){
alert("Por favor indica un UserName para registrar tu cuenta");
return false;
}
if (document.forms["register"].password.value == ""){
alert("Por favor indica el Password que quieres para tu cuenta");
return false;
}
if (document.forms["register"].email.value == ""){
alert("Por favor indica tu email, para enviar una confirmacion de tu password");
return false;
}
}
</script>
</head>
<?
}//end if($agree AND !$enviar)
?>
<BODY BGCOLOR="#FFFFFF" >
<CENTER>
<?
if($agree)
{
IF (!$enviar)
{
?>
<FORM name=register method=POST action="<?php echo $PHP_SELF?>" onsubmit="return validateingresar(this)">
<TABLE border=1>
<TR><TD colspan=2>
Si deseas usar todas las funciones del sitio debes registrarte.
El UserName (apodo) deben tener un maximo de 25 caracteres. debes solo usar letras y numeros.<BR>
Nota: Todos los datos entregados en esta pagina pueden ser vistos por los demas usuarios del sitio, excepto tu password. Si no deseas que vean alguno de estos datos solo dejalo en blanco.
Todos los datos que tienen un asterico (*) son requerimientos obligatorios.
<TD></TR>
<TR><TD>UserName *</TD><TD><input type="Text" name="user" value="<?php echo $user ?>"></TD></TR>
<TR><TD>Password *</TD><TD><input type="Text" name="password" value="<?php echo $user ?>"></TD></TR>
<TR><TD colspan=2>Importante: Enviaremos el password de tu registracion a la direccion de mail que entregues. Si te equivocas al entregar la direccion de tu email, no recibiras tu password.</TR>
<TR><TD>Email *</TD><TD><input type="Text" name="email" value="<?php echo $email ?>"></TD></TR>
<TR><TD>Ciudad, Region, Pais</TD><TD><input type="Text" name="location" value="<?php echo $location ?>"></TD></TR>
<TR><TD>Ocupacion</TD><TD><input type="Text" name="ocupacion" value="<?php echo $ocupacion ?>"> </TD></TR>
<TR><TD>Pagina Web</TD><TD><input type="Text" name="web" value="http://<?php echo $web ?>"> </TD></TR>
<TR><TD>Intereses</TD><TD><input type="Text" name="intereses" value="<?php echo $intereses ?>"> </TD></TR>
<TR><TD>Numero ICQ</TD><TD><input type="Text" name="icq" value="<?php echo $icq ?>"> </TD></TR>
</table>
<input type="hidden" name="agree" value="<? echo $agree ?>">
<input type="Submit" name="enviar" value="Enviar">
</FORM>
<?
}
ELSE//IF(!$enviar)
{
$sql="SELECT * FROM foro_users WHERE user='$user'";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
IF($myrow[user]==$user)
{
Echo "Lo siento ya existe un usuario registrado con ese nombre (User), si fue registrado por ti, pide que se te envie el password al email que usaste para restrarte <A HREF=lost_pass.php3>aqui</A>";
}
ELSE
{
$fecha=time();
$sql = "INSERT INTO foro_users (user, password, email,location,ocupacion,web,intereses,icq, fecha_registro, level) VALUES ('$user','$password','$email','$location','$ocupacion','$web','$intereses','$icq','$fecha','2')";
$result = mysql_query($sql);
$subject="password";
$msg="Su password es < $myrow[password] >";
mail($email, $subject, $msg,'' );
echo "Datos enviados correctamente";
echo "Si quieres volver a la pagina principal presiona <A HREF=show.php3>aqui</A>";
}
}
}
ELSE
{
?>
<FORM method=POST action="<?php echo $PHP_SELF?>">
<table border=1>
<TR><TD>
<CENTER>Reglas y politicas</CENTER>
</TD></TR>
<TR><TD>
El registro a este Foro es completamente gratis !. Si aceptas las reglas y politicas presiona el boton "Acepto", el cual te permitira continuar con tu registracion. Si no aceptas, preciona el boton "Cancel"
</TD></TR>
</table>
<input type="Submit" name="agree" value="Acepto">
</FORM>
<FORM ACTION="http://www.poketienda.cl/foro/show.php3" METHOD="POST">
<INPUT TYPE="SUBMIT" NAME="Cancel" VALUE="Cancel">
</FORM>
<?
}//END IF
?>
</BODY>