<?php 
include ('database.php');
session_start();

//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

//Load Composer's autoloader
require '../vendor/autoload.php';

//Create an instance; passing `true` enables exceptions


function sendemail_verify($email,$vcode) {
    $mail = new PHPMailer(true);
    //Server settings
    //$mail->SMTPDebug = 4;                      //Enable verbose debug output
    $mail->isSMTP();                                            //Send using SMTP
    $mail->Host       = 'server319.web-hosting.com';                     //Set the SMTP server to send through
    $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
    $mail->Username   = 'info@worlds-fx.com';                     //SMTP username
    $mail->Password   = 'worldsfx.com13';                               //SMTP password
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
    $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

    //Recipients
    $mail->setFrom('info@worlds-fx.com', 'WORLDS-FX');
    $mail->addAddress($email);     //Add a recipient              //Name is optional
    $mail->addReplyTo('support@worlds-fx.com', 'WORLDS-FX');
   
    
    //Content
    $mail->isHTML(true);                                  //Set email format to HTML
    $mail->Subject = 'Password Reset';
    $mail->Body    = '<body bgcolor="transparent">
    <div>
      
      <div align="center" style="background-color:#transparent; padding-left:20px; padding-right:20px; max-width:550px; margin:auto; border-radius:5px; padding-bottom:5px; text-align:left; margin-bottom:40px; width:80%"> 
        <h2 style="padding-top:25px; min-width:600; align:center; font-family:Roboto">
         hi,
        </h2>
        <p style="max-width:500px; align:center; font-family:Roboto; padding-bottom:0px; wrap:hard; line-height:25px">
          You Requested For A Password Reset 
        </p>
        <p style="max-width:500px; align:center; font-family:Roboto-Bold; padding-bottom:0px; wrap:hard">
          Click the button below to reset password:
        </p>
       
     
         <a href="https://koinbloom.com/update-password.php?email=$email" style="width:100px; height:100px; background-color:#1a1849; font-family:Roboto-Bold; font-color:white; font-weight:2px; padding-top:15px; padding-bottom:15px; padding-left:15%; padding-right:15%; border-radius:30px; text-decoration:none; color:#fff"></a>
 
       
        <p style="max-width:500px; align:center; font-family:Roboto; padding-bottom:20px; wrap:hard">
          The Worlds-fx Team
        </p style="color:blue">
        <hr>
        </hr>
        <p style="max-width:100%; align:center; font-family:Roboto; padding-bottom:10px; wrap:hard; padding-top: 0px; font-size:10px">
          You are receiving this email because you request for a password request. If this was not you, please ignore this email.
        </p>
      </div>
  </div>
</body>';
    
     $mail->send();
     echo 'Message has been sent';
} 

if(isset($_POST['membtn']));
{
    $email = mysqli_real_escape_string($connection, $_POST['email']);
     sendemail_verify("$email");

	$_SESSION['status'] = "<p style='padding:15px; background: #1a1849; color: #fff; border-radius:10px;'> An email has been sent sent to you. if you did not recieve an email contact support</p> ";
	 header("location: ../forgot-password.php"); 
 }

?>