deletes file as well -- thanks @ehpersonal38
This commit is contained in:
+8
-2
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
error_reporting(E_ERROR);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
$db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
$db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||||
if($db == False){
|
if($db == False){
|
||||||
@@ -20,10 +20,16 @@ $home = trim($home);
|
|||||||
if(isset($_GET['deletefile'])) {
|
if(isset($_GET['deletefile'])) {
|
||||||
$statement1 = $db->prepare('DELETE FROM detections WHERE File_Name = "'.explode("/",$_GET['deletefile'])[2].'" LIMIT 1');
|
$statement1 = $db->prepare('DELETE FROM detections WHERE File_Name = "'.explode("/",$_GET['deletefile'])[2].'" LIMIT 1');
|
||||||
if($statement1 == False){
|
if($statement1 == False){
|
||||||
echo "Database is busy";
|
echo "Error";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
} else {
|
} else {
|
||||||
|
$file_pointer = $home."/BirdSongs/Extracted/By_Date/".$_GET['deletefile'];
|
||||||
|
if (!exec("sudo rm $file_pointer && sudo rm $file_pointer.png")) {
|
||||||
echo "OK";
|
echo "OK";
|
||||||
|
} else {
|
||||||
|
echo "Error";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$result1 = $statement1->execute();
|
$result1 = $statement1->execute();
|
||||||
die();
|
die();
|
||||||
|
|||||||
Reference in New Issue
Block a user