profil löschen
This commit is contained in:
54
php/php-dog/deleteProfil.php
Normal file
54
php/php-dog/deleteProfil.php
Normal 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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user