<?php

include("dbconnect.php");
include("function.php");

$email = $_GET["email"];
//$to = "abdulshaikh615@gmail.com";
$to = $email;
$success = 0;
$maindb = "site_passmain";
if ($to != '') {

    $login = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE `user` != '' AND `email` = '$to'") or die(mysqli_error($conn));
    $flogin = mysqli_fetch_array($login);
    $userid = $flogin['srno'];

    if (mysqli_num_rows($login) > 0) {
        
        $encrypted = $encrypted_string=openssl_encrypt($email,"AES-128-ECB", "password");

        $headers = "From: info@wolfit.in\r\n";
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

        $subject = "WOLFIT - RESET YOUR PASSWORD";
        $message = "To Reset Your Password Click Below Link<br>" .
                "<a href='wolfit.in/resetpwd.php?code=$encrypted'>Click Here</a>";
        mail($to, $subject, $message, $headers);
        $success = 1;
    }
}
echo $success;
?> 
