Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. <script>
  2.  
  3. $(document).ready(function(){
  4. $('#email').blur(function(){
  5.  
  6. var username = $(this).val();
  7. alert("This input field has lost its focus.");
  8. $.ajax({
  9. url:'checkUserAvaiable.php',
  10. method:"POST",
  11. data:{email:username},
  12. success:function(data)
  13. {
  14. if(data != '0')
  15. {
  16. $('#availability').html('<span class="text-danger">Username not available</span>');
  17. $('#register').attr("disabled", true);
  18. }
  19. else
  20. {
  21. $('#availability').html('<span class="text-success">Username Available</span>');
  22. $('#register').attr("disabled", false);
  23. }
  24. }
  25. })
  26.  
  27. });
  28. });
  29.  
  30. </script>
  31.  
  32. <form action="?page=register" method="POST">
  33.  
  34. <input type="text" id="email" class="fadeIn second" name="email" placeholder="E-mail">
  35. <div id="availability" ></div>
  36.  
  37. <input type="text" id="password" class="fadeIn second" name="password" placeholder="Hasło">
  38. <input type="text" id="name" class="fadeIn second" name="name" placeholder="Imię">
  39. <input type="text" id="surname" class="fadeIn second" name="surname" placeholder="Nazwisko">
  40. <input type="text" id="pesel" class="fadeIn second" name="pesel" placeholder="PESEL">
  41. <input type="text" id="phone" class="fadeIn third" name="phone" placeholder="Telefon">
  42. <input type="text" id="city" class="fadeIn second" name="city" placeholder="Miasto">
  43. <input type="text" id="street" class="fadeIn second" name="street" placeholder="Ulica"><br>
  44. <input type="checkbox" class="form-check-input" id="checkbox">
  45.  
  46. <input type="checkbox" name="checkbox" class="form-check-input" id="checkbox" value="scheckbox" />
  47. <label class="form-check-label" for="checkbox">Jesteś lekarzem specialsitą?</label>
  48. <br />
  49. <input type="text" id="pwdNumber" name="showthis" class="fadeIn third" type="text" placeholder="Numer PWZ (prawa wykonuwania zawodu)"/>
  50. <input type="text" id="specialization" name="showthis" class="fadeIn third" type="text" placeholder="Specjalizacja"/>
  51. <input type="text" id="recivedDate" name="showthis" class="fadeIn third form-control" type="text" placeholder="Data otrzymania uprawnień (YYYY/MM/DD)"/>
  52.  
  53. </br>
  54. <input type="checkbox" name="acceptTerms" class="form-check-input" id="acceptTerms" />
  55. <label class="form-check-label" for="acceptTerms">Akceptuję postanowienia licencyjne</label>
  56. </br>
  57.  
  58. <input type="submit" class="fadeIn fourth" name="register" value="Dalej">
  59. </form>
  60.  
  61.  
  62.  
  63.  
  64. <?php
  65.  
  66. require_once __DIR__.'/../../UserRepository.php';
  67.  
  68.  
  69. $userRepository = new UserRepository();
  70. if(isset($_POST['email'])){
  71. $email= $_POST['email'];
  72. $user = $userRepository->getUser($email);
  73. if($email == $user)
  74. {
  75. return 1;
  76. }
  77. else {
  78. return 0;
  79. }
  80.  
  81. }
  82.  
  83. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement