Advertisement
Guest User

Untitled

a guest
Dec 25th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. // Validate confirm password while typing
  2.  
  3. $(document).ready(function()
  4. {
  5. $("#cpassword").keyup(function()
  6. {
  7. var cpassword = $(this).val();
  8.  
  9. if (cpassword.length > 0)
  10. {
  11. $("#resultcpass").html('<i class="fa fa-circle-o-notch fa-spin loading-icon"></i>');
  12.  
  13.  
  14. /*$.post("email-check.php", $("#reg-form").serialize())
  15. .done(function(data){
  16. $("#resultmail").html(data);
  17. });*/
  18.  
  19. $.ajax({
  20.  
  21. type : 'POST',
  22. url : 'cpassword-check.php',
  23. data : {
  24. $(this).serialize(),
  25. $('#password').serialize()
  26. },
  27. success : function(data)
  28. {
  29. $("#resultcpass").html(data);
  30. }
  31. });
  32. return false;
  33.  
  34. }
  35. else
  36. {
  37. $("#resultcpass").html('');
  38. }
  39.  
  40. });
  41.  
  42.  
  43. });
  44.  
  45. <?php
  46.  
  47. $host="localhost";
  48. $user="root";
  49. $pass="";
  50. $dbname="lr";
  51.  
  52. $dbcon = new PDO("mysql:host={$host};dbname={$dbname}",$user,$pass);
  53.  
  54. if($_POST['cpassword'])
  55. {
  56. $cpassword = strip_tags($_POST['cpassword']);
  57. $password = strip_tags($_POST['password']);
  58.  
  59. if ( $cpassword != $password ){
  60.  
  61. echo "<i class='fa fa-circle user-validation-w pull-right' aria-hidden='true'></i><span class='availability pull-right'> Must match with password</span>";
  62.  
  63. } else {
  64.  
  65. echo "<i class='fa fa-check user-validation-ok pull-right' aria-hidden='true'></i><span class='availability pull-right'></span>";
  66.  
  67. }
  68. }
  69. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement