-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajaxGetSavedLightShow.php
More file actions
83 lines (66 loc) · 2.4 KB
/
ajaxGetSavedLightShow.php
File metadata and controls
83 lines (66 loc) · 2.4 KB
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
<?php
/*
Copyright 2014 Mark Briggs
This file is part of ColorRing.
ColorRing is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
ColorRing is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
There is a copy of the GNU General Public License in the
accompanying COPYING file
*/
/*
include "functions.php";
include "appInit.php";
include "siteGenFunctions.php";
include "siteDbFunctions.php";
$conn = connect_to_DB();
$result = dbSelect("LightShow", $whereCondArrArr);
$numRecords = mysql_num_rows($result);
for ($i = 0; $i < $numRecords; $i++) {
$row = mysql_fetch_assoc($result);
// Build JSON response
if ($i > 0) { echo ","; }
echo '{"idx": "' . $row['idx'] . '", ';
echo '"lightShowName": "' . $row['lightShowName'] . '", ';
echo '"singleCmdIdxStr": "' . $row['singleCmdIdxStr'] . '"}';
}
*/
include "appInit.php";
include "siteGenFunctions.php";
include "siteDbFunctions.php";
if (!isset($_GET['lightShowIdx']) && !isset($_GET['lightShowName']) && !isset($_GET['singleCmdIdxStr'])) {
echo "<p>Error: 1 (and only 1) of these must be set: lightShowIdx, lightShowName, singleCmdIdxStr</p>";
exit();
}
$conn = connect_to_DB();
$lightShowIdx = false;
$lightShowName = false;
$singleCmdIdxStr = false;
$whereCondArrArr = ""; // Selects NOTHING from DB table
if (isset($_GET['lightShowIdx'])) {
$lightShowIdx = $_GET['lightShowIdx'];
$whereCondArrArr = array(array("idx", "=", $lightShowIdx));
} elseif (isset($_GET['lightShowName'])) {
$lightShowName = $_GET['lightShowName'];
$whereCondArrArr = array(array("lightShowName", "=", $lightShowName));
} elseif (isset($_GET['singleCmdIdxStr'])) {
$singleCmdIdxStr = $_GET['singleCmdIdxStr'];
$whereCondArrArr = array(array("singleCmdIdxStr", "=", $singleCmdIdxStr));
}
$result = dbSelect("LightShow", $whereCondArrArr);
$numRecords = mysql_num_rows($result);
if ($numRecords > 0) {
$row = mysql_fetch_assoc($result);
// Build JSON response
echo '{"idx": "' . $row['idx'] . '", ';
echo '"lightShowName": "' . $row['lightShowName'] . '", ';
echo '"singleCmdIdxStr": "' . $row['singleCmdIdxStr'] . '"}';
} else {
echo '{"idx": "-1"}';
}
?>