<?php
include('connect.php');

	session_start();
	
    date_default_timezone_set('Africa/Lagos');
    $date= date("d-m-Y h:i:sa");

	$errors = array(); 
	$_SESSION['success'] = "";



	// REGISTER USER
	if (isset($_POST['reg_user'])) {
	   
		// receive all input values from the form
		$firstname = mysqli_real_escape_string($db, $_POST['firstname']);
		$lastname = mysqli_real_escape_string($db, $_POST['lastname']);
		$email = mysqli_real_escape_string($db, $_POST['email']);
		$phone = mysqli_real_escape_string($db, $_POST['phone']);
		$city = mysqli_real_escape_string($db, $_POST['city']);
		$country = mysqli_real_escape_string($db, $_POST['country']);
		$password_1 = mysqli_real_escape_string($db, $_POST['password_1']);
		$password_2 = mysqli_real_escape_string($db, $_POST['password_2']);
		$unique = md5(uniqid());
		  
		  
		// form validation: ensure that the form is correctly filled
		if (empty($firstname)) { array_push($errors, "Firstname is required"); }
		if (empty($lastname)) { array_push($errors, "Lastname is required"); }
		if (empty($email)) { array_push($errors, "Email is required"); }
		if (empty($phone)) { array_push($errors, "Phone Number is required"); }
		if (empty($city)) { array_push($errors, "City is required"); }
		if (empty($country)) { array_push($errors, "Country is required"); }
		if (empty($password_1)) { array_push($errors, "Password is required"); }
       
        
        // form validation: validates password
		if ($password_1 != $password_2) { array_push($errors, "The two passwords do not match"); }
		
		
        //Checking if its really numeric
        if(!is_numeric($phone)) { array_push($errors, "Please input only numbers"); }
  
  
          // a user does not already exist with the same username and/or email
          $user_check_query = "SELECT * FROM user WHERE email='$email' or phone='$phone' LIMIT 1";
          $result = mysqli_query($db, $user_check_query);
          $user = mysqli_fetch_assoc($result);
         if ($user['phone'] === $phone) { array_push($errors, "Phone Number already exists"); }
         if ($user['email'] === $email) { array_push($errors, "Email already exists");}
            
        //encrypt the password before saving in the database
        //$password = md5($password_1);
        
        //generating account number 
        $accountnumber = rand(4564542223,3423556554);
        
        //generating pin number 
        $pin = rand(1056,2084);
        $imfcode = rand(1056,2084);
        $ipncode = rand(1056,2084);
        $cotcode = rand(1056,2084);
        
		// register user if there are no errors in the form
		if (count($errors) == 0) {
			
	    //insert into database
			$query = "INSERT INTO user (accountnumber, pin, imfcode, ipncode, cotcode, firstname, lastname, phone, email, city, country, password, reset, signup_date) 
					  VALUES('$accountnumber', '$pin', '$imfcode', '$ipncode',  '$cotcode', '$firstname', '$lastname', '$phone', '$email', '$city', '$country', '$password_1', '$unique', '$date')";
			mysqli_query($db, $query);

        //sending welcoming email
        //$mcred= $site_url.'/include/email/welcome.php';
           //file_get_contents($mcred); 
           
           
$to = $email;
$subject = 'Welcome To '.$site_name;
$from = $site_email;
 
// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
// Create email headers
$headers .= 'From: '.$from."\r\n".
    'Reply-To: '.$from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
 
$message = '
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta name="x-apple-disable-message-reformatting">
  <title></title>
  <!--[if mso]>
  <style>
    table {border-collapse:collapse;border-spacing:0;border:none;margin:0;}
    div, td {padding:0;}
    div {margin:0 !important;}
  </style>
  <noscript>
    <xml>
      <o:OfficeDocumentSettings>
        <o:PixelsPerInch>96</o:PixelsPerInch>
      </o:OfficeDocumentSettings>
    </xml>
  </noscript>
  <![endif]-->
  <style>
    table, td, div, h1, p {
      font-family: Arial, sans-serif;
    }
    @media screen and (max-width: 530px) {
      .unsub {
        display: block;
        padding: 8px;
        margin-top: 14px;
        border-radius: 6px;
        background-color: #555555;
        text-decoration: none !important;
        font-weight: bold;
      }
      .col-lge {
        max-width: 100% !important;
      }
    }
    @media screen and (min-width: 531px) {
      .col-sml {
        max-width: 27% !important;
      }
      .col-lge {
        max-width: 73% !important;
      }
    }
  </style>
</head>

<body style="margin:0;padding:0;word-spacing:normal;background-color:#939297;">
  <div role="article" aria-roledescription="email" lang="en" style="text-size-adjust:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#939297;">
    <table role="presentation" style="width:100%;border:none;border-spacing:0;">
      <tr>
        <td align="center" style="padding:0;">
          <!--[if mso]>
          <table role="presentation" align="center" style="width:600px;">
          <tr>
          <td>
          <![endif]-->
          <table role="presentation" style="width:94%;max-width:600px;border:none;border-spacing:0;text-align:left;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
            <tr>
              <td style="padding:40px 30px 30px 30px;text-align:center;font-size:24px;font-weight:bold;">
                <a href="'.$site_url.'" style="text-decoration:none;"><img src="'.$site_image.'" width="10" alt="Logo" style="width:10%">&nbsp;<span style="color:black;">'.$site_name.'</a>
              </td>
            </tr>


<tr>
              <td style="padding:30px;background-color:#ffffff;">
                <h1 style="margin-top:0;margin-bottom:16px;font-size:26px;line-height:32px;font-weight:bold;letter-spacing:-0.02em;">Account Registration Successful</h1>
                <h4>Dear <b>'.$firstname.' '.$lastname.'</b></h4>
                <br>
                <p style="margin:0;"><b style="color:blue">Welcome On Board!</b>
                    <br><br>
                    We are pleased to stress that your '.$site_name.' account has been successfully created. You can now proceed to your User Dashbord. Kindly use the account number: <b>'.$accountnumber.'</b> and password provided by you during registration to login. Your default transaction pin is <b>'.$pin.'.</b> This pin would be used for transactions on your account.
                <br> <br>
                Note: You can always reset your password or ask for help from our support team should the need arise.</p>
</p>
              </td>
            </tr>
            <tr>
              <td style="padding:0;font-size:24px;line-height:28px;font-weight:bold;">
                <a href="#" style="text-decoration:none;"><img src="online.jpg" width="600" alt="" style="width:100%;height:auto;display:block;border:none;text-decoration:none;color:#363636;"></a>
              </td>
            </tr>
            <tr>
              <td style="padding:35px 30px 11px 30px;font-size:0;background-color:#ffffff;border-bottom:1px solid #f0f0f5;border-color:rgba(201,201,207,.35);">
                <!--[if mso]>
                <table role="presentation" width="100%">
                <tr>
                <td style="width:145px;" align="left" valign="top">
                <![endif]-->
                <div class="col-sml" style="display:inline-block;width:100%;max-width:145px;vertical-align:top;text-align:left;font-family:Arial,sans-serif;font-size:14px;color:#363636;">
                  <img src="https://assets.codepen.io/210284/icon.png" width="115" alt="" style="width:80%;max-width:115px;margin-bottom:20px;">
                </div>
              
                <div class="col-lge" style="display:inline-block;width:100%;max-width:395px;vertical-align:top;padding-bottom:20px;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
                  <p style="margin-top:0;margin-bottom:12px;">You have received this email regarding to your account creation on '.$site_name.'. If you did not initiate such action, please Disregard this email.</p>
                  
                  <p style="margin:0;"><a href="'.$site_url.'" style="background: #ff3884; text-decoration: none; padding: 10px 25px; color: #ffffff; border-radius: 4px; display:inline-block; mso-padding-alt:0;text-underline-color:#ff3884"><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%;mso-text-raise:20pt">&nbsp;</i><![endif]--><span style="mso-text-raise:10pt;font-weight:bold;">See Home Page</span><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%">&nbsp;</i><![endif]--></a></p>
                  <br><br>
                  
                  <p>Best of luck!</p>
                  
            <h4>'.$site_name.' Team</h4>
            </div>
                </div>
                
                

              </td>
            </tr>
            
        <br>

<tr>
              <td style="padding:30px;text-align:center;font-size:12px;background-color:#404040;color:#cccccc;">
                <p style="margin:0 0 8px 0;"><a href="http://www.facebook.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/facebook_1.png" width="40" height="40" alt="f" style="display:inline-block;color:#cccccc;"></a> <a href="http://www.twitter.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/twitter_1.png" width="40" height="40" alt="t" style="display:inline-block;color:#cccccc;"></a></p>
                <p style="margin:0;font-size:14px;line-height:20px;"><b>Legal:</b> This email message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please delete it from your computer. '.$site_name.', does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is acepted by '.$site_name.' in this regard and the recipient should carry out such virus and other checks as it considers appropriate. <br><br><a class="unsub" href="#" style="color:#cccccc;text-decoration:underline;"><b>&copy; '.$site_name.' 2022 </b></a></p>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
  </div>
</body>
</html>

';
 
// Sending email
if(mail($to, $subject, $message, $headers)){
       
			$_SESSION['accountnumber'] = $accountnumber;
			$_SESSION['success'] = "You are now logged in";
			header('location: /dashboard/index.php');
		}

	}
}
	
	
		// LOGIN USER
	if (isset($_POST['login_user'])) {
		$accountnumber = mysqli_real_escape_string($db, $_POST['accountnumber']);
		$password = mysqli_real_escape_string($db, $_POST['password']);
		

        $sitedetails = mysqli_fetch_array(mysqli_query($db,"SELECT activation FROM user WHERE accountnumber='".$accountnumber."'"));
	  
	    if ( $sitedetails[0] == "1"){
	        array_push($errors, "Your Account Has Been Banned");
	   
	   header('location: '.$site_url.'/access_denied.php');
	    }
	    
	    
		if (empty($accountnumber)) {
			array_push($errors, "Pls kindly enter your generated account  number");
		}
		if (empty($password)) {
			array_push($errors, "Password is required");
		}

		if (count($errors) == 0) {
		//	$password = md5($password);
			$query = "SELECT * FROM user WHERE accountnumber='$accountnumber' AND password='$password'";
			$results = mysqli_query($db, $query);

			if (mysqli_num_rows($results) == 1) {
				$_SESSION['accountnumber'] = $accountnumber;
				$_SESSION['success'] = "You are now logged in";
				header('location: /dashboard/index.php');
			}else {
				array_push($errors, "Incorrect Account Number or Password. <br> Try again");
			}
		}
	}
	
