Add files via upload
This commit is contained in:
parent
2f67e0fe4a
commit
125568e992
8 changed files with 1111 additions and 0 deletions
20
savescore.php
Normal file
20
savescore.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
$conn = mysqli_connect("localhost", "root", "", "speedtest");
|
||||
$uid = $_GET['uid'];
|
||||
$score = $_GET['score'];
|
||||
$query = "SELECT * FROM `bestscores` WHERE `userid`=".$uid;
|
||||
$query = mysqli_query($conn, $query);
|
||||
if (mysqli_num_rows($query) > 0) {
|
||||
if (mysqli_fetch_array($query)['scores'] < $score ) {
|
||||
$query = "UPDATE `bestscores` SET `scores`=".$score." WHERE `userid`=".$uid;
|
||||
mysqli_query($conn, $query);
|
||||
}
|
||||
} else {
|
||||
$query = "INSERT INTO `bestscores` (`userid`, `scores`) VALUES (".$uid.", ".$score.")";
|
||||
mysqli_query($conn, $query);
|
||||
}
|
||||
echo "<script>
|
||||
window.location.replace('./main.php?id=".$uid."');
|
||||
</script>";
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue