[insert_php]
if(isset($_POST[‘ok’]))
{
$email = $_POST[‘myemail’];
//connect and send reg details
$con = mysqli_connect(“localhost”, “conooorg_saly”, “{{Ssgkk4}}”);
$db = mysqli_select_db($con, “conooorg_nursing”);
//search
$r = mysqli_query($con, “Select * from pin where email=’$email'”);
if($r) { $x = mysqli_num_rows($r); }
if($x != 0)
{
$password = time();
$password = substr($password, -8);
$to = $email;
$subject = “CONOO Password Reset”;
$headers = “MIME-Version: 1.0” . “\n”;
$headers .= “Content-type:text/html;charset=iso-8859-1” . “\n”;
// More headers
$html = “Hello,
We received a Password Reset request for an account associated with this email address on our Website.
Your New Password is $password Use this password to access the online registration portal.
If you are not the one who initiated this request please contact the School for immediate action.
Kind regards.”;
$headers .= ‘From: registration@uecconoo.org’ . “\n”;
if(mail($to,$subject,$html,$headers))
{
//mail($to,$subject,”Your New Password: “.$password);
echo “
A new password has been sent to your email. Check your spam box in case you did not find it in your inbox.
Your New Password: $password
“;
//update password in db
$password = sha1($password);
$r = mysqli_query($con, “update pin set password=’$password’ where email=’$email'”);
}
} else {
echo “
The email address you provided is not a registered email address on this portal.
“;
}
}
echo “
“;
[/insert_php]