forked from VovaGurovskiy/EnergoRemote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setdata.php
70 lines (65 loc) · 2.61 KB
/
setdata.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
<?
include("bd.php");
$login = trim(htmlspecialchars(stripslashes($_GET['log'])));
$pass = trim(htmlspecialchars(stripslashes($_GET['pass'])));
$id_group = trim(htmlspecialchars(stripslashes($_GET['id_group'])));
$typedata = trim(htmlspecialchars(stripslashes($_GET['typedata'])));
$data = trim(htmlspecialchars(stripslashes($_GET['data'])));
if (($login!='') and ($pass!='') and ($typedata!='') and ($data!='') and ($id_group!=''))
{
include("support.php");
$id_user_group = loginform($login,$pass);
if ($id_user_group !='')
{
$sql = "";
switch($typedata)
{
case 'azimut':
$sql = "UPDATE groupdevice SET azimut='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
case 'photosensor':
$sql = "UPDATE groupdevice SET photosensor='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
case 'bright_white':
$sql = "UPDATE groupdevice SET bright_white='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
case 'bright_red':
$sql = "UPDATE groupdevice SET bright_red='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
case 'bright_green':
$sql = "UPDATE groupdevice SET bright_green='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
case 'bright_blue':
$sql = "UPDATE groupdevice SET bright_blue='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
case 'koef_white':
$sql = "UPDATE groupdevice SET koef_white='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
case 'koef_rgb':
$sql = "UPDATE groupdevice SET koef_rgb='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
case 'human_timer':
$sql = "UPDATE groupdevice SET human_timer='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
case 'use_photosensor':
$sql = "UPDATE groupdevice SET use_photosensor='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
case 'is_white':
$sql = "UPDATE groupdevice SET is_white='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
case 'onoff':
$sql = "UPDATE groupdevice SET OnOff='$data' WHERE id_user_group='$id_user_group' AND id_group='$id_group'";
break;
}
//echo $sql.'<br>';
$query = mysql_query($sql);
if (!$query)
{
die('updating error: '. mysql_error());
} else
{
echo $data.'<br>';
}
}
}
?>