Updated code to use config.cfg file instead of hard coded data

This commit is contained in:
Docker VM 2024-07-01 00:44:23 -04:00
parent 6fb915786d
commit 9ed9723697
41 changed files with 77 additions and 22 deletions

2
.gitignore vendored Normal file → Executable file
View File

@ -1 +1 @@
/config.php
/config.cfg

0
boss_images/blue.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

0
boss_images/bluedrac.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

0
boss_images/blueking.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

0
boss_images/bluerobo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

0
boss_images/bluespin.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

0
boss_images/bluewing.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

0
boss_images/krak.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

0
boss_images/krakdrac.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

0
boss_images/krakking.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

0
boss_images/krakrobo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

0
boss_images/krakspin.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

0
boss_images/krakwing.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

0
boss_images/raam.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

0
boss_images/raamdrac.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

0
boss_images/raamking.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

0
boss_images/raamrobo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

0
boss_images/raamspin.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

0
boss_images/raamwing.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

0
boss_images/skul.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

0
boss_images/skuldrac.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

0
boss_images/skulking.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

0
boss_images/skulrobo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

0
boss_images/skulspin.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

0
boss_images/skulwing.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

0
boss_images/turr.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

0
boss_images/turrdrac.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

0
boss_images/turrking.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

0
boss_images/turrrobo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

0
boss_images/turrspin.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

0
boss_images/turrwing.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -1,12 +1,12 @@
<!DOCTYPE html>
<body>
<a href="ddd_scores.php?mode=DX">
<img src="/ddddxhs_files/top100dx.png" alt="Top 100 DX Mode">
<img src="ddddxhs_files/top100dx.png" alt="Top 100 DX Mode">
</a>
<br>
<br>
<a href="ddd_scores.php?mode=EX">
<img src="/ddddxhs_files/top100ex.png" alt="Top 100 EX Mode">
<img src="ddddxhs_files/top100ex.png" alt="Top 100 EX Mode">
</a>
<br>
<br>

View File

@ -1,14 +1,20 @@
<?php
echo file_get_contents("ddd_source.html");
include('/var/config/mysqlconnect.php');
// Load the configuration file
$configFilePath = 'config.cfg';
$config = parse_ini_file($configFilePath, true);
// Include the MySQL connection script from the config file
include($config['mysql']['mysqlconnect_path']);
$mode = $_REQUEST['mode'];
if ($mode == "DX") {
echo "<img src='/ddddxhs_files/top100dx.png' alt='Top 100 DX Mode'>";
echo "<img src='ddddxhs_files/top100dx.png' alt='Top 100 DX Mode'>";
$query = "SELECT * FROM ddd_db.scores WHERE ddd_db.scores.Mode = 'DX' ORDER BY ddd_db.scores.Score DESC LIMIT 100";
} elseif ($mode == "EX") {
echo "<img src='/ddddxhs_files/top100ex.png' alt='Top 100 EX Mode'>";
echo "<img src='ddddxhs_files/top100ex.png' alt='Top 100 EX Mode'>";
$query = "SELECT * FROM ddd_db.scores WHERE ddd_db.scores.Mode = 'EX' ORDER BY ddd_db.scores.Score DESC LIMIT 100";
}
?>
@ -42,14 +48,13 @@ if ($result->num_rows > 0) {
$bossImage = trim(strtolower($boss)) . ".png";
if($bossImage != ".png"){
echo "<div class='bossImageWrapper'>";
echo "<img id='boss_image' src='/boss_images/" . $bossImage . "' alt='" . $boss . "' title='" . $boss . "'>";
echo "<img id='boss_image' src='boss_images/" . $bossImage . "' alt='" . $boss . "' title='" . $boss . "'>";
echo "<div class='bossLabel'>" . $boss . "</div>";
echo "</div>";
}
}
echo "</div>";
}
@ -68,4 +73,4 @@ $conn->close();
?>
<br>
<a class='ddd' href='/ddd_index.php'>Back</a>
<a class='ddd' href='ddd_index.php'>Back</a>

View File

@ -1,11 +1,11 @@
<!DOCTYPE html>
<head>
<link type="text/css" rel="stylesheet" href="./ddddxhs_files/ddd.css">
<link rel="stylesheet" type="text/css" href="./ddddxhs_files/banner-styles.css">
<link type="text/css" rel="stylesheet" href="ddddxhs_files/ddd.css">
<!-- <link rel="stylesheet" type="text/css" href="ddddxhs_files/banner-styles.css"> -->
</head>
<center>
<a href="./index.php">
<img src="/ddddxhs_files/title.png" alt="DASH-DA-DASH DX" title="DASH-DA-DASH DX">
<a href="index.php">
<img src="ddddxhs_files/title.png" alt="DASH-DA-DASH DX" title="DASH-DA-DASH DX">
</a>
<br>
<br>

0
ddddxhs_files/DASH-DA-DASH DX (2023 Fan Patch).exe Normal file → Executable file
View File