if(isset($_POST["forgot_submit"])) {
    
$email = mysqli_real_escape_string($db, $_POST["email"]);  
$select = mysqli_fetch_array(mysqli_query($db,"SELECT reset, user_email, user_username FROM user WHERE user_email = '$email'"));

//create unique code

if (empty($select[0])){
$unique = md5(uniqid());
mysqli_query($db, "UPDATE user SET reset='$unique' WHERE user_username='$select[2]'");
$error = '<div class="alert alert-danger" role="alert"> Unable to proccess request. Try again!</div>';
}


//check if email exist in database

if (mysqli_num_rows(mysqli_query($db, "SELECT * FROM user WHERE user_email= '$email'")) == 0) {

    $error = '<div class="alert alert-danger" role="alert"> Sorry! this email is not registered with us! </div>';

}

 if ($email==$select[1] & !empty($select[0])) {

            $to = $select[1];
            
            $subject = "Reset Password Request";
            
          $headers = 'From: '.$site_name.' <noreply@'.$site_url3.'>' . "\r\n";
          
          $message = ' Dear '. $select[2].'
          
A request was made to reset your password.

kindly click 

"https://'.$site_url2.'/reset_password.php?r='.$select[0].'"
 
to reset your password

Please if you did not initiate the above request kindly ignore this email

Thanks For Choosing '.$site_name.'. 
'.$site_url2.'';

             if (mail($to, $subject, $message, $headers)){
    
    $success = '<div class="alert alert-success" role="alert"> Please check your email! a link for password reset has been sent to you.</div>';

    
}
    
}

}


