This repository has been archived by the owner on Oct 29, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
db_filemarks.php
executable file
·105 lines (76 loc) · 2.7 KB
/
db_filemarks.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
session_start();
require("include/functions.php");
$config_file = 'config.php';
if (file_exists($config_file)) {
require("config.php");
} else {
header("Location: error.php?e=config");
die();
}
require("include/apply_config.php");
$SoundID=filter_var($_GET["SoundID"], FILTER_SANITIZE_NUMBER_INT);
$username = $_COOKIE["username"];
$UserID = query_one("SELECT UserID FROM Users WHERE UserName='$username'", $connection);
$force_loggedin = TRUE;
require("include/check_login.php");
$d = filter_var($_GET["d"], FILTER_SANITIZE_NUMBER_INT);
$mark_todel = filter_var($_GET["markID"], FILTER_SANITIZE_NUMBER_INT);
if ($d == 1) {
$result = mysqli_query($connection, "DELETE FROM SoundsMarks WHERE marks_ID='$mark_todel' LIMIT 1")
or die (mysqli_error($connection));
}
echo "<!DOCTYPE html>
<html>
<head>
<title>$app_custom_name - Manage Marks</title>";
#Get CSS
require("include/get_css3.php");
require("include/get_jqueryui.php");
if ($use_googleanalytics) {
echo $googleanalytics_code;
}
#Execute custom code for head, if set
if (is_file("$absolute_dir/customhead.php")) {
include("customhead.php");
}
?>
</head>
<body>
<div style="padding: 10px;">
<?php
$result=mysqli_query($connection, "SELECT SoundName, SamplingRate FROM Sounds WHERE SoundID='$SoundID' LIMIT 1")
or die (mysqli_error($connection));;
$row = mysqli_fetch_array($result);
extract($row);
echo "<h4>Marks in the database for the file $SoundName (ID: $SoundID):</h4>";
if ($d){
echo "<div class=\"alert alert-success\">The mark was deleted</div>";
}
$resultm=mysqli_query($connection, "SELECT marks_ID FROM SoundsMarks WHERE SoundID='$SoundID' ORDER BY marks_ID")
or die (mysqli_error($connection));
$nrowsm = mysqli_num_rows($resultm);
if ($nrowsm>0) {
echo "<table>";
for ($w=0;$w<$nrowsm;$w++){
$rowm = mysqli_fetch_array($resultm);
extract($rowm);
//Query for the last mark edit
$res=mysqli_query($connection, "SELECT marks_ID, SoundID AS mark_fileID, time_min AS mark_time_min, time_max AS mark_time_max, freq_min AS mark_freq_min, freq_max AS mark_freq_max, mark_tag FROM SoundsMarks WHERE marks_ID='$marks_ID' LIMIT 1");
$row = mysqli_fetch_array($res);
extract($row);
unset($row);
//Mark
echo "<tr><td>$mark_tag_name: $mark_tag (ID:$marks_ID) | Time: $mark_time_min - $mark_time_max sec | Frequency: $mark_freq_min - $mark_freq_max Hz <a href=\"db_filemarks.php?d=1&SoundID=$SoundID&markID=$marks_ID\"><span class=\"glyphicon glyphicon-remove-circle\" aria-hidden=\"true\" title=\"Delete\"></span></a></td></tr>\n";
}
echo "</table>";
}
else {
echo "<p>This file has no marks.";
}
?>
<hr noshade>
<p><a href="#" onClick="opener.location.reload();window.close();">Close window</a>
</div>
</body>
</html>