您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. // Saving score. Score is verhouding van remaining ammo tov initieel ammo.
  3. // Vast gelopen, game draait goed, niet meer gelukt om werkend scoreboard te maken
  4. session_start();
  5. if ($_SESSION['difficulty'] == 'Easy'){
  6. $db = new SQLite3 ("scores.db");
  7. $username = $_POST['username'];
  8. $score = ($_POST['ammo'] / 30) * 100;
  9. $stmt = $db->prepare("INSERT INTO scores (username, score) VALUES (:usrn, :scr)");
  10. $stmt->bindValue(":usrn", $username, SQLITE3_TEXT);
  11. $stmt->bindValue(":scr", $email, SQLITE3_TEXT);
  12. $stmt->execute();
  13. }
  14. if ($_SESSION['difficulty'] == 'Normal'){
  15. $db = new SQLite3 ("scores.db");
  16. $username = $_POST['username'];
  17. $score = ($_POST['ammo'] / 24) * 100;
  18. $stmt = $db->prepare("INSERT INTO scores (username, score) VALUES (:usrn, :scr)");
  19. $stmt->bindValue(":usrn", $username, SQLITE3_TEXT);
  20. $stmt->bindValue(":scr", $email, SQLITE3_TEXT);
  21. $stmt->execute();
  22. }
  23. if ($_SESSION['difficulty'] == 'Hard'){
  24. $db = new SQLite3 ("scores.db");
  25. $username = $_POST['username'];
  26. $score = ($_POST['ammo'] / 16) * 100;
  27. $stmt = $db->prepare("INSERT INTO scores (username, score) VALUES (:usrn, :scr)");
  28. $stmt->bindValue(":usrn", $username, SQLITE3_TEXT);
  29. $stmt->bindValue(":scr", $email, SQLITE3_TEXT);
  30. $stmt->execute();
  31. }
  32. ?>