Skip to content

Commit

Permalink
newBann.php
Browse files Browse the repository at this point in the history
  • Loading branch information
judemont committed May 19, 2024
1 parent a4ce702 commit 269e51b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions api/newBann.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);

include_once(dirname(__FILE__) . "/database.php");
include_once(dirname(__FILE__) . "/utils/getClientIp.php");
include_once(dirname(__FILE__) . "/secrets.php");

$db = new Database;

$adminPassword = $_POST["password"];
if ($adminPassword != ADMIN_PASSWORD) {
echo "wrong admin password";
exit();
}

$commentId = $db->escapeStrings($_POST['comment_id']);
$duration = $_POST['duration'];
$endDate = $db->escapeStrings(time() + $duration);
$comment = $db->select("SELECT * FROM cescoleaks_comment WHERE comment_id = '$commentId'");

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

$db->query("INSERT INTO cescoleaks_bann ('IP', 'end_time') VALUES ('$authorIp', '$endDate')");

0 comments on commit 269e51b

Please sign in to comment.