0
I am making a user registration system and it has been presenting some errors if anyone can help me with them would be very grateful.
<?php
include("conexao.php");
$Email = $_POST['Email'];
$sql_code ="SELECT * FROM usuario WHERE Email = '$Email'";
$confirma = $mysqli->query($sql_code) or die($mysqli->error);
$veri = mysql_num_rows($sql_code);
if (isset($_POST['botao'])){
if (isset($_SESSION))
session_start();
foreach ($_POST as $chave => $valor)
$_SESSION[$chave] = $mysqli->real_escape_string($valor);
if (strlen($_SESSION['Nome']) == 0)
$erro[] = "Nome em branco.";
if (strlen($_SESSION['Sobrenome']) == 0)
$erro[] = "Sobrenome em branco.";
if (substr_count($_SESSION['Email'], '@') != 1 || substr_count($_SESSION['Email'], '.')< 1 )
$erro[] = "Email invalido.";
if (strcmp($_SESSION['Senha'], $_SESSION['Confse']))
$erro[] = "As senhas precisam ser iguais";
if ($veri > 0 )
$erro[] = "Email já cadastrado.";
if (count($erro) == 0) {
$code = "INSERT INTO `usuario` (
`Id_Usuario`,
`Nome_Usuario`,
`Sobrenome_Usuario`,
`Email`,
`Senha`,
`Idade`,
`Sexo`)
VALUES (
NULL,
'$_SESSION[Nome],
'$_SESSION[Sobrenome]',
'$_SESSION[Email]',
'$_SESSION[Senha]',
'$_SESSION[idade]',
'$_SESSION[Sexo]')";
$con = $mysqli->query($code) or die($mysqli->error);}} if (count($erro) > 0
) {
foreach ($erro as $valor) {
echo "$valor <script>location('login.php')</script>";
}}?>
It all worked out thanks
– Pedro