Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', true);
  3. error_reporting(E_ALL);
  4.  
  5. session_start();
  6. require("config.php");
  7.  
  8. if(isset($_REQUEST["post_back"])){
  9.  
  10. if(empty($_POST["nome"]) || empty($_POST["email"]) || empty($_POST["senha"])){
  11.  
  12.  
  13. echo "<script>alert('Preencha todos os campos antes de enviar seu cadastro!');</script>";
  14.  
  15. }else{
  16. $tb = $conn->prepare("insert into usuario(nm_usuario, email_usuario, senha_usuario) values(:nome, :email, :senha)");
  17.  
  18. $senha = $_POST['senha'];
  19. $senhaHash = password_hash($senha, PASSWORD_DEFAULT);
  20.  
  21.  
  22. $tb->bindParam(":nome", $_POST["nome"], PDO::PARAM_STR);
  23. $tb->bindParam(":email", $_POST["email"], PDO::PARAM_STR);
  24. $tb->bindParam(":senha", $senhaHash, PDO::PARAM_STR);
  25. $tb->execute();
  26. $tb = null;
  27.  
  28. echo "<script>alert('Cadastro efetuado com sucesso!\\nFaƧa seu login agora');document.location='index.php';</script>";
  29.  
  30. }
  31.  
  32. }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement