-3
<?php
$error = "";
if(isset($_POST['registrar'])){
$nome = $_POST['nome'];
$email = $_POST['email'];
$apelido = $_POST['apelido'];
$pass = $_POST['pass'];
$cpass = $_POST['cpass'];
$notify = $_POST['notify'];
$verify = mysql_query("SELECT * FROM users WHERE email = '$email'");
if(strlen($nome) < 3){
$error = "<h2 style='color:red'>Nome muito pequeno!</h2>";
}else if(strlen($email) < 8){
$error = "<h2 style='color:red'>Email muito pequeno!</h2>";
}else if(strlen($apelido) < 3){
$error = "<h2 style='color:red'>Apelido muito pequeno!</h2>";
}else if(strlen($pass) < 8){
$error = "<h2 style='color:red'>Senha muito pequena!</h2>";
}else if($pass != $cpass){
$error = "<h2 style='color:red'>As duas senhas não batem!</h2>";
}else if(mysql_num_rows($verify) > 0){
$error = "<h2 style='color:red'>Email ja registrado!</h2>";
}else{
mysql_query("INSERT INTO users (`nome`,`email`,`apelido`,`senha,`notify,`active`) VALUES ('$nome','$email','$apelido','$pass','$notify','false')");
$error = "<h2 style='color:green'>Sua conta foi registrada, Entre em seu email para verificar.</h2>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Register - TheNiceComp</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php include("header.php"); ?>
<center>
<h1>Registre-se</h1>
<div class="panel">
<?php echo $error; ?>
<form method="POST">
<table width="50%">
<tr>
<td style="float: right;">Nome:</td>
<td><input type="name" name="nome"></td>
</tr>
<tr>
<td style="float: right;">Email:</td>
<td><input type="email" name="email"></td>
</tr>
<tr>
<td style="float: right;">Apelido:</td>
<td><input type="name" name="apelido"></td>
</tr>
<tr>
<td style="float: right;">Senha:</td>
<td><input type="password" name="pass"></td>
</tr>
<tr>
<td style="float: right;">Confirme a Senha:</td>
<td><input type="password" name="cpass"></td>
</tr>
<tr>
<td style="float: right;">Receber novidades no Email:</td>
<td><input type="checkbox" name="notify"></td>
</tr>
</table>
<input type="submit" name="registrar" value="Registrar" style="width: 50%">
</form>
</div>
</center>
</body>
</html>
any help I appreciate!!
Hello @Thenicecomp, had the opportunity to check the reply?
– tvdias
If the answer answered you, do not forget to vote and accept it.
– tvdias