ok
Direktori : /home2/selectio/public_html/tnpsctestbatch.com/ |
Current File : /home2/selectio/public_html/tnpsctestbatch.com/forgot-mail.php |
<?php include 'header.php'; if(isset($_POST['login'])) { $dynamic_email_id_otp=date("his")."".rand(10,100); $email=$_POST['email']; $stmt=$pdo->prepare("select * from `tbl_students` where email=?"); $stmt->execute(array($email)); $result=$stmt->fetchAll(PDO::FETCH_ASSOC); $count=$stmt->rowCount(); if($count>0) { echo "dynamic_email_id_otp:".$dynamic_email_id_otp; $to = $email; $subject = "Forget Password - TNPSC TEST BATCH"; $message = "<b>Your Password</b>"; $message .= "<h1><span style='background:#c6d8c5c7'>".$result[0]['password']."</span></h1>"; $header = "From:info@tnpsctestbatch.com \r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-type: text/html\r\n"; $retval = mail ($to,$subject,$message,$header); if( $retval == true ) { echo "<script> var result = confirm('Your Password Send To Email'); if(result){ window.location.href='login.php?forget_password=".$email,"'; } </script>"; // $stmt1=$pdo->prepare("update tbl_students set password=? where id=?"); // $stmt1->execute(array($dynamic_email_id_otp,$result[0]['id'])); }else { echo "Message could not be sent..."; } } else { echo "<script>alert('Please Enter registered Mail id " . $id . "');</script>"; } } if(isset($_POST['login_password'])) { $passid=$_POST["id"]; $stmt1=$pdo->prepare("select password from `tbl_user` where id=?"); $stmt1->execute(array( $passid )); $result1=$stmt1->fetchAll(PDO::FETCH_ASSOC); $counts=$stmt1->rowCount(); $forgotpass = $result1[0]['password']; $new_password=$_POST["new_password"]; if( $forgotpass == $new_password){ echo "<script> alert('otp verified " . $_POST["id"] . "');</script>"; header("location:forgot-passwordsecond.php?id=".$passid); }else{ echo "<script> alert('OTP Not Matched'); location.reload(); </script>"; } //echo "sucess"; } ?> <style> .header-style-3.site-header { position: absolute; width: 100%; left: 0px; top: 0px; z-index: 999; display: none; } </style> <!-- CONTENT START --> <div class="page-content"> <!-- Login Section Start --> <div class="section-full site-bg-white"> <div class="container-fluid"> <div class="row"> <div class="col-xl-12 col-lg-12 col-md-12" > <div class="row" style="display: flex;justify-content: center;"> <div class="col-md-5"> <div class="twm-log-reg-form-wrap"> <div class="twm-log-reg-inner"> <div class="twm-log-reg-head"> <div class="twm-log-reg-logo"> <span class="log-reg-form-title">Forget Password </span> </div> </div> <div class="twm-tabs-style-2"> <?php $mail = ''; if(isset($_GET['forget_password'])){ $mail = $_GET['forget_password'] ; } ?> <form method="post" action=""> <div class="tab-content" id="myTab2Content"> <!--Login Candidate Content--> <div class="tab-pane fade show active" id="twm-login-candidate"> <div class="row"> <div class="col-lg-12" style="text-align: left;"> <div class="form-group mb-3"> <label><b>Your Email :</b></label> <input name="email" type="email" required="" value="<?=$mail?>" class="form-control" placeholder="Enter Your Email*" /> </div> </div> <div class="col-md-12"> <div class="form-group"> <input name="login" type="submit" class="site-button" value="Send OTP" class="form-control" required="" placeholder="Password*" /> </div> </div> </div> </div> </div> </form> </div> </div> </div> </div> </div> </div> </div> </div> </div> <!-- Login Section End --> </div> <!-- CONTENT END --> <?php include 'footer.php'; ?>