Skip to content
Snippets Groups Projects
Commit 38f948e1 authored by Hidayatullah Wildan Ghaly Buchary's avatar Hidayatullah Wildan Ghaly Buchary
Browse files

feat: add claim and unclaim backend for CHALLENGE

parent 27e6f956
Branches
Tags
No related merge requests found
<?php
echo "Hello World!";
\ No newline at end of file
include_once __DIR__."/../session.php";
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
parse_str(file_get_contents('php://input'), $_POST);
$user_id = $_POST['user_id'];
$quest_id = $_POST['quest_id'];
$conn = Database::getInstance();
$sql = "INSERT INTO user_quest (user_id, quest_id) VALUES ($user_id, $quest_id)";
$result = $conn->query($sql);
echo $sql;
} else {
http_response_code(405);
echo "Metode HTTP yang tidak diizinkan";
}
\ No newline at end of file
<?php
echo "Hello World2!";
\ No newline at end of file
include_once __DIR__."/../session.php";
if ($_SERVER['REQUEST_METHOD'] === 'DELETE') {
parse_str(file_get_contents('php://input'), $_DELETE);
$user_id = $_DELETE['user_id'];
$quest_id = $_DELETE['quest_id'];
$conn = Database::getInstance();
$sql = "DELETE FROM user_quest WHERE user_id = $user_id AND quest_id = $quest_id";
$result = $conn->query($sql);
echo $sql;
} else {
http_response_code(405);
echo "Metode HTTP yang tidak diizinkan";
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment