-
Notifications
You must be signed in to change notification settings - Fork 1
/
deleteAction.php
28 lines (23 loc) · 908 Bytes
/
deleteAction.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
require('dbinit.php');
$aResult = array();
$var = $_POST['arguments'];
$stmt = $db->prepare("SELECT gps_fname FROM activities WHERE activities.ID=$var ");
$stmt->execute();
$selectOut = $stmt->fetchAll();
$filename = explode('.', $selectOut[0][0]);
unlink("blackbox-tools/logs/".$filename[0].".txt");
//unlink("blackbox-tools/logs/".$selectOut[0][0].".event");
unlink("files/txt/".$selectOut[0][0].".txt");
unlink("files/gpx/".$selectOut[0][0].".gps.gpx");
unlink("files/csv/".$selectOut[0][0].".csv");
unlink("files/csv/".$selectOut[0][0].".gps.csv");
$stmt = $db->prepare("DELETE FROM activities WHERE activities.ID=$var");
$stmt->execute();
$stmt = $db->prepare("DELETE FROM FCparams WHERE FCparams.activityID=$var");
$stmt->execute();
$stmt = $db->prepare("DELETE FROM weather WHERE weather.activityID=$var");
$stmt->execute();
$aResult['result'] = $filename;
echo json_encode($aResult);
?>