Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
-> Now settings work?
  • Loading branch information
NaysKutzu committed Nov 18, 2023
1 parent d4a3d36 commit 1978764
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 50 deletions.
8 changes: 3 additions & 5 deletions view/admin/settings/ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@
if (isset($_GET['update_settings'])) {
$enable_ads = mysqli_real_escape_string($conn, $_GET['ads:enabled']);
$ads_code = mysqli_real_escape_string($conn, $_GET['ads:code']);
$enable_adblocker_detection = mysqli_real_escape_string($conn, $_GET['ads:adblocker']);
mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `enable_ads` = '" . $enable_ads . "' WHERE `mythicaldash_settings`.`id` = 1;");
mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `enable_ads` = '" . $enable_ads . "' WHERE `mythicaldash_settings`.`id` = 1;");
mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `enable_adblocker_detection` = '" . $enable_adblocker_detection . "' WHERE `mythicaldash_settings`.`id` = 1;");
mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `ads_code` = '" . $ads_code . "' WHERE `mythicaldash_settings`.`id` = 1;");
header('location: /admin/settings?s=We updated the settings inside the database');
$conn->close();
die();
} else {
header('location: /admin/settings');
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
Expand Down
4 changes: 2 additions & 2 deletions view/admin/settings/customcss.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
$conn->close();
die();
} else {
header('location: /admin/settings');
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
Expand Down
4 changes: 2 additions & 2 deletions view/admin/settings/customhead.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
$conn->close();
die();
} else {
header('location: /admin/settings');
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
Expand Down
6 changes: 3 additions & 3 deletions view/admin/settings/discord.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
$conn->close();
die ();
} else {
header('location: /admin/settings');
die ();
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
}
Expand Down
4 changes: 2 additions & 2 deletions view/admin/settings/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
$conn->close();
die();
} else {
header('location: /admin/settings');
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
Expand Down
6 changes: 3 additions & 3 deletions view/admin/settings/linkvertise.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
$conn->close();
die ();
} else {
header('location: /admin/settings');
die ();
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
}
Expand Down
6 changes: 3 additions & 3 deletions view/admin/settings/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
$conn->close();
die ();
} else {
header('location: /admin/settings');
die ();
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
}
Expand Down
6 changes: 3 additions & 3 deletions view/admin/settings/pp.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
$conn->close();
die ();
} else {
header('location: /admin/settings');
die ();
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
}
Expand Down
6 changes: 3 additions & 3 deletions view/admin/settings/pterodactyl.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
$conn->close();
die ();
} else {
header('location: /admin/settings');
die ();
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
}
Expand Down
4 changes: 2 additions & 2 deletions view/admin/settings/purge.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
header('location: /admin/settings?s=We updated the settings inside the database');
die();
} else {
header('location: /admin/settings');
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
Expand Down
6 changes: 3 additions & 3 deletions view/admin/settings/recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
$conn->close();
die ();
} else {
header('location: /admin/settings');
die ();
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
}
Expand Down
6 changes: 3 additions & 3 deletions view/admin/settings/resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
$conn->close();
die ();
} else {
header('location: /admin/settings');
die ();
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
}
Expand Down
2 changes: 1 addition & 1 deletion view/admin/settings/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
Expand Down
6 changes: 3 additions & 3 deletions view/admin/settings/seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
$conn->close();
die ();
} else {
header('location: /admin/settings');
die ();
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
}
Expand Down
6 changes: 3 additions & 3 deletions view/admin/settings/store.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
$conn->close();
die ();
} else {
header('location: /admin/settings');
die ();
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
}
Expand Down
6 changes: 3 additions & 3 deletions view/admin/settings/stripe.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
$conn->close();
die ();
} else {
header('location: /admin/settings');
die ();
header('location: /admin/settings?e=Failed to update the settings inside the database');
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ",$ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
}
Expand Down
13 changes: 7 additions & 6 deletions view/admin/settings/tos.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<?php
use MythicalDash\ErrorHandler;
include (__DIR__ . '/../../requirements/page.php');
include (__DIR__ . '/../../requirements/admin.php');

include(__DIR__ . '/../../requirements/page.php');
include(__DIR__ . '/../../requirements/admin.php');
try {
if (isset($_POST['update_settings'])) {
$text = mysqli_real_escape_string($conn, $_POST['text']);
mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `terms_of_service` = '" . $text . "' WHERE `mythicaldash_settings`.`id` = 1;");
header('location: /admin/settings?s=We updated the settings inside the database');
$conn->close();
die ();
die();
} else {
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
die();
}
} catch (Exception $ex) {
ErrorHandler::Critical("Failed to update settings ",$e);
ErrorHandler::Critical("Failed to update settings ", $ex);
header('location: /admin/settings?e=Failed to update the settings inside the database');
die ();
die();
}
?>

0 comments on commit 1978764

Please sign in to comment.