//	CONACT US
	
	if (isset ($_POST["conact_us"])){

        
            $name = $_POST['name']; 
            $email = $_POST['email']; 
            $sub = $_POST['subject']; 
            $mes = $_POST['message']; 
            
            $to = $site_email;
            
            $subject = "Customer Assistance";
            
          $headers = 'From: '.$site_name.' <noreply@'.$site_url3.'>' . "\r\n";
          
         $message = "Full Name: ".$name."\n"."E-Mail Address: ".$email."\n"."Subject: ".$sub."\n"."\n"."Your Message: ".$mes;
      

    if (mail($to, $subject, $message, $headers)){
	
	
                  $msg= '<div class="alert alert-success alert-dismissible fade show" role="alert">
  <strong>Thanks! Message Successfully Sent</strong> <em>We would get back to you shortly.</em>
  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    <span aria-hidden="true">&times;</span>
  </button>
</div>';
             }else{
        
                 $msg= '<div class="alert alert-warning alert-dismissible fade show" role="alert">
  <strong>Oops...!</strong> <em>Your message was not sent. Please check form if correctly filled.</em>
  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    <span aria-hidden="true">&times;</span>
  </button>
</div>';


              }
        
        
        
        }
	
	



	
// $reset_token = mysqli_real_escape_string($db, $_REQUEST['r']);
//     $exist_reset_token = mysqli_num_rows(mysqli_query($db,"SELECT * FROM user WHERE reset='$reset_token'"));
    
