Skip to content

Commit

Permalink
Update: Refactor IP hashing method in API endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
judemont committed Aug 2, 2024
1 parent 4f00d47 commit 5cef91a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/isBanned.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

$db = new Database;
$clientIp = getClientIp();
$hashedIp = $db->escapeStrings(hash("sha256", $clientIp . HASH_SECRET));
$hashedIp = $db->escapeStrings(hash("sha256", $clientIp /*. HASH_SECRET*/));

$bannRecords = $db->select("SELECT * FROM gargameleaks_bann WHERE IP = '$hashedIp'");

Expand Down
2 changes: 1 addition & 1 deletion api/newComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$smurfsId = $db->escapeStrings($_POST['smurfsId']);

$clientIp = getClientIp();
$hashedIp = $db->escapeStrings(hash("sha256", $clientIp . HASH_SECRET));
$hashedIp = $db->escapeStrings(hash("sha256", $clientIp /*. HASH_SECRET*/));

$bannRecords = $db->select("SELECT * FROM gargameleaks_bann WHERE IP = '$hashedIp'");

Expand Down
8 changes: 4 additions & 4 deletions api/newRating.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
// ini_set('display_errors', '1');
// ini_set('display_startup_errors', '1');
// error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);

header('Content-type: application/json');

Expand All @@ -17,7 +17,7 @@
$smurfsId = $db->escapeStrings($_POST["smurfsId"]);

$clientIp = getClientIp();
$hashedIp = $db->escapeStrings(hash("sha256", $clientIp . HASH_SECRET));
$hashedIp = $db->escapeStrings(hash("sha256", $clientIp /*. HASH_SECRET*/));

if (
$intelligenceRating > 10 || $intelligenceRating <= 0 ||
Expand Down

0 comments on commit 5cef91a

Please # to comment.