Compare commits

...
4 changed files with 15 additions and 2 deletions

No files matched your search

+1
View File
@@ -31,6 +31,7 @@ if (!in_array($token, $validTokens)) {
errorMail(
"API Login failed",
$error,
true,
);
echo $error;
exit;
+1
View File
@@ -65,6 +65,7 @@ function db_connect() {
errorMail(
"Database Connection failed",
$e->getMessage(),
false,
);
redirectToWebsite("https://blackpi.ipv64.net");
throw $e;
+2 -1
View File
@@ -93,7 +93,8 @@ function logging() {
} catch (mysqli_sql_exception $e) {
errorMail(
"Logging failed",
$e->getMessage()
$e->getMessage(),
true,
);
throw $e;
}
+11 -1
View File
@@ -24,7 +24,7 @@ function sendMail($subject, $message, $url, bool $log) {
}
}
function errorMail($title, $error) {
function errorMail($title, $error, bool $log) {
$headers = "From: bruno.eckhardt07@gmail.com\r\n";
mail(
"bruno.eckhardt07@gmail.com",
@@ -32,4 +32,14 @@ function errorMail($title, $error) {
$error,
$headers,
);
if ($log == true) {
DatabaseInsert(
"Mailing",
"DATUM, SUBJECT, MESSAGE, URL, CLIENT_IP",
(new getSpecificData())->getRequestTime(),
"ERROR: $title",
$error,
(new getSpecificData())->getClientIP(),
);
}
}