ok
Direktori : /proc/thread-self/root/home2/selectio/public_html/salemgovtitialumni.in/ |
Current File : //proc/thread-self/root/home2/selectio/public_html/salemgovtitialumni.in/forgot-password.php |
<?php include 'header.php' ?> <?php $error_message=""; if(isset($_POST['login'])) { $dynamic_email_id_otp=date("his")."".rand(10,100); $email=$_POST['email']; $stmt=$pdo->prepare("select * from `tbl_member` 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 - Salem Government ITI"; $message = "<b>Forgot Password</b>"; $message .= "<h1><span style='background:#c6d8c5c7'>".$dynamic_email_id_otp."</span></h1>"; $header = "From:info@firstmatrix.in \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 "Message sent successfully..."; $stmt1=$pdo->prepare("update tbl_member set password=? where id=?"); $stmt1->execute(array($dynamic_email_id_otp,$result[0]['id'])); echo '<script> alert("OTP send to your email"); </script>'; header("location:forgot-password.php?id=".$result[0]['id']); exit(); }else { echo "Message could not be sent..."; } } else { echo "<script>alert('Please Enter registered Mail id');</script>"; } } if(isset($_POST['login_password'])){ $passid = $_POST["id"]; error_log("aziz test".$passid); $stmt1 = $pdo->prepare("select password from `tbl_member` where id=?"); $stmt1->execute(array($passid)); $result1=$stmt1->fetchAll(PDO::FETCH_ASSOC); $forgotpass = $result1[0]['password']; $new_password=$_POST["new_password"]; if( $forgotpass == $new_password){ error_log("aziz pass: ".$new_password); echo "<script> alert('otp verified " . $_POST["id"] . "');</script>"; header("location:new-password.php?id=".$passid); }else{ error_log("else"); } } ?> <!-- Login & Register Start --> <div class="section login-register-section section-padding"> <div class="container"> <div class="row"> <div class="col-lg-12"> <!-- Login & Register Wrapper Start --> <div class="login-register-wrap"> <div class="container"> <div class="row" style="display: flex;justify-content: center;"> <div class="col-lg-6" style="margin-top: 125px;" > <!-- Login & Register Box Start --> <div class="login-register-box"> <?php if(isset($_GET['id']) && $_GET['id'] !=''){ ?> <div class="section-title"> <h4 class="title">Enter Your OTP</h4> </div> <div class="login-register-form"> <form action="" method="post"> <div class="single-form"> <input type="text" value="<?=$_GET['id']; ?>" name="id" hidden> <input type="text" name="new_password" class="form-control" placeholder="OTP" required> </div> <div class="single-form"> <p style="color:red;"><?= $error_message ?></p> </div> <div class="form-btn"> <button name="login_password" class="btn">Forgot Password</button> </div> </form> </div> <?php } else { ?> <div class="section-title"> <h4 class="title">Enter Your Email</h4> </div> <div class="login-register-form"> <form action="" method="post"> <div class="single-form"> <input type="email" name="email" class="form-control" placeholder="Email" required> </div> <div class="single-form"> <p style="color:red;"><?= $error_message ?></p> </div> <div class="form-btn"> <button name="login" class="btn">Forgot Password</button> </div> </form> </div> <?php } ?> </div> <!-- Login & Register Box End --> </div> </div> </div> </div> <!-- Login & Register Wrapper End --> </div> </div> </div> </div> <!-- Login & Register End --> <?php include 'footer.php' ?>