1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
-
- // Saving score. Score is verhouding van remaining ammo tov initieel ammo.
- // Vast gelopen, game draait goed, niet meer gelukt om werkend scoreboard te maken
-
-
- session_start();
-
-
-
- if ($_SESSION['difficulty'] == 'Easy'){
- $db = new SQLite3 ("scores.db");
- $username = $_POST['username'];
- $score = ($_POST['ammo'] / 30) * 100;
- $stmt = $db->prepare("INSERT INTO scores (username, score) VALUES (:usrn, :scr)");
- $stmt->bindValue(":usrn", $username, SQLITE3_TEXT);
- $stmt->bindValue(":scr", $email, SQLITE3_TEXT);
- $stmt->execute();
-
- }
-
- if ($_SESSION['difficulty'] == 'Normal'){
- $db = new SQLite3 ("scores.db");
- $username = $_POST['username'];
- $score = ($_POST['ammo'] / 24) * 100;
- $stmt = $db->prepare("INSERT INTO scores (username, score) VALUES (:usrn, :scr)");
- $stmt->bindValue(":usrn", $username, SQLITE3_TEXT);
- $stmt->bindValue(":scr", $email, SQLITE3_TEXT);
- $stmt->execute();
-
- }
-
- if ($_SESSION['difficulty'] == 'Hard'){
- $db = new SQLite3 ("scores.db");
- $username = $_POST['username'];
- $score = ($_POST['ammo'] / 16) * 100;
- $stmt = $db->prepare("INSERT INTO scores (username, score) VALUES (:usrn, :scr)");
- $stmt->bindValue(":usrn", $username, SQLITE3_TEXT);
- $stmt->bindValue(":scr", $email, SQLITE3_TEXT);
- $stmt->execute();
-
- }
-
-
-
-
- ?>
|