I am trying to create a script to recover passwords by mail, but it does not work. Previously It came with an error that the e-mail was invalid.
Now its ends me the mail but with the encrypted password
in it.
Please help me to decrypt the password
Any lead for this error is highly appreciable
<?php
require_once("config.php"); //Database Connection
//Catch Field Data
$email = $_POST['email'];
$submitted = $_POST['submitted'];
if($email) {
$query = printf("SELECT * FROM registration where email='$email'");
$result = mysql_query($query);
$rowAccount = mysql_fetch_array($result);
}
if ($rowAccount) {
$subject = "Your goprestige Username / Password Reminder";
$headers = "From: info@abc.com";
$fname = $rowAccount['fname'];
$password = $rowAccount['password'];
$msg = "<h1>My abc Admin</h1>
<p>Hello '$user'!</p>
<p>Here is the username/password reminder you requested. If you didn't request this reminder then don't panic too much, the likely hood of someone gaining access is minimal. Thank you abc </p>
<p>Username: '$fname'</p>
<p>Password: '$password'</p>
<p>Many thanks, the abc Support Team.</p>
";
$success = mail($email, $subject, $msg, $headers);
if($success) {
echo "<p id=errors>Reminder Success: Your Username and Password have been emailed to $email";
}
} else ($submitted) {
echo '<p id="errors">Reminder Failed: The email you entered was not found on the system, please try again.</p>';
}
?>
HTML
<form class="form-horizontal ct-u-paddingBottom20" action="php/forget.php" method="post" id="passwd" style="display:none;">
<div class="form-group">
<label for="username" class="col-sm-2 control-label">Useremail: </label>
<div class="col-sm-10">
<input type="text" class="form-control" id="email" name="email" placeholder="enter your email id" required>
</div>
</div>
<div>
<center>
<span style="color:green;display:none;" class="success-footer"><h4 style="margin-left: 0px;">password link is sent </h4></span>
<span style="color:orange;display:none;" class="error-footer"><h4 style="margin-left: 0px;">invalid email</h4></span>
</center>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<p><input type="submit" value="Reset Password" /></p>
</div>
</div>
</form>
Javascript
<script type="text/javascript">
var frm = $('#passwd');
frm.submit(function (ev) {
$.ajax({
type: frm.attr('method'),
url: frm.attr('action'),
data: frm.serialize(),
success: function (data) {
//alert(data);
if (data) {
//alert('data');
$('.success-footer').css('display','block');
}
else{
$('.error-footer').css('display','block')
}
}
});
ev.preventDefault();
});
</script>