-
Notifications
You must be signed in to change notification settings - Fork 1
/
reggroup.php
55 lines (52 loc) · 1.46 KB
/
reggroup.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
<?
$id_user_group = trim(htmlspecialchars(stripslashes($_POST['id_user_group'])));
$name_group = trim(htmlspecialchars(stripslashes($_POST['name_group'])));
$azimut = trim(htmlspecialchars(stripslashes($_POST['azimut'])));
$is_color = trim(htmlspecialchars(stripslashes($_POST['is_color'])));
$id_group = trim(htmlspecialchars(stripslashes($_POST['id_group'])));
if ( ($id_user_group != '') and ($name_group != '') and ($azimut != '') and ($is_color!='') and ($id_group==''))
{
include ("bd.php");
$sql = "INSERT INTO groupdevice (id_group,
id_user_group,
name_group,
azimut,
is_color,
photosensor,
bright_white,
bright_red,
bright_green,
bright_blue,
koef_white,
koef_rgb,
human_timer,
use_photosensor,
color,
is_white) VALUES(NULL, $id_user_group, '$name_group', $azimut, $is_color, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)";
echo $sql.'<br>';
$query = mysql_query($sql);
if (!$query)
{
die('updating error: '. mysql_error());
} else
{
echo 'device created sucsessful';
}
} else
{
if ( ($id_user_group != '') and ($name_group != '') and ($azimut != '') and ($is_color!='') and ($id_group!=''))
{
include ("bd.php");
$sql = "UPDATE groupdevice SET id_user_group='$id_user_group', name_group='".$name_group."', azimut='$azimut', is_color='$is_color' WHERE id_group='$id_group'";
echo $sql.'<br>';
$query = mysql_query($sql);
if (!$query)
{
die('updating error: '. mysql_error());
} else
{
echo 'device updating sucsessful';
}
}
}
?>