diff options
author | arf20 <aruizfernandez05@gmail.com> | 2024-03-20 16:10:53 +0100 |
---|---|---|
committer | arf20 <aruizfernandez05@gmail.com> | 2024-03-20 16:10:53 +0100 |
commit | 89f8cb7b48e57be6e4ad85fe17cfebe73eb32653 (patch) | |
tree | 6615dc4214e7aa2b135340ec73c5468bc78f2431 /verify.php | |
parent | 68858da5d6166be880f1301f49807a2e52357288 (diff) | |
download | arfnet2-cstims-89f8cb7b48e57be6e4ad85fe17cfebe73eb32653.tar.gz arfnet2-cstims-89f8cb7b48e57be6e4ad85fe17cfebe73eb32653.zip |
Send notification emails
Diffstat (limited to 'verify.php')
-rw-r--r-- | verify.php | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -1,4 +1,25 @@ <?php + +function send_verify_notification($username) { + // send admin mail + $sql = "SELECT email FROM users WHERE type = 'admin'"; + $stmt = mysqli_prepare($link, $sql); + mysqli_stmt_execute($stmt); + $result = mysqli_stmt_get_result($stmt); + $admins = $result->fetch_all(MYSQLI_ASSOC); + + foreach ($admins as $admin) { + $mailer->addAddress($admin["email"]); + } + + $mailer->Subject = "New user registered"; + $mailer->Body = "Admins,\n\nUser $username verified." + ."\n\n--\nARFNET Client, Service, Ticket and Invoice Management System\nhttps://arf20.com"; + if (!$mailer->send()) { + echo 'Mailer Error [ask arf20]: ' . $mailer->ErrorInfo; + }; +} + // Initialize the session session_start(); @@ -54,6 +75,7 @@ if ($_SERVER["REQUEST_METHOD"] == "GET") { $param_id = $id; if (mysqli_stmt_execute($stmt) && mysqli_stmt_affected_rows($stmt) == 1) { $verification_success = true; + send_verify_notification($username); } else { echo "SQL error, ask arf20."; } |