Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', true);
  3. error_reporting(E_ALL);
  4.  
  5. include_once("conPDO.php");
  6.  
  7. $pdo = conectar();
  8.  
  9. $data = file_get_contents("php://input");
  10. $data = json_decode($data);
  11.  
  12. $nome = $data->nome;
  13. $email = $data->email;
  14. $senha = $data->senha;
  15. $idCep = $data->idCep;
  16. $tipoUsuario = "C";
  17.  
  18. $verificaUsuario=$pdo->prepare("SELECT * FROM usuarios WHERE nome=:nome AND email=:email");
  19. $verificaUsuario->bindValue("nome", $nome);
  20. $verificaUsuario->bindValue("email", $email);
  21. $verificaUsuario->execute();
  22.  
  23. $quant = $verificaUsuario->rowCount();
  24.  
  25. if($quant != 1){
  26.  
  27. $insereUsuario=$pdo->prepare("INSERT INTO usuarios (idUsuario, idCep, tipoUsuario, nome, email, senha) VALUES (?, ?, ?, ?, ?, ?)");
  28. $insereUsuario->bindValue(1, NULL);
  29. $insereUsuario->bindValue(2, $idCep);
  30. $insereUsuario->bindValue(3, $tipoUsuario);
  31. $insereUsuario->bindValue(4, $nome);
  32. $insereUsuario->bindValue(5, $email);
  33. $insereUsuario->bindValue(6, $senha);
  34.  
  35. $insereUsuario->execute();
  36.  
  37. }else{
  38. O que colocar aqui?
  39. }
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement