SHARE
TWEET

Untitled

mazudi Sep 18th, 2016 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <form data-abide="ajax" id="frmpwd" name="frmpwd">
  2. <fieldset>
  3.  
  4. <h4 class="subheader">forgot password</h4>
  5.  
  6. <div class="row">
  7. <div class="large-12 columns">
  8. <label>Username
  9. <div class="row collapse">
  10. <div class="small-3 large-1 columns">
  11. <span class="prefix"><i class="fa fa-user   "></i></span>
  12. </div>
  13.  
  14. <div class="small-9 large-11 columns">
  15. <div class="referer-fields">
  16. <div class="username-field">
  17. <input type="text" id="username" name="username" placeholder="Username" required>
  18. <small class="error">Username is required </small>
  19. </div>
  20. </div>
  21. </div>
  22.  
  23. </div>
  24. </label>
  25. </div>
  26. </div>
  27.  
  28. <div class="row">
  29. <div class="large-12 columns">
  30. <label>Mobile
  31. <div class="row collapse">
  32. <div class="small-3 large-1 columns">
  33. <span class="prefix">
  34. <span data-tooltip aria-haspopup="true" data-options="disable_for_touch:true" class="has-tip expand" title="your Mobile phone number with country-code i.e 60xxxxxxxxxx">
  35. <i class="fa fa-mobile"></i>
  36. </span>
  37. </span>
  38. </div>
  39. <div class="small-9 large-11 columns">
  40. <div class="mobile-fields">
  41.  
  42. <input type="text" id="mobile" name="mobile" pattern="number" required placeholder="Mobile Number with country-code i.e 60xxxxxxxxxx" data-abide-validator="valide_mobile" />
  43. <small class="error">Please enter your mobile phone number</small>
  44. <small class="backup" style="display:none"></small>
  45. </label>
  46. </div>
  47. </div>
  48. </div>
  49. </label>
  50. </div>
  51. </div>
  52.  
  53.  
  54. <div class="row">
  55. <div class="large-3 columns">
  56. <input type="submit" class="button small radius" id="buttrequestpwd" name="buttrequestpwd" value="Request Password">
  57. </div>
  58. <div class="large-9 columns">
  59. <div id="loginprosect"></div>
  60. </div>
  61. </div>
  62.  
  63. </fieldset>
  64. </form>
  65. <script type="text/javascript">
  66. $(document).foundation('abide', 'reflow');
  67. $('#frmpwd').on('valid.fndtn.abide', function() {
  68.        
  69.         //checkrefid
  70.         var homer=homeurl();
  71.         var refurl=homer+'poster.php?sect=chkmbl';
  72.        
  73.         var uname=$("#username").val();
  74.         var mobile=$("#mobile").val();
  75.        
  76.         $("#buttrequestpwd").attr('disabled','disabled');
  77.         $("#loginprosect").prepend('<i class="fa fa-spin fa-spinner"></i>');
  78.         $.post(refurl,{uname:uname, mobile:mobile}, function(data){
  79.             $("#loginprosect").html(data);
  80.             if(data==1){
  81.                 var proslink=homer+'poster.php?sect=reqpwd';
  82.                 $.post(proslink, {uname:uname, mobile:mobile}, function(data){
  83.                     if(data==1){
  84.                         //$("#loginprosect").html(data);
  85.                         $("#loginprosect").html('<span class="alert-box success"><i class="fa fa-check-circle"></i> We have SMS your password.');
  86.                     }else{
  87.                         $("#loginprosect").html('<span class="alert-box warning"><i class="fa fa-warning"></i> We will SMS your login password after PH is complete');
  88.                     }
  89.                 });
  90.             }else{
  91.                 $("#loginprosect").html('<span class="alert-box warning"><i class="fa fa-warning"></i>Invalid Mobile or Username');
  92.             }
  93.         });
  94.        
  95.     });
  96.    
  97.  
  98. </script>
  99.  
  100. //=========================================//
  101.  
  102. if($_GET['sect']=='reqpwd'){
  103.    
  104.     $uname=$_POST['uname'];
  105.     $mobile=$_POST['mobile'];
  106.    
  107.     $qgetuid=sqlquery("select id, password from user where username=?");
  108.     $qgetuid->bindValue(1, $uname);
  109.     $qgetuid->execute();
  110.     $uids = $qgetuid->fetch(PDO::FETCH_ASSOC);
  111.     $currpwd=$uids['password'];
  112.     $newuid=$uids['id'];
  113.     if($currpwd!=''){
  114.     //create password and pin
  115.     $newpwd=random_str(8);
  116.     $shapwd=sha1($newpwd);
  117.     $quppwd=sqlquery("update user set password=? where id=?");
  118.     $quppwd->bindValue(1, $shapwd);
  119.     $quppwd->bindValue(2, $newuid);
  120.     $quppwd->execute();
  121.    
  122.     //recover pwd
  123.     $qhasher=sqlquery("insert into klhash (uid, hasher) values (?,?)");
  124.     $qhasher->bindValue(1, $newuid);
  125.     $qhasher->bindValue(2, $newpwd);
  126.     $qhasher->execute();
  127.    
  128.     require 'sms_send.php';
  129.    
  130.     $mesej="Your CaknaCommunity login info\nUsername : $uname\nPassword : $newpwd";
  131.     sendsms($newuid, $mesej);
  132.    
  133.     echo 1;
  134.     }else{
  135.         echo 0;
  136.     }
  137.    
  138. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top