JezK
Edit File: resetPassword.php
<?php require_once './mobapp/include/DbHandler.php'; $db = new DbHandler(); $userID=trim($_GET['d']); $otp=trim($_GET['o']); $checkOtp=$db->getUserOtp($userID); // print_r($checkOtp);exit; $userotp=$checkOtp['password_otp']; if($userotp==0) { header("Location:thnkForgotPwd.php?type=1"); }else if($userotp!=$otp) { header("Location:thnkForgotPwd.php?type=2"); } if(isset($_REQUEST['frmsub'])) { $password=trim($_POST['password']); $result=$db->updateUserPassword($userID,$password); if($result) { //echo '<script>alert("Password updated successfully");</script>'; echo '<script>location.replace("thnkForgotPwd.php?type=1");</script>'; } else { echo '<script>alert("Try again Password not updated.");</script>'; } } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Password Reset</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" href="../airsohoo_admin/images/fav.png" type="images/png" sizes="16x16"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script type="text/javascript" src="jquery_003.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <style> .head-text{ font-size:20px; padding-left:20px; } .p1{ color: #000; margin:0px; } .p2{ color: #9d9d9d; margin:0px; } </style> <script type="text/javascript"> function fun1() { var password=$('#password').val(); if(/\s/g.test(password)) { alert("Password do not accept spaces"); document.getElementById("password").value=''; document.getElementById("password").focus(); return false; } } function fun2() { var password=$('#cpassword').val(); if(/\s/g.test(password)) { alert("Password do not accept spaces"); document.getElementById("cpassword").value=''; document.getElementById("cpassword").focus(); return false; } } function checkpswd() { var password=document.getElementById("password").value; var cpassword=document.getElementById("cpassword").value; if(password.trim()=='') { alert("Please enter password"); document.getElementById("password").value=''; document.getElementById("password").focus(); return false; }else if(password.length <6) { alert('Password should be minimum of 6 characters'); document.getElementById("password").focus(); return false; } else if(/\s/g.test(password)) { alert("Password do not accept spaces"); document.getElementById("password").value=''; document.getElementById("password").focus(); return false; } else if(cpassword.trim()=='') { alert("Please enter confirm password"); document.getElementById("cpassword").value=''; document.getElementById("cpassword").focus(); return false; }else if(cpassword.length <6) { alert('Confirm password should be minimum of 6 characters'); document.getElementById("cpassword").focus(); return false; } else if(password!=cpassword) { alert('Password Mismatch'); return false; } } </script> <body> <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="col-md-10 " style="padding:10px;"><img src="./images/logo.png" width="50px" height="auto"><span class="head-text">Password Reset</span></div> </div> </nav> <div class="container"> <div class=""> <!-- <h2 style="padding-bottom:20px;">Reset Your Password</h2> --> <div class="col-md-12"> <!-- <div class="col-md-1"><img src="./images/logo.png" width="100%" height="75px"></div> <div class="col-md-11" style="padding:0px;"> <!--<p class="p1">Ramyapriya</p> <p class="p2">ramya@krify.net</p>-- </div> <div style="clear:both;"></div> --> <form class="col-md-5" style="margin-top:40px;" method="post"> <div class="form-group" > <label for="newPassword">New Password:</label> <input type="password" class="form-control" name="password" id="password" onblur="return fun1(this.value)"> </div> <div class="form-group"> <label for="confirmPassword">Confirm Password:</label> <input type="password" class="form-control" name="cpassword" id="cpassword" onblur="return fun2(this.value)"> </div> <input type="submit" class="btn btn-info" name="frmsub" value="Submit" onclick="return checkpswd()"> </form> </div> </div> </div> </body> </html>