+
trackmania-records
+
+No records have been uploaded yet...";
+ }
+?>
+
+
Upload instructions
+
+
To upload your Trackmania 2020 records to this page, follow these instructions:
+
+
+ - Download Python 3 from python.org and install it: https://www.python.org/downloads/
+ - Open a shell/terminal window (cmd.exe or PowerShell)
+ - Install the upload tool by executing this command:
+ pip3 install --upgrade upload-tm-records
+ - Now you can always run the following command to upload your latest records to this server:
+ upload-tm-records.exe
+
+
+
+
+
trackmania-records is opensource: github.com/rsnitsch/trackmania-records
+
+
\ No newline at end of file
diff --git a/server/html/style.css b/server/html/style.css
new file mode 100644
index 0000000..26a177a
--- /dev/null
+++ b/server/html/style.css
@@ -0,0 +1,39 @@
+tr.whiteTracks td:first-child {
+ background: linear-gradient(90deg, white 3px, transparent 3px);
+}
+
+tr.whiteTracks td:last-child {
+ background: linear-gradient(270deg, white 3px, transparent 3px);
+}
+
+tr.greenTracks td:first-child {
+ background: linear-gradient(90deg, green 3px, transparent 3px);
+}
+
+tr.greenTracks td:last-child {
+ background: linear-gradient(270deg, green 3px, transparent 3px);
+}
+
+tr.blueTracks td:first-child {
+ background: linear-gradient(90deg, blue 3px, transparent 3px);
+}
+
+tr.blueTracks td:last-child {
+ background: linear-gradient(270deg, blue 3px, transparent 3px);
+}
+
+tr.redTracks td:first-child {
+ background: linear-gradient(90deg, red 3px, transparent 3px);
+}
+
+tr.redTracks td:last-child {
+ background: linear-gradient(270deg, red 3px, transparent 3px);
+}
+
+tr.blackTracks td:first-child {
+ background: linear-gradient(90deg, black 3px, transparent 3px);
+}
+
+tr.blackTracks td:last-child {
+ background: linear-gradient(270deg, black 3px, transparent 3px);
+}
\ No newline at end of file
diff --git a/server/html/upload.php b/server/html/upload.php
index e9aae6d..811b6f1 100644
--- a/server/html/upload.php
+++ b/server/html/upload.php
@@ -1,68 +1,69 @@
-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-
- $commands = ['CREATE TABLE IF NOT EXISTS records (
- game TEXT NOT NULL,
- user TEXT NOT NULL,
- track TEXT NOT NULL,
- best INTEGER NOT NULL,
- PRIMARY KEY (game, user, track)
- )'];
-
- foreach ($commands as $command) {
- $pdo->exec($command);
- }
-
- foreach ($records as $record) {
- //print_r($record);
-
- $user = $record['user'];
- $track = $record['track'];
- $best = intval($record['best']);
-
- // Delete previous record.
- $st = $pdo->prepare('DELETE FROM records WHERE user = :user AND track = :track');
- $st->bindParam(':user', $user, PDO::PARAM_STR);
- $st->bindParam(':track', $track, PDO::PARAM_STR);
- $st->execute();
-
- // Add new record.
- $st = $pdo->prepare("INSERT INTO records (game, user, track, best) VALUES ('Trackmania 2020', :user, :track, :best)");
- $st->bindParam(':user', $user, PDO::PARAM_STR);
- $st->bindParam(':track', $track, PDO::PARAM_STR);
- $st->bindParam(':best', $best, PDO::PARAM_INT);
- $st->execute();
- }
-
- echo "Success!";
- } catch (PDOException $e) {
- echo 'Database error: '.$e->getMessage();
- }
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+ $commands = ['CREATE TABLE IF NOT EXISTS records (
+ game TEXT NOT NULL,
+ user TEXT NOT NULL,
+ track TEXT NOT NULL,
+ best INTEGER NOT NULL,
+ PRIMARY KEY (game, user, track)
+ )'];
+
+ foreach ($commands as $command) {
+ $pdo->exec($command);
+ }
+
+ foreach ($records as $record) {
+ //print_r($record);
+
+ $user = $record['user'];
+ $track = $record['track'];
+ $best = intval($record['best']);
+
+ // Delete previous record.
+ $st = $pdo->prepare('DELETE FROM records WHERE user = :user AND track = :track');
+ $st->bindParam(':user', $user, PDO::PARAM_STR);
+ $st->bindParam(':track', $track, PDO::PARAM_STR);
+ $st->execute();
+
+ // Add new record.
+ $st = $pdo->prepare("INSERT INTO records (game, user, track, best) VALUES ('Trackmania 2020', :user, :track, :best)");
+ $st->bindParam(':user', $user, PDO::PARAM_STR);
+ $st->bindParam(':track', $track, PDO::PARAM_STR);
+ $st->bindParam(':best', $best, PDO::PARAM_INT);
+ $st->execute();
+ }
+
+ echo "Success!";
+ } catch (PDOException $e) {
+ http_response_code(500);
+ die('Database error: '.$e->getMessage());
+ }