0
ddddxhs_files/DASH-DA-DASH DX (2023 Fan Patch).mfa Normal file → Executable file
View File

View File

@ -85,10 +85,14 @@ a img {
.even {
background-color: rgba(0, 0, 0, 0.9);
border: 1px solid white;
border-radius: 10px; /* Adjust the value to get the desired roundness */
}
.odd {
background-color: rgba(26, 26, 26, 0.9);
border: 1px solid white;
border-radius: 10px; /* Adjust the value to get the desired roundness */
}
.scoreEntry #player,

13
example.config.cfg Executable file
View File

@ -0,0 +1,13 @@
[mysql]
mysqlconnect_path="/var/config/mysqlconnect.php"
host="localhost"
username="user"
database="database"
password="password"
#To use this file, run the following
# cp example.config.cfg config.cfg
# mkdir /var/config
# cp example.mysqlconnect.php
# Change the password, do not remove the quotes
# Access the admin page at yourwebsite.com/update_db.php

27
example.mysqlconnect.php Executable file
View File

@ -0,0 +1,27 @@
<?php
// Load the configuration file
$configFilePath = 'config.cfg';
$config = parse_ini_file($configFilePath, true);
// Check if the mysql section exists in the config file
if (!isset($config['mysql'])) {
die('MySQL configuration not found in config.cfg');
}
// Extract MySQL connection parameters from the config file
$host = $config['mysql']['host'];
$username = $config['mysql']['username'];
$password = $config['mysql']['password'];
$database = $config['mysql']['database'];
// Create a connection
$conn = new mysqli($host, $username, $password, $database);
// Check the connection
if ($conn->connect_error) {
die('Connection failed: ' . $conn->connect_error);
}
// Optionally, close the connection when done
// $conn->close();
?>

View File

@ -3,13 +3,13 @@
<center>
<br><br><br><br>
<ol class='scoreList'>
<a href='/ddddxhs_files/DASH-DA-DASH DX (2023 Fan Patch).exe'>
<img src="/ddddxhs_files/download.png" alt="DOWNLOAD DASH-DA-DASH DX" title="DOWNLOAD DASH-DA-DASH DX">
<a href='ddddxhs_files/DASH-DA-DASH DX (2023 Fan Patch).exe'>
<img src="ddddxhs_files/download.png" alt="DOWNLOAD DASH-DA-DASH DX" title="DOWNLOAD DASH-DA-DASH DX">
</a>
<br>
<br>
<br>
<img class='center' src="/ddddxhs_files/features.png" alt="FEATURES DASH-DA-DASH DX" title="FEATURES DASH-DA-DASH DX">
<img class='center' src="ddddxhs_files/features.png" alt="FEATURES DASH-DA-DASH DX" title="FEATURES DASH-DA-DASH DX">
<br>
<br>
<br>
@ -21,8 +21,8 @@ Welcome to the fan made Dash Da Dash DX High Score Board
I created this homage as a way for my friends and I to post our high scores to an online leaderboard like back in the day.
</li>
<br>
<a href='/ddd_index.php'>
<img src="/ddddxhs_files/code.png" alt="CODE DASH-DA-DASH DX" title="CODE DASH-DA-DASH DX">
<a href='ddd_index.php'>
<img src="ddddxhs_files/code.png" alt="CODE DASH-DA-DASH DX" title="CODE DASH-DA-DASH DX">
</a>
<br><br>
<li class='even ddd' id='player'>
@ -42,7 +42,7 @@ Credits
<br>
<a href='https://web.archive.org/web/20120615011611if_/http://renard.teknolust.org/ddd/dddxv12install.exe'>Version 1.12 from WabyBackMachine Archive</a>
<br>
<a href='/ddddxhs_files/DASH-DA-DASH DX (2023 Fan Patch).mfa'>2023 Fan Patch .mfa Source File for Clickteam Fusion 2.5</a>
<a href='ddddxhs_files/DASH-DA-DASH DX (2023 Fan Patch).mfa'>2023 Fan Patch .mfa Source File for Clickteam Fusion 2.5</a>
</li>
</ol>
<br>

View File

@ -1,8 +1,14 @@
<?php
echo file_get_contents("ddd_source.html");
include('/var/config/mysqlconnect.php');
$b64 = $_POST["gamePass"];
// Load the configuration file
$configFilePath = 'config.cfg';
$config = parse_ini_file($configFilePath, true);
// Include the MySQL connection script from the config file
include($config['mysql']['mysqlconnect_path']);
$b64 = $_POST["gamePass"];
$decode = base64_decode($b64, true);
$dataArr = explode("|", $decode);
$name = $dataArr[0];
@ -33,4 +39,4 @@ $stmt->close();
$conn->close();
?>
<br>
<a class='ddd' href='/ddd_index.php'>Back</a>
<a class='ddd' href='ddd_index.php'>Back</a>