<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);
$admin = $_SESSION["admin_" . $dbname];

if (isset($_REQUEST['user'])) {
    $link       = "mhajiadam.com";
    $to         = $_REQUEST['email'];
    $username   = $_REQUEST['user'];
    $password   = $_REQUEST['pass'];
    $subject    = "Mail From Mohammed Haji Adam";
    
    $headers  = "From: Mohammed Haji Adam Wholesale (L.L.P.)  \r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
    
    $message = "<html>";
    $message .="<body>";
    $message .= "<h1>Mohammed Haji Adam Wholesale (L.L.P.)</h1>";
    $message .= "<table style='width: 50%;border: 1px solid;'>";
    $message .= "<tr style='background-color: #1ABC9C; color: #ffffff;'>";
    $message .= "<th>Username</th>";
    $message .= "<th>Password</th>";
    $message .= "<th>Link</th>";
    $message .= "</tr>";
    $message .= "<tr>";
    $message .= "<td>$username</td>";
    $message .= "<td>$password</td>";
    $message .= "<td>$link</td>";
    $message .= "</tr>";
    $message .= "</table>";
    $message .= "</body>";
    $message .= "</html>";

    
    
    if(mail($to, $subject, $message, $headers)){
        Echo "success";
    }
}
?>
