buenas me gustaria saber xk no me rula el security code...aki os dejo el script aver si me pueden echar un cable xk estoy perdido, el caso es k ponga bien o mal el codigo, me lleva a la siguiente pagina donde sale el registered tal, grax espero respuestas
spoiler
function displayStatus(){
$uname = $_SESSION['reguname'];
if($_SESSION['regresult']){
?>
<h1>Registered!</h1>
<p>Thank you [b]<? echo $uname; ?>[/b], your information has been added to the database, you may now log in.
Redirecting if you dont want to wait click <a href="index.php" title="Login">here</a>.</p>
<meta http-equiv="refresh" content="5;URL=index.php">
<?
}
else{
?>
<h1>Registration Failed</h1>
<p>We're sorry, but an error has occurred and your registration for the username [b]<? echo $uname; ?>[/b], could not be completed.<br>
Please try again at a later time.</p>
<?
}
unset($_SESSION['reguname']);
unset($_SESSION['registered']);
unset($_SESSION['regresult']);
}
if(isset($_SESSION['registered'])){
/**
* This is the page that will be displayed after the
* registration. (Esta es la pagina que mostrara despues del registro).
*/
?>
<html>
<title>Registration Page</title>
<body>
<? displayStatus(); ?>
</body>
</html>
<?
return;
}
/* Validation registered (Validacion registrada) */
if(isset($_POST['subjoin'])){
/* Check Empty Space (Chekea el espacio vacio) USERNAME/PASSWORD */
if(!$_POST['user'] || !$_POST['pass']){
die('<div class="errormsg">Sorry, required all fields.</div> <A HREF="javascript:history.back()"> Back to register.</A>');
}
if( isset($_POST['subjoin'])) {
if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
unset($_SESSION['security_code']);
} else {
echo 'Sorry, you have provided an invalid security code';
}
/* Check the maximum Characters (Chekea el maximo de caracteres) USERNAME */
$_POST['user'] = trim($_POST['user']);
if(strlen($_POST['user']) > 30){
die('<div class="errormsg">Sorry, the username is longer than 30 characters, please shorten it.</div> <A HREF="javascript:history.back()"> Back to register.</A>');
}
/* Check the maximum Characters (Chekea el maximo de caracteres) PASSWORD */
$_POST['pass'] = trim($_POST['pass']);
if(strlen($_POST['pass']) > 32){
die('<div class="errormsg">Sorry, the password is longer than 32 characters, please shorten it.</div> <A HREF="javascript:history.back()"> Back to register.</A>');
}
/* Check Min characteres (Chekea el minimo de caracteres) USERNAME */
$_POST['user'] = trim($_POST['user']);
if(strlen($_POST['user']) < 6){
die('<div class="errormsg">Sorry, the username is shorten than 6 characters, please longer it.</div> <A HREF="javascript:history.back()"> Back to register.</A>');
}
/* Check Min characteres (Chekea el minimo de caracteres) PASSWORD */
$_POST['pass'] = trim($_POST['pass']);
if(strlen($_POST['pass']) < 6){
die('<div class="errormsg">Sorry, the password is shorten than 6 characters, please longer it.</div> <A HREF="javascript:history.back()"> Back to register.</A>');
}
/* Check Min characteres (Chekea el minimo de caracteres) SURNAME */
$_POST['surname'] = trim($_POST['surname']);
if(strlen($_POST['surname']) < 6){
die('<div class="errormsg">Sorry, the surname is shorten than 6 characters, please longer it.</div> <A HREF="javascript:history.back()"> Back to register.</A>');
}
/* Check Min characteres (Chekea el minimo de caracteres) EMAIL */
$_POST['email'] = trim($_POST['email']);
if(strlen($_POST['email']) < 16){
die('<div class="errormsg">Sorry, the Email is shorten than 16 characters, please longer it.</div> <A HREF="javascript:history.back()"> Back to register.</A>');
}
/* Check Min characteres (Chekea el minimo de caracteres) NAME */
$_POST['name'] = trim($_POST['name']);
if(strlen($_POST['name']) < 6){
die('<div class="errormsg">Sorry, the name is shorten than 6 characters, please longer it.</div> <A HREF="javascript:history.back()"> Back to register.</A>');
}
/* Check the maximum Characters (Chekea el maximo de caracteres) NAME */
$_POST['name'] = trim($_POST['name']);
if(strlen($_POST['name']) > 32){
die('<div class="errormsg">Sorry, the name is longer than 32 characters, please shorten it.</div> <A HREF="javascript:history.back()"> Back to register.</A>');
}
/* Check the maximum Characters (Chekea el maximo de caracteres) SURNAME */
$_POST['surname'] = trim($_POST['surname']);
if(strlen($_POST['surname']) > 32){
die('<div class="errormsg">Sorry, the surname is longer than 32 characters, please shorten it.</div> <A HREF="javascript:history.back()"> Back to register.</A>');
}
/* Check the maximum Characters (Chekea el maximo de caracteres) EMAIL */
$_POST['email'] = trim($_POST['email']);
if(strlen($_POST['email']) > 32){
die('<div class="errormsg">Sorry, the Email is longer than 32 characters, please shorten it.</div> <A HREF="javascript:history.back()"> Back to register.</A>');
}
/* Check if username is already in use (chekea si el usuario ya esta registrado)*/
if(usernameTaken($_POST['user'])){
$use = $_POST['user'];
die("<div class=\"errormsg\">Sorry, the username: <strong>$use</strong> is already taken, please pick another one.</div><A HREF=\"javascript:history.back()\"> Back to register.</A>");
}
/* Add the new account to the database (Añade nueva cuenta a la base de datos*/
$md5pass = md5($_POST['pass']);
$_SESSION['reguname'] = $_POST['user'];
$_SESSION['regresult'] = addNewUser($_POST['user'], $md5pass, $_POST['name'], $_POST['surname'], $_POST['email']);
$_SESSION['registered'] = true;
echo "<meta http-equiv=\"Refresh\" content=\"0;url=register.php\">";
return;
}
Editado por moderador: ¡Usen el comando [code] para estas cosas! =)