Skip to content

Commit

Permalink
Fix smurf_ID typo
Browse files Browse the repository at this point in the history
  • Loading branch information
AsteroidusTv committed Jul 26, 2024
1 parent 061a311 commit f9c26ca
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/getComments.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@

$smurfsId = $db->escapeStrings($_POST['smurfsID']);

$comments = $db->select("SELECT * FROM gargameleaks_comments WHERE smurfs_ID = '$smurfsId'");
$comments = $db->select("SELECT * FROM gargameleaks_comments WHERE smurf_ID = '$smurfsId'");
print_r(json_encode($comments));
4 changes: 2 additions & 2 deletions api/getSmurfs.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function compareSmurfs($a, $b, $sort)
}

foreach ($smurfs as &$smurfs) {
$comments = $db->select("SELECT * FROM gargameleaks_comments WHERE smurfs_ID = '{$smurfs["ID"]}'");
$votesData = $db->select("SELECT * FROM gargameleaks_votes WHERE smurfs_ID = '{$smurfs["ID"]}'");
$comments = $db->select("SELECT * FROM gargameleaks_comments WHERE smurf_ID = '{$smurfs["ID"]}'");
$votesData = $db->select("SELECT * FROM gargameleaks_votes WHERE smurf_ID = '{$smurfs["ID"]}'");
$votesCount = count($votesData);

$intelligenceTotal = 0;
Expand Down
2 changes: 1 addition & 1 deletion api/newComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
exit();
}

$db->query("INSERT INTO gargameleaks_comments (smurfs_ID, IP, content) VALUES
$db->query("INSERT INTO gargameleaks_comments (smurf_ID, IP, content) VALUES
('$smurfsId', '$hashedIp', '$content')");
echo json_encode(array());

Expand Down
6 changes: 3 additions & 3 deletions api/newRating.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@
exit();
}

$sameUserVotes = $db->select("SELECT * FROM gargameleaks_votes WHERE smurfs_ID = '$smurfsId' AND IP = '$hashedIp'");
$sameUserVotes = $db->select("SELECT * FROM gargameleaks_votes WHERE smurf_ID = '$smurfsId' AND IP = '$hashedIp'");
if (count($sameUserVotes) >= 1) {
$db->query("UPDATE gargameleaks_votes
SET intelligence = '$intelligenceRating',
utility = '$utilityRating',
beauty = '$beautyRating'
WHERE smurfs_ID = '$smurfsId' AND IP = '$hashedIp'
WHERE smurf_ID = '$smurfsId' AND IP = '$hashedIp'
");

echo json_encode(array("info" => "vote updated"));
exit();
}

$db->query("INSERT INTO gargameleaks_votes (smurfs_ID, IP, intelligence, utility, beauty) VALUES
$db->query("INSERT INTO gargameleaks_votes (smurf_ID, IP, intelligence, utility, beauty) VALUES
('$smurfsId', '$hashedIp', '$intelligenceRating', '$utilityRating', '$beautyRating')");

echo json_encode(array());
Expand Down
4 changes: 2 additions & 2 deletions scripts/sendComment.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
async function sendComment(content, smurfs_ID) {
async function sendComment(content, smurf_ID) {
let response = await fetch("api/newComment.php", {
method: "POST",
body: objectToFormData({
content: content,
smurfsId: smurfs_ID,
smurfsId: smurf_ID,
}),
});
let responseJson = await response.json();
Expand Down

0 comments on commit f9c26ca

Please sign in to comment.