Skip to content

Commit

Permalink
Update database table names to use 'gargameleaks' prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
judemont committed Jul 26, 2024
1 parent 6641c09 commit 97ae0e3
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion api/getAllComments.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
$db = new Database;


$comments = $db->select("SELECT * FROM cescoleaks_comments");
$comments = $db->select("SELECT * FROM gargameleaks_comments");

echo json_encode($comments);
2 changes: 1 addition & 1 deletion api/getComments.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

$teacherId = $db->escapeStrings($_POST['teacherID']);

$comments = $db->select("SELECT * FROM cescoleaks_comments WHERE teacher_ID = '$teacherId'");
$comments = $db->select("SELECT * FROM gargameleaks_comments WHERE teacher_ID = '$teacherId'");

echo json_encode($comments);
8 changes: 4 additions & 4 deletions api/getTeachers.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ function compareTeachers($a, $b, $sort)


if (isset($searchQuery)) {
$teachers = $db->select("SELECT * FROM cescoleaks_teachers WHERE name LIKE '%$searchQuery%' ORDER BY name");
$teachers = $db->select("SELECT * FROM gargameleaks_teachers WHERE name LIKE '%$searchQuery%' ORDER BY name");
} else {
$teachers = $db->select("SELECT * FROM cescoleaks_teachers ORDER BY name");
$teachers = $db->select("SELECT * FROM gargameleaks_teachers ORDER BY name");
}

foreach ($teachers as &$teacher) {
$comments = $db->select("SELECT * FROM cescoleaks_comments WHERE teacher_ID = '{$teacher["ID"]}'");
$votesData = $db->select("SELECT * FROM cescoleaks_votes WHERE teacher_ID = '{$teacher["ID"]}'");
$comments = $db->select("SELECT * FROM gargameleaks_comments WHERE teacher_ID = '{$teacher["ID"]}'");
$votesData = $db->select("SELECT * FROM gargameleaks_votes WHERE teacher_ID = '{$teacher["ID"]}'");
$votesCount = count($votesData);

$teachingQualityTotal = 0;
Expand Down
4 changes: 2 additions & 2 deletions api/isBanned.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
$clientIp = getClientIp();
$hashedIp = $db->escapeStrings(hash("sha256", $clientIp . HASH_SECRET));

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

if (count($bannRecords) >= 1) {
// echo time();
// echo $bannRecords[0]["end_time"];
if ($bannRecords[0]["end_time"] <= time()) {
$db->query("DELETE FROM cescoleaks_bann WHERE IP = '$hashedIp'");
$db->query("DELETE FROM gargameleaks_bann WHERE IP = '$hashedIp'");
echo json_encode(array(
"banned" => false,
"ip" => $hashedIp,
Expand Down
6 changes: 3 additions & 3 deletions api/newBann.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
$commentId = $db->escapeStrings($_POST['comment_id']);
$duration = $_POST['duration'];
$endDate = $db->escapeStrings(time() + $duration);
$comment = $db->select("SELECT * FROM cescoleaks_comments WHERE ID = '$commentId'");
$comment = $db->select("SELECT * FROM gargameleaks_comments WHERE ID = '$commentId'");

$authorIp = $db->escapeStrings($comment[0]["IP"]);
$db->query("DELETE FROM cescoleaks_comments WHERE ID = '$commentId'");
$db->query("DELETE FROM gargameleaks_comments WHERE ID = '$commentId'");

$db->query("INSERT INTO cescoleaks_bann (IP, end_time) VALUES ('$authorIp', '$endDate')");
$db->query("INSERT INTO gargameleaks_bann (IP, end_time) VALUES ('$authorIp', '$endDate')");
4 changes: 2 additions & 2 deletions api/newComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
$clientIp = getClientIp();
$hashedIp = $db->escapeStrings(hash("sha256", $clientIp . HASH_SECRET));

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

if (count($bannRecords) > 0) {
echo json_encode(array("error" => "banned"));
exit();
}

$db->query("INSERT INTO cescoleaks_comments (teacher_ID, IP, content) VALUES
$db->query("INSERT INTO gargameleaks_comments (teacher_ID, IP, content) VALUES
('$teacherId', '$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,9 +28,9 @@
exit();
}

$sameUserVotes = $db->select("SELECT * FROM cescoleaks_votes WHERE teacher_ID = '$teacherId' AND IP = '$hashedIp'");
$sameUserVotes = $db->select("SELECT * FROM gargameleaks_votes WHERE teacher_ID = '$teacherId' AND IP = '$hashedIp'");
if (count($sameUserVotes) >= 1) {
$db->query("UPDATE cescoleaks_votes
$db->query("UPDATE gargameleaks_votes
SET teaching_quality = '$teachingQualityRating',
kindness = '$kindnessRating',
humor = '$humorRating'
Expand All @@ -41,7 +41,7 @@
exit();
}

$db->query("INSERT INTO cescoleaks_votes (teacher_ID, IP, teaching_quality, kindness, humor) VALUES
$db->query("INSERT INTO gargameleaks_votes (teacher_ID, IP, teaching_quality, kindness, humor) VALUES
('$teacherId', '$hashedIp', '$teachingQualityRating', '$kindnessRating', '$humorRating')");

echo json_encode(array());
Expand Down
2 changes: 1 addition & 1 deletion api/newTeacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$msg = "Name: " . $name;

for ($i=0; $i < count(EMAILS); $i++) {
mail(EMAILS[$i], "CESCOLEAKS Teacher request", $msg);
mail(EMAILS[$i], "gargameleaks Teacher request", $msg);
}

header("location: ../index.html");
Expand Down
2 changes: 1 addition & 1 deletion api/sendMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$msg = "Le message: $userMsg\n Son IP (on sais jamais) $clientIP";

for ($i = 0; $i < count(EMAILS); $i++) {
mail(EMAILS[$i], "CESCOLEAKS: message", $msg);
mail(EMAILS[$i], "gargameleaks: message", $msg);
}

if (isset($_GET["return"])) {
Expand Down

0 comments on commit 97ae0e3

Please sign in to comment.