//     $user_info = mysqli_fetch_array(mysqli_query($db,"SELECT reset, user_email, user_username FROM user WHERE reset='$reset_token'"));

// if (!isset($_REQUEST['r'])){
// $exist_reset_token = mysqli_num_rows(mysqli_query($db,"SELECT * FROM user WHERE reset='$reset_token'"));    	
// if($exist_reset_token == 0){$err1=1;}
// }

// if  (isset($_POST['reset_password_button'])) {
//     $newreset=md5(uniqid()); 
//     $password=mysqli_real_escape_string($db, $_POST['password']);
//     $cpassword=mysqli_real_escape_string($db, $_POST['cpassword']);
//     $mdpass=md5($password);
    	
    	
// if($exist_reset_token == 0){$err1=1;}
// if ($password!=$cpassword){$err2=1;}    
// if(trim($password)==""){$err3=1;}

// if(strlen($password)<=3){$err4=1;}

// $error = $err1+$err2+$err3+$err4;


// if ($error == 0){
//   $update_password = mysqli_query($db, "UPDATE user SET reset='$newreset', user_password='$mdpass' WHERE user_username='$user_info[2]'");
//             if ($update_password){
                
//             $to = $user_info[1];

            
//             $subject = "Password Successfully Updated";
            
//             $headers = 'From: '.$site_name.' <noreply@'.$site_url3.'>' . "\r\n";
    
//             $message = 'Dear '. $user_info[2].'
     
// Your password has been successfully reset.

// While your username remains '. $user_info[2].' 

// You can now go ahead to login with your new password.

// Enjoy!

// Thanks For Choosing '.$site_name.'. 
// '.$site_url2.'';
//     if (mail($to, $subject, $message, $headers))

//                 $msg =  "<div class=\"alert alert-success alert-dismissable\">
//         <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>Your password have been updated successfully! You can now proceed to login to your dashboard...</div>";
//             }

//             else {

//               $msg = "<div class=\"alert alert-danger alert-dismissable\">
//     <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>Unable To Process. Try Again</div>";
//             }
// } else {
	
// if ($err1 == 1){
// $msg =  "<div class=\"alert alert-danger alert-dismissable\">
// <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	


// Sorry, But This Link Is Not Longer Valid.

// </div>";
// }		
// if ($err2 == 1){
// 	$msg =  "<div class=\"alert alert-danger alert-dismissable\">
// <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

// Your Password And Confirm Password Must Be The Same.

// </div>";

// }		
// if ($err3 == 1){
// $msg = "<div class=\"alert alert-danger alert-dismissable\">
// <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

// Password Can Not Be Empty.

// </div>";

// }		
// if ($err4 == 1){
// 	$msg =  "<div class=\"alert alert-danger alert-dismissable\">
// <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

// Password Must Be Four Or More Characters.

// </div>";
// }	

	
// }



// } 




//forgot password


if(isset($_POST["forgot_submit"])) {
    
    
    $email = mysqli_real_escape_string($db, $_POST["client_email"]);
    
    
    $select = mysqli_fetch_array(mysqli_query($db, "SELECT reset, email, accountnumber, firstname, lastname FROM user WHERE email = '$email'"));

//create unique code

if (empty($select[0])){
$unique = md5(uniqid());
mysqli_query($db, "UPDATE user SET reset='$unique' WHERE accountnumber='$select[2]'");
$error = '<div class="alert alert-danger" role="alert"> Unable to proccess request. Please Try again!</div>';
}


//check if email exist in database

if (mysqli_num_rows(mysqli_query($db, "SELECT * FROM user WHERE email= '$email'")) == 0) {

    $error = '<div class="alert alert-danger" role="alert"> Sorry! this email is not registered with us! </div>';

}

//finally checking if email truly match and reset code also exist.
 if ($email==$select[1] & (!empty($select[0]))) {
     
     
//now send this email to client for password reset
  $to = $select[1];
    
$subject = 'Password Reset Request';

$from = $site_email;
 
// Setting html content type for email sending
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
// Create email headers
$headers .= 'From: '.$from."\r\n".
    'Reply-To: '.$from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
    
     $emailmsg = ' <!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta name="x-apple-disable-message-reformatting">
  <title></title>
  <!--[if mso]>
  <style>
    table {border-collapse:collapse;border-spacing:0;border:none;margin:0;}
    div, td {padding:0;}
    div {margin:0 !important;}
  </style>
  <noscript>
    <xml>
      <o:OfficeDocumentSettings>
        <o:PixelsPerInch>96</o:PixelsPerInch>
      </o:OfficeDocumentSettings>
    </xml>
  </noscript>
  <![endif]-->
  <style>
    table, td, div, h1, p {
      font-family: Arial, sans-serif;
    }
    @media screen and (max-width: 530px) {
      .unsub {
        display: block;
        padding: 8px;
        margin-top: 14px;
        border-radius: 6px;
        background-color: #555555;
        text-decoration: none !important;
        font-weight: bold;
      }
      .col-lge {
        max-width: 100% !important;
      }
    }
    @media screen and (min-width: 531px) {
      .col-sml {
        max-width: 27% !important;
      }
      .col-lge {
        max-width: 73% !important;
      }
    }
    
    
    
    a:link, a:visited {
  background-color: lightblue;
  color: white;
  padding: 20px 25px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  
}

a:hover, a:active {
  background-color: blue;
}



  </style>
</head>

<body style="margin:0;padding:0;word-spacing:normal;background-color:#939297;">
  <div role="article" aria-roledescription="email" lang="en" style="text-size-adjust:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#939297;">
    <table role="presentation" style="width:100%;border:none;border-spacing:0;">
      <tr>
        <td align="center" style="padding:0;">
          <!--[if mso]>
          <table role="presentation" align="center" style="width:600px;">
          <tr>
          <td>
          <![endif]-->
          <table role="presentation" style="width:94%;max-width:600px;border:none;border-spacing:0;text-align:left;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
            <tr>
              <td style="padding:40px 30px 30px 30px;text-align:center;font-size:24px;font-weight:bold;">
                <a href="'.$site_url.'" style="text-decoration:none;"><img src="'.$site_image.'" width="10" alt="Logo" style="width:10%">&nbsp;<span style="color:black;">'.$site_name.'</a>
              </td>
            </tr>


<tr>
              <td style="padding:30px;background-color:#ffffff;">
                <h1 style="margin-top:0;margin-bottom:16px;font-size:26px;line-height:32px;font-weight:bold;letter-spacing:-0.02em;">Password Reset Request</h1>
                <h4>Dear <b>'.$select[3].' '.$select[4].'</b></h4>
                <br>
                <p style="margin:0;"><b style="color:blue"></b>
                    <br><br>
                    A request was made on our website to reset your password. If this was you please kindly click this
                    link
                    
                    <br>
                    <p style="margin:0;"><a href="'.$site_url.'/reset_password.php?r='.$select[0].'" style="background: #ff3884; text-decoration: none; padding: 10px 25px; color: #ffffff; border-radius: 4px; display:inline-block; mso-padding-alt:0;text-underline-color:#ff3884"><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%;mso-text-raise:20pt">&nbsp;</i><![endif]--><span style="mso-text-raise:10pt;font-weight:bold;">Reset Password</span><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%">&nbsp;</i><![endif]--></a></p>
                <br> <br><br>
                
                Note: Please if you did not initiate the above request kindly ignore this email</p>
</p>
              </td>
            </tr>
            <tr>
              <td style="padding:0;font-size:24px;line-height:28px;font-weight:bold;">
                <a href="#" style="text-decoration:none;"><img src="online.jpg" width="600" alt="" style="width:100%;height:auto;display:block;border:none;text-decoration:none;color:#363636;"></a>
              </td>
            </tr>
            <tr>
              <td style="padding:35px 30px 11px 30px;font-size:0;background-color:#ffffff;border-bottom:1px solid #f0f0f5;border-color:rgba(201,201,207,.35);">
                <!--[if mso]>
                <table role="presentation" width="100%">
                <tr>
                <td style="width:145px;" align="left" valign="top">
                <![endif]-->
                <div class="col-sml" style="display:inline-block;width:100%;max-width:145px;vertical-align:top;text-align:left;font-family:Arial,sans-serif;font-size:14px;color:#363636;">
                  <img src="https://assets.codepen.io/210284/icon.png" width="115" alt="" style="width:80%;max-width:115px;margin-bottom:20px;">
                </div>
              
                <div class="col-lge" style="display:inline-block;width:100%;max-width:395px;vertical-align:top;padding-bottom:20px;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
                  <p style="margin-top:0;margin-bottom:12px;">You have received this email regarding a given request made on '.$site_name.'. If you did not initiate such action, please Disregard this email.</p>
                  
                  
                  <br><br>
                  
                  <p>Best of luck!</p>
                  
            <h4>'.$site_name.' Team</h4>
            </div>
                </div>
                
                

              </td>
            </tr>
            
        <br>

<tr>
              <td style="padding:30px;text-align:center;font-size:12px;background-color:#404040;color:#cccccc;">
                <p style="margin:0 0 8px 0;"><a href="http://www.facebook.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/facebook_1.png" width="40" height="40" alt="f" style="display:inline-block;color:#cccccc;"></a> <a href="http://www.twitter.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/twitter_1.png" width="40" height="40" alt="t" style="display:inline-block;color:#cccccc;"></a></p>
                <p style="margin:0;font-size:14px;line-height:20px;"><b>Legal:</b> This email message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please delete it from your computer. '.$site_name.', does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is acepted by '.$site_name.' in this regard and the recipient should carry out such virus and other checks as it considers appropriate. <br><br><a class="unsub" href="#" style="color:#cccccc;text-decoration:underline;"><b>&copy; '.$site_name.' 2022 </b></a></p>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
  </div>
</body>
</html>

 ';
 // Sending email
if(mail($to, $subject, $emailmsg, $headers)){
       
			$error = '<div class="alert alert-success" role="alert"><b>Success!</b> a link for password reset has been sent to your email address.</div>';
		}
    
}
    
}


?>