Quiero registrar mi usuario cuando lo registra correctamente se que se queda en register.php y no vuelve a mi pagina Usuarios.php, donde esta el error? aqui va el codigo
register.php
require_once "header.php";
if (isset($_POST['register'])){
if (registerNewUser($_POST['username'], $_POST['password'], $_POST['password2'], $_POST['email'])){
echo aqui no entra creo que aqui esta el error;
header("Location:Usuarios.php");
}else {
echo "Registro Incorrecto! Vuelva a Intentarlo.";
show_registration_form();
echo entra2;
}
} else {
// has not pressed the register button
show_registration_form();
echo entra3;
}
/************************************************** **/
Aqui va la funcion a la que llama
function registerNewUser($username, $password, $password2, $email)
{
global $seed;
if (!valid_username($username) || !valid_password($password) ||
!valid_email($email) || $password != $password2 || user_exists($username))
{
return false;
}
$code = generate_code(20);
$sql = sprintf("insert into login (username,password,email,actcode) value ('%s','%s','%s','%s')",
mysql_real_escape_string($username), mysql_real_escape_string(sha1($password . $seed))
, mysql_real_escape_string($email), mysql_real_escape_string($code));
if (mysql_query($sql))
{
$id = mysql_insert_id();
if (sendActivationEmail($username, $password, $id, $email, $code))
{
return true;
} else
{
return false;
}
} else
{
return false;
}
return false;
}
*************************************************
aqui donde muestra el formulario
function show_registration_form(){
echo '<form action="./register.php" method="post">
<fieldset><legend>Registro</legend>
<dl>
<dt><label for="username">Usuario:</label></dt>
<dd><input name="username" type="text" id="username" maxlength="30">
</dd>
</dl>
<dl>
<dt><label for="password">Contraseña:</label></dt>
<dd><input name="password" type="password" id="password" maxlength="15">
</dd>
</dl>
<dl>
<dt><label for="password2">Repita Contraseña:</label></dt>
<dd><input name="password2" type="password" id="password2" maxlength="15">
</dd>
</dl>
<dl>
<dt><label for="email">Email:</label></dt>
<dd><input name="email" type="text" id="email" maxlength="255">
</dd>
</dl>
<p>
<input name="reset" type="reset" value="Reset">
<input name="register" type="submit" value="Registrarse">
</p>
</fieldset>
</form>';
}