Advertisement
Guest User

SEGURA ESSA MARCELOO

a guest
May 25th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4. include("conexao.php");
  5.  
  6. $nome = mysqli_real_escape_string($conexao, trim($_POST('nome');
  7. $usuario = mysqli_real_escape_string($conexao, trim($_POST('usuario');
  8. $senha = mysqli_real_escape_string($conexao, trim(md5($_POST('senha');
  9.  
  10. $sql="select count(*) as total from usuario where usuario ='$usuario'";
  11. $result= mysqli_query($conexao, $sql);
  12. $row= mysqli_fetch_assoc($result);
  13.  
  14. if($row['total'] ==1 ) {
  15. $_SESSION['usuario_existe'] =true;
  16. header('Location: cadastro.php');
  17. exit;
  18. }
  19.  
  20. $sql = "INSERT INTO usuario(nome, usuario, senha) VALUES ($nome, '$usuario', '$senha'())";
  21.  
  22. if($conexao->query($sql)== true){
  23. $_SESSION['status_cadastro']=true;
  24.  
  25. }
  26.  
  27. $conexao-close();
  28.  
  29. header('Location: cadastro.php');
  30. exit;
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement