prolif löschen
This commit is contained in:
@ -18,7 +18,7 @@ require __DIR__.'/classes/lib.php';
|
||||
$db_connection = new Database();
|
||||
$conn = $db_connection->dbConnection();
|
||||
|
||||
//var_dump($_POST);
|
||||
$data = json_decode(file_get_contents("php://input"));
|
||||
|
||||
//IF REQUEST METHOD IS NOT EQUAL TO POST
|
||||
if($_SERVER["REQUEST_METHOD"] != "POST")
|
||||
@ -28,27 +28,45 @@ if($_SERVER["REQUEST_METHOD"] != "POST")
|
||||
return;
|
||||
}
|
||||
|
||||
$returnData = new CMsg(0);
|
||||
|
||||
if(
|
||||
!isset($_POST['qr_id'])
|
||||
|| !isset($_POST['qr_id'])
|
||||
!isset($data->qr_id)
|
||||
|| !isset($data->qr_id)
|
||||
)
|
||||
{
|
||||
$fields = ['fields' => ['qr_id']];
|
||||
$returnData = new CMsg(0, 422, 'Please Fill in all Required Fields!', $fields);
|
||||
echo $returnData->jsonarray();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$qr_id = $data->qr_id;
|
||||
$stmt = $conn->prepare("DELETE FROM `dogs` WHERE `qr_id`=?");
|
||||
$stmt->execute([$qr_id]);
|
||||
|
||||
if($stmt->rowCount())
|
||||
{
|
||||
// delete upload dir
|
||||
if(deleteDir('../uploads/' . $qr_id))
|
||||
{
|
||||
$returnData = new CMsg(1, 200, 'Profile deleted!');
|
||||
}
|
||||
else
|
||||
{
|
||||
$returnData = new CMsg(0, 500, 'Can\'t delete Directory: '.
|
||||
'../uploads/' . $qr_id);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$returnData = new CMsg(0, 500, 'Can\'t delete Profil in Database');
|
||||
}
|
||||
}
|
||||
catch(PDOException $e)
|
||||
{
|
||||
$returnData = new CMsg(0,500,"deleteProfil ".$e->getMessage());
|
||||
}
|
||||
}
|
||||
echo $returnData->jsonarray();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user