he visto que cuando intentas registrarte y el usuario es incorrecto.. solo modifica la variable.. no carga otra pagina.. eso es lo que yo quiero hacer... igual con todos los mensajes q hayan..
espero que me puedan ayudar... les dejo los codigos...
Registrar.php
Código PHP:
<FORM ACTION="/db/reg.php" METHOD="post">
<table width="780" height="98" border="0" align="center" cellpadding="5">
<tr>
<td width="185" align="right" valign="top" bgcolor="#FFFFCC" class="TextosImportantes"><span class="obligatorios">*</span>
<label for="nicknameText"> Nickname o Usuario:</label></td>
<td width="579" align="left" valign="top" bgcolor="#FFFFCC" class="Loggin"><input size="16" maxlength="30" type="text" name="nickname" id="nickname" autocomplete="off"/>
<label>
<input type="button" value="Verificar Disponibilidad" onclick="Accion()" />
<?php
echo $usar_repetido
?>
<br />
<div> Elige libremente el nick que quieras. El unico requisito es que solo pueden contener caracteres, numeros y guiones bajos (_).<br />
La URL de tu perfil sera:</div>
<address>
http://www.compatiblesonline.com/<span id="nicknameUrl">nickname</span>
</address></td>
</tr>
</table>
<table width="780" height="98" border="0" align="center" cellpadding="5">
<tr valign="middle">
<td width="182" height="20" align="right" class="TextosImportantes"><p>Nombre:</p></td>
<td height="20" align="left"><label>
<input type="text" name="reg_nombre" id="nuevo_usuario" SIZE="20" MAXLENGTH="20">
</label>
</td>
</tr>
<tr valign="middle">
<td width="182" align="right" class="TextosImportantes">Apellidos:</td>
<td align="left"><input type="text" name="reg_apellido" id="reg_apellido" SIZE="20" MAXLENGTH="20"></td>
</tr>
<tr valign="middle">
<td width="182" align="right" class="TextosImportantes"><span class="obligatorios">*</span> E-Mail:</td>
<td align="left"><input type="text" name="reg_email" id="reg_email" SIZE="28" MAXLENGTH="100"></td>
</tr>
<tr valign="middle">
<td width="182" align="right" class="TextosImportantes"><span class="obligatorios">*</span> Confirmar E-Mail:</td>
<td align="left"><input type="text" name="confirmar_email" id="confirmar_email" SIZE="28" MAXLENGTH="100"></td>
</tr>
<tr valign="middle">
<td width="182" align="right" class="TextosImportantes"><span class="obligatorios">*</span> Contraseña</td>
<td align="left"><input type="password" name="reg_pass" id="reg_pass" SIZE="20" MAXLENGTH="20"></td>
</tr>
<tr valign="middle">
<td width="182" align="right" class="TextosImportantes"><span class="obligatorios">*</span> Repetir Contraseña</td>
<td align="left"><input type="password" name="confirmar_pass" id="confirmar_pass" SIZE="20" MAXLENGTH="20"></td>
</tr>
<tr valign="middle">
<td width="182" align="right" class="TextosImportantes"><span class="obligatorios">*</span> Sexo</td>
<td align="left"><input type="radio" name="gender" id="maleRadio" value="MALE" />
<label for="maleRadio" class="Loggin">Hombre</label>
<input type="radio" name="gender" id="femaleRadio" value="FEMALE" />
<label for="femaleRadio" class="Loggin">Mujer</label>
</td>
</tr>
<tr valign="middle">
</table>
<div align="right">
<INPUT TYPE="submit" CLASS="boton" VALUE="Registrar">
</div>
</FORM>
Código PHP:
<?php
$username = $_POST['nickname'];
$password = $_POST['reg_pass'];
$email = $_POST['reg_email'];
$mail2 = $_POST['confirmar_email'];
$nombre_us = $_POST['reg_nombre'];
$apellido = $_POST['reg_apellido'];
$rank = "0";
/*$born = $_POST['born'];
$age = $_POST['age'];*/
require ("mysql_config.php");
$link = mysql_connect($db[host],$db[username],$db[password]) or die("MySQL Say: Error connecting to the database.");
mysql_select_db($db[name],$link) or die("MySQL Say: Error selecting database.");
$resp = mysql_query ("SELECT * FROM $db[prefix]_data WHERE nick='$username'") or die("MySQL Say: ".mysql_error());
$row = mysql_fetch_array ($resp);
$uname = $row["username"];
$resp2 = mysql_query ("SELECT * FROM $db[prefix]_data WHERE nick='$username'") or die("MySQL Say: ".mysql_error());
$row2 = mysql_fetch_array ($resp);
$email = $row["username"];
if ($username == $uname)
{} else {
$user_repetido = "El usuario ".$username." ya esta en uso.";
//echo $user_repetido;
include("../register.php");
//die ("mal los mails");
}
if ($email == $mail2){
$user_repetido = "El email ".$email." ya esta en uso.";
//echo $user_repetido;
include("../used.php");
//die ("mal los mails");
}
else
{
mysql_query("insert into $db[prefix]_data (nick, password, mail, nombre, apellido, rank) values ('$username', '$password', '$mail', '$nombre_us', '$apellido', '$rank')");
include("../reg_ok.php");
}
?>