Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/public_html/
Upload File :
Current File : /home2/wtmwscom/public_html/forgot_model.php

<?php 
session_start();
include 'connection.php';
include 'function_lib.php';
$login_id = $_POST['login_id'];
$result = mysqli_query($connection, "SELECT uid, login_id, name, mobile, password, email FROM user WHERE login_id='".$login_id."'");
if(mysqli_num_rows($result)){
    $row = mysqli_fetch_array($result);
    
    /* Send SMS */
    
    $login_id = $row['login_id'];
    $password = $row['password'];
    $name = $row['name'];
    $mobile = $row['mobile'];
    $msg="Dear $name, Your Id no. is $login_id and password is $password Visit us on www.mindspace";
    send_sms($mobile, $msg);
    
    /* Send Email */
    $to = $row['email'];
    $subject = "Forgot Password";
    $message = "
        <b>User Id:</b> ".$login_id."<br><br>
        <b>Password:</b> ".$row['password']."
        ";

    // Always set content-type when sending HTML email
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
    // More headers
    $headers .= 'From: <info@mindspace>' . "\r\n";
    if(mail($to,$subject,$message,$headers)){
        setMessage('Your password sent to your registered email id and mobile number','alert-msg success');
    }
    else{
        setMessage('Some error occured','alert-msg error');
    } 
}
else{
    setMessage('User Id is incorrect','alert-msg error');
}
redirect('./forgot.php');
?>