X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/b65f04962537513f9195e7869cbd39eab1380440..b2ae16abfe70a6d119eead51bcfab033e27da869:/plugins/php_mailer/php_mailer.php diff --git a/plugins/php_mailer/php_mailer.php b/plugins/php_mailer/php_mailer.php index 226c7ee..f8a0d7f 100644 --- a/plugins/php_mailer/php_mailer.php +++ b/plugins/php_mailer/php_mailer.php @@ -57,8 +57,21 @@ class php_mailer self::send_mail( ["email" => EMAIL_SETTINGS['username'], "name" => EMAIL_SETTINGS['from_name']], "New login to Unreal Admin Panel", - "There was a new login to the admin panel.
User: \"$user->username\"
IP: \"".$_SERVER['REMOTE_ADDR']."\"" + "There was a new login to the admin panel.
User: \"$user->username\"
IP: \"".$_SERVER['REMOTE_ADDR']."\" (".$_SERVER['HTTP_CF_IPCOUNTRY'].")
". + "User Agent: ".$_SERVER['HTTP_USER_AGENT'] ); + + if ($user->email) + self::send_mail( + ["email" => $user->email, "name" => $user->first_name . " " . $user->last_name], + "New login to your account", + "Dear $user->first_name,

". + "There was a new login to account: \"$user->username\"

". + "Details:
". + "IP: ".$_SERVER['REMOTE_ADDR']." (".$_SERVER['HTTP_CF_IPCOUNTRY'].")
". + "User Agent: ".$_SERVER['HTTP_USER_AGENT']."

". + "If this was not you, please contact your Panel Administrator." + ); } public static function user_login_fail_notif($fail) { @@ -67,5 +80,17 @@ class php_mailer "Failed login attempt - Unreal Admin Panel", "There was a failed login attempt to the admin panel.
User: \"".$fail['login']."\"
IP: \"".$fail['IP']."\"" ); + $user = new PanelUser($fail['login']); + if ($user->email) + self::send_mail( + ["email" => $user->email, "name" => $user->first_name . " " . $user->last_name], + "Failed login attempt to your account", + "Dear $user->first_name,

". + "There was failed login attempt to your account: \"$user->username\"

". + "Details:
". + "IP: ".$_SERVER['REMOTE_ADDR']." (".$_SERVER['HTTP_CF_IPCOUNTRY'].")
". + "User Agent: ".$_SERVER['HTTP_USER_AGENT']."

". + "If this was not you, please contact your Panel Administrator." + ); } } \ No newline at end of file