Add files via upload

This commit is contained in:
Charan-kumar123 2023-03-06 22:57:52 +05:30 committed by GitHub
parent 2f67e0fe4a
commit 125568e992
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 1111 additions and 0 deletions

20
savescore.php Normal file
View 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);
?>