Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
-> Snow UPDATE
-> Fixed tickets bug
-> Updated register to show the eror
-> Fixed the mysql connection alr close
-> And bug fixes
  • Loading branch information
NaysKutzu committed Dec 9, 2023
1 parent fb1219b commit 1730833
Show file tree
Hide file tree
Showing 34 changed files with 250 additions and 23 deletions.
1 change: 1 addition & 0 deletions migrate/47.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `mythicaldash_settings` ADD `show_snow` ENUM('true','false') NOT NULL DEFAULT 'true' AFTER `maintenance`;
1 change: 1 addition & 0 deletions migrate/48.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UPDATE `mythicaldash_settings` SET `version` = '3.1.1' WHERE `mythicaldash_settings`.`id` = 1;
10 changes: 9 additions & 1 deletion view/admin/settings/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@
if (isset($_GET['update_settings'])) {
$name = mysqli_real_escape_string($conn, $_GET['app:name']);
$logo = mysqli_real_escape_string($conn, $_GET['app:logo']);
$snow = mysqli_real_escape_string($conn, $_GET['app:snow']);

mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `name` = '" . $name . "' WHERE `mythicaldash_settings`.`id` = 1;");
mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `logo` = '" . $logo . "' WHERE `mythicaldash_settings`.`id` = 1;");
header('location: /admin/settings?s=We updated the settings inside the database');
mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `show_snow` = '" . $snow . "' WHERE `mythicaldash_settings`.`id` = 1;");

if ($snow == "false") {
header('location: /admin/settings?e=Well it looks like you are grinch!');
} else {
header('location: /admin/settings?s=We updated the settings inside the database');
}
$conn->close();
die();
} else {
Expand Down
25 changes: 24 additions & 1 deletion view/admin/settings/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<div class="card-body">
<form action="/admin/settings/general" method="GET">
<div class="row">
<div class="mb-3 col-md-6">
<div class="mb-3 col-md-4">
<label for="app:name" class="form-label">Company Name</label>
<input class="form-control" type="text" id="app:name" name="app:name"
value="<?= SettingsManager::getSetting("name") ?>"
Expand All @@ -53,6 +53,29 @@
<input class="form-control" type="text" id="app:logo" name="app:logo"
value="<?= SettingsManager::getSetting("logo") ?>" autofocus="">
</div>
<div class="form-group col-md-2">
<label class="control-label">Snow</label>
<div>
<?php
if (SettingsManager::getSetting("show_snow") == 'true') {
?>
<select class="form-control" name="app:snow">
<option value="true">Enabled</option>
<option value="false">Disabled</option>
</select>
<?php
} else {
?>
<select class="form-control" name="app:snow">
<option value="false">Disabled</option>
<option value="true">Enabled</option>
</select>
<?php
}
?>

</div>
</div>
</div>
<div class="mt-2 text-center">
<button type="submit" name="update_settings"
Expand Down
9 changes: 7 additions & 2 deletions view/auth/forgot-password.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
$mail->Body = $message;
try {
$mail->send();
$conn->query("INSERT INTO `mythicaldash_resetpasswords` (`email`, `ownerkey`, `resetkeycode`, `ip_addres`) VALUES ('" . mysqli_real_escape_string($conn,$email) . "', '" . mysqli_real_escape_string($conn,$userdb['api_key']) . "', '" . mysqli_real_escape_string($conn, $skey) . "', '" . mysqli_real_escape_string($conn, $session->getIP()) . "');");
$conn->query("INSERT INTO `mythicaldash_resetpasswords` (`email`, `ownerkey`, `resetkeycode`, `ip_addres`) VALUES ('" . mysqli_real_escape_string($conn, $email) . "', '" . mysqli_real_escape_string($conn, $userdb['api_key']) . "', '" . mysqli_real_escape_string($conn, $skey) . "', '" . mysqli_real_escape_string($conn, $session->getIP()) . "');");
$domain = substr(strrchr($email, "@"), 1);
$redirections = array('gmail.com' => 'https://mail.google.com', 'yahoo.com' => 'https://mail.yahoo.com', 'hotmail.com' => 'https://outlook.live.com', 'outlook.com' => "https://outlook.live.com", 'gmx.net' => "https://gmx.net", 'icloud.com' => "https://www.icloud.com/mail", 'me.com' => "https://www.icloud.com/mail", 'mac.com' => "https://www.icloud.com/mail", );
if (isset($redirections[$domain])) {
Expand Down Expand Up @@ -243,7 +243,7 @@
die();
}
}
} catch (Exception $e) {
} catch (Exception $e) {
header("location: /auth/forgot-password?e=An unexpected error occurred!");
ErrorHandler::Error("Forgot-Password ", $e);
die();
Expand All @@ -264,6 +264,11 @@
</head>

<body>
<?php
if (SettingsManager::getSetting("show_snow") == "true") {
include(__DIR__ . '/../components/snow.php');
}
?>
<div id="preloader" class="discord-preloader">
<div class="spinner"></div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions view/auth/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
</head>

<body>
<?php
if (SettingsManager::getSetting("show_snow") == "true") {
include(__DIR__ . '/../components/snow.php');
}
?>
<div id="preloader" class="discord-preloader">
<div class="spinner"></div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion view/auth/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
die();
}
} else {
header("location: /auth/login?e=There was an error while signing up. Is our game panel down?");
header("location: /auth/login?e=We got error from panel: ".$error);
die();
}

Expand Down Expand Up @@ -267,6 +267,11 @@
</head>

<body>
<?php
if (SettingsManager::getSetting("show_snow") == "true") {
include(__DIR__ . '/../components/snow.php');
}
?>
<div id="preloader" class="discord-preloader">
<div class="spinner"></div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion view/auth/reset-password.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
$ucode = $conn->query("SELECT * FROM mythicaldash_resetpasswords WHERE `resetkeycode` = '" . $code . "'")->fetch_array();
$upassword = mysqli_real_escape_string($conn, $_GET['password']);
$password = password_hash($upassword, PASSWORD_BCRYPT);
$conn->query("UPDATE `mythicaldash_users` SET `password` = '" . mysqli_real_escape_string($conn,$password) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $ucode['ownerkey']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `password` = '" . mysqli_real_escape_string($conn, $password) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $ucode['ownerkey']) . "';");
$conn->query("DELETE FROM mythicaldash_resetpasswords WHERE `mythicaldash_resetpasswords`.`id` = " . mysqli_real_escape_string($conn, $ucode['id']) . "");
$user_info = $conn->query("SELECT * FROM mythicaldash_users WHERE api_key = '" . mysqli_real_escape_string($conn, $ucode['ownerkey']) . "'")->fetch_array();
$conn->close();
Expand Down Expand Up @@ -77,6 +77,11 @@
</head>

<body>
<?php
if (SettingsManager::getSetting("show_snow") == "true") {
include(__DIR__ . '/../components/snow.php');
}
?>
<div class="authentication-wrapper authentication-cover authentication-bg">
<div class="authentication-inner row">
<div class="d-none d-lg-flex col-lg-7 p-0">
Expand Down
7 changes: 7 additions & 0 deletions view/blank.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
use MythicalDash\SettingsManager;

include(__DIR__ . '/requirements/page.php');
?>
<!DOCTYPE html>
Expand All @@ -19,6 +20,12 @@
</head>

<body>
<?php
if (SettingsManager::getSetting("show_snow") == "true") {
include(__DIR__ . '/components/snow.php');
}
?>
</div>
<div id="preloader" class="discord-preloader">
<div class="spinner"></div>
</div>
Expand Down
48 changes: 48 additions & 0 deletions view/components/snow.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<style>
.snowflake {
color: #fff;
font-size: 1em;
font-family: Arial, sans-serif;
text-shadow: 0 0 5px #000;
}
.snowflake,.snowflake .inner{animation-iteration-count:infinite;animation-play-state:running}@keyframes snowflakes-fall{0%{transform:translateY(0)}100%{transform:translateY(110vh)}}@keyframes snowflakes-shake{0%,100%{transform:translateX(0)}50%{transform:translateX(80px)}}.snowflake{position:fixed;top:-10%;z-index:9999;-webkit-user-select:none;user-select:none;cursor:default;animation-name:snowflakes-shake;animation-duration:3s;animation-timing-function:ease-in-out}.snowflake .inner{animation-duration:10s;animation-name:snowflakes-fall;animation-timing-function:linear}.snowflake:nth-of-type(0){left:1%;animation-delay:0s}.snowflake:nth-of-type(0) .inner{animation-delay:0s}.snowflake:first-of-type{left:10%;animation-delay:1s}.snowflake:first-of-type .inner,.snowflake:nth-of-type(8) .inner{animation-delay:1s}.snowflake:nth-of-type(2){left:20%;animation-delay:.5s}.snowflake:nth-of-type(2) .inner,.snowflake:nth-of-type(6) .inner{animation-delay:6s}.snowflake:nth-of-type(3){left:30%;animation-delay:2s}.snowflake:nth-of-type(11) .inner,.snowflake:nth-of-type(3) .inner{animation-delay:4s}.snowflake:nth-of-type(4){left:40%;animation-delay:2s}.snowflake:nth-of-type(10) .inner,.snowflake:nth-of-type(4) .inner{animation-delay:2s}.snowflake:nth-of-type(5){left:50%;animation-delay:3s}.snowflake:nth-of-type(5) .inner{animation-delay:8s}.snowflake:nth-of-type(6){left:60%;animation-delay:2s}.snowflake:nth-of-type(7){left:70%;animation-delay:1s}.snowflake:nth-of-type(7) .inner{animation-delay:2.5s}.snowflake:nth-of-type(8){left:80%;animation-delay:0s}.snowflake:nth-of-type(9){left:90%;animation-delay:1.5s}.snowflake:nth-of-type(9) .inner{animation-delay:3s}.snowflake:nth-of-type(10){left:25%;animation-delay:0s}.snowflake:nth-of-type(11){left:65%;animation-delay:2.5s}
</style>
<div class="snowflakes" aria-hidden="true">
<div class="snowflake">
<div class="inner">❅</div>
</div>
<div class="snowflake">
<div class="inner">❅</div>
</div>
<div class="snowflake">
<div class="inner">❅</div>
</div>
<div class="snowflake">
<div class="inner">❅</div>
</div>
<div class="snowflake">
<div class="inner">❅</div>
</div>
<div class="snowflake">
<div class="inner">❅</div>
</div>
<div class="snowflake">
<div class="inner">❅</div>
</div>
<div class="snowflake">
<div class="inner">❅</div>
</div>
<div class="snowflake">
<div class="inner">❅</div>
</div>
<div class="snowflake">
<div class="inner">❅</div>
</div>
<div class="snowflake">
<div class="inner">❅</div>
</div>
<div class="snowflake">
<div class="inner">❅</div>
</div>
</div>
5 changes: 5 additions & 0 deletions view/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
</head>

<body>
<?php
if (SettingsManager::getSetting("show_snow") == "true") {
include(__DIR__ . '/components/snow.php');
}
?>
<div id="preloader" class="discord-preloader">
<div class="spinner"></div>
</div>
Expand Down
14 changes: 10 additions & 4 deletions view/earn/afk.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
use MythicalDash\ErrorHandler;
use MythicalDash\SettingsManager;

include(__DIR__ . '/../requirements/page.php');
if (SettingsManager::getSetting("enable_afk") == "false") {
header('location: /');
Expand All @@ -27,14 +28,14 @@ function minutesToSeconds($minutes)
$data1 = $coins + SettingsManager::getSetting("afk_coins_per_min");
$data2 = $idlemins + SettingsManager::getSetting("afk_min");
try {
$conn->query("UPDATE `mythicaldash_users` SET `coins` = '".mysqli_real_escape_string($conn,$data1)."' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `minutes_afk` = '".mysqli_real_escape_string($conn,$data2)."' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `last_seen` = '".mysqli_real_escape_string($conn,$currenttimestamp)."' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `coins` = '" . mysqli_real_escape_string($conn, $data1) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `minutes_afk` = '" . mysqli_real_escape_string($conn, $data2) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `last_seen` = '" . mysqli_real_escape_string($conn, $currenttimestamp) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
echo '<script>window.location.replace("/earn/afk");</script>';
} catch (Exception $e) {
header('location: /earn/afk?Failed to update your coins due to some db error');
$conn->close();
ErrorHandler::Critical("Failed to update coins ",$e);
ErrorHandler::Critical("Failed to update coins ", $e);
die();
}
} else {
Expand Down Expand Up @@ -69,6 +70,11 @@ function minutesToSeconds($minutes)
</head>

<body>
<?php
if (SettingsManager::getSetting("show_snow") == "true") {
include(__DIR__ . '/../components/snow.php');
}
?>
<div id="preloader" class="discord-preloader">
<div class="spinner"></div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions view/earn/linkvertise.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@
</head>

<body>
<?php
if (SettingsManager::getSetting("show_snow") == "true") {
include(__DIR__ . '/../components/snow.php');
}
?>
<div class="flex-container">
<div class="text-center">
<h1>
Expand Down
25 changes: 15 additions & 10 deletions view/earn/redeem.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
$newports = $session->getUserInfo("ports") + $redeemdb['ports'];
$newdatabases = $session->getUserInfo("databases") + $redeemdb['databases'];
$newbackups = $session->getUserInfo("backups") + $redeemdb['backups'];
$conn->query("UPDATE `mythicaldash_users` SET `coins` = '" . mysqli_real_escape_string($conn,$newcoins) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `ram` = '" . mysqli_real_escape_string($conn,$newram) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `disk` = '" . mysqli_real_escape_string($conn,$newdisk) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `cpu` = '" . mysqli_real_escape_string($conn,$newcpu) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `server_limit` = '" . mysqli_real_escape_string($conn,$new_server_limit) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `ports` = '" . mysqli_real_escape_string($conn,$newports) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `databases` = '" . mysqli_real_escape_string($conn,$newdatabases) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `backups` = '" . mysqli_real_escape_string($conn,$newbackups) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `coins` = '" . mysqli_real_escape_string($conn, $newcoins) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `ram` = '" . mysqli_real_escape_string($conn, $newram) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `disk` = '" . mysqli_real_escape_string($conn, $newdisk) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `cpu` = '" . mysqli_real_escape_string($conn, $newcpu) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `server_limit` = '" . mysqli_real_escape_string($conn, $new_server_limit) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `ports` = '" . mysqli_real_escape_string($conn, $newports) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `databases` = '" . mysqli_real_escape_string($conn, $newdatabases) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
$conn->query("UPDATE `mythicaldash_users` SET `backups` = '" . mysqli_real_escape_string($conn, $newbackups) . "' WHERE `mythicaldash_users`.`api_key` = '" . mysqli_real_escape_string($conn, $_COOKIE['token']) . "';");
if ($redeemdb['uses'] > 1) {
$newuses = $redeemdb['uses'] - 1;
$conn->query("UPDATE `mythicaldash_redeem` SET `uses` = '" . mysqli_real_escape_string($conn,$newuses) . "' WHERE `mythicaldash_redeem`.`code` = '" . mysqli_real_escape_string($conn,$code) . "';");
$conn->query("UPDATE `mythicaldash_redeem` SET `uses` = '" . mysqli_real_escape_string($conn, $newuses) . "' WHERE `mythicaldash_redeem`.`code` = '" . mysqli_real_escape_string($conn, $code) . "';");
} else {
$conn->query("DELETE FROM mythicaldash_redeem WHERE `mythicaldash_redeem`.`code` = '" . mysqli_real_escape_string($conn,$code) . "'");
$conn->query("DELETE FROM mythicaldash_redeem WHERE `mythicaldash_redeem`.`code` = '" . mysqli_real_escape_string($conn, $code) . "'");
}
header('location: /earn/redeem?s=We updated your resources!');
} else {
Expand All @@ -58,6 +58,11 @@
</head>

<body>
<?php
if (SettingsManager::getSetting("show_snow") == "true") {
include(__DIR__ . '/../components/snow.php');
}
?>
<div id="preloader" class="discord-preloader">
<div class="spinner"></div>
</div>
Expand Down
Loading

0 comments on commit 1730833

Please sign in to comment.