profil löschen

This commit is contained in:
2023-03-01 23:59:47 +01:00
parent f2fa8e46e9
commit 5c7f9b3b03
3 changed files with 61 additions and 3 deletions

View File

@ -0,0 +1,54 @@
<?php
// error_reporting(E_ALL);
// ini_set("display_errors", 1);
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: access");
header("Access-Control-Allow-Methods: POST");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
session_start();
require __DIR__.'/classes/Database.php';
require __DIR__.'/classes/lib.php';
$db_connection = new Database();
$conn = $db_connection->dbConnection();
//var_dump($_POST);
//IF REQUEST METHOD IS NOT EQUAL TO POST
if($_SERVER["REQUEST_METHOD"] != "POST")
{
$returnData = new CMsg(0,404,'Page Not Found! REQUEST_METHOD');
echo $returnData->jsonarray();
return;
}
if(
!isset($_POST['qr_id'])
|| !isset($_POST['qr_id'])
)
{
$fields = ['fields' => ['qr_id']];
$returnData = new CMsg(0, 422, 'Please Fill in all Required Fields!', $fields);
echo $returnData->jsonarray();
return;
}
else
{
try
{
$stmt = $conn->prepare("DELETE FROM `dogs` WHERE `qr_id`=?");
$stmt->execute([$qr_id]);
if($stmt->rowCount())
{
// delete upload dir
}
}
}