top 10
This commit is contained in:
14
publish.php
Normal file
14
publish.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include "db_connect.php";
|
||||
if (isset($_POST['player']) && isset($_POST['score'])) {
|
||||
try {
|
||||
$db = new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME;charset=utf8", $DB_USER, $DB_PASSWORD);
|
||||
} catch (Exception $e) {
|
||||
die('Erreur : ' . $e->getMessage());
|
||||
}
|
||||
$query = $db->prepare('INSERT INTO `leaderboard` (`player`, `score`) VALUES (:player, :score);');
|
||||
$query->execute(array("player" => strip_tags($_POST['player']), "score" => (int) $_POST['score']));
|
||||
} else {
|
||||
header($_SERVER["SERVER_PROTOCOL"] . " 405 Method Not Allowed", true, 405);
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user