-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.php
209 lines (194 loc) · 10.7 KB
/
errors.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<div id="main" style="width:100%; left: 0px;">
<div id="leftcolumn">
<div id="leftmenu">
<div id="leftmenu_general_a" style="margin-top: 10px;">
<div class="m_separator">Îáúåêòû</div>
<div class="menuitem first"><a href="index.php?sel=errors" onmouseover="arrowOn(this);" onmouseout="arrowOff(this);">Âñå îáúåêòû</a></div>
<?php
$query = 'SELECT * FROM objects';
$e = mysql_query ($query,$i);
if ($e) $ui = mysql_fetch_row ($e);
while ($ui)
{
$query = 'SELECT * FROM devices WHERE object='.$ui[0];
$y = mysql_query ($query,$i);
if ($y) $uo = mysql_fetch_row ($y);
print '<div class="menuitem"><a href="index.php?sel=errors&id='.$uo[0].'" onmouseover="arrowOn(this);" onmouseout="arrowOff(this);">'.$ui[1].'</a></div>';
$ui = mysql_fetch_row ($e);
}
?>
</div>
</div>
</div>
<div id="maincontent" style="width:1020px">
<table border="0" cellpadding="0" cellspacing="0" width="99%">
<tbody><tr>
<td><table border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td>
<table border="0" cellpadding="2" cellspacing="0">
<tbody><tr><td>
<ul id="navigation">
<?php
print '<li><a href="index.php?sel=errors&id='.$_GET["id"].'"';
if (!$_GET["type"]) print 'class="sel"'; print '><span>Âñå çàïèñè</span></a></li>';
print '<li><a href="index.php?sel=errors&type=1&id='.$_GET["id"].'"';
if ($_GET["type"]==1) print 'class="sel"'; print '><span>Êðèòè÷åñêèå</span></a></li>';
print '<li><a href="index.php?sel=errors&type=2&id='.$_GET["id"].'"';
if ($_GET["type"]==2) print 'class="sel"'; print '><span>Ïðåäóïðåæäåíèÿ</span></a></li>';
print '<li><a href="index.php?sel=errors&type=3&id='.$_GET["id"].'"';
if ($_GET["type"]==3) print 'class="sel"'; print '><span>Èíôîðìàöèîííûå</span></a></li>';
print '<li><a href="index.php?sel=errors&type=4&id='.$_GET["id"].'"';
if ($_GET["type"]==4) print 'class="sel"'; print '><span>Îøèáêè</span></a></li>';
?>
</ul>
<div id="border"></div>
</td></tr>
</tbody></table>
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td>
<table border="0" cellpadding="0" cellspacing="5" width="100%">
<tbody><tr><td valign="top">
<table cellpadding=2 cellspacing=1 bgcolor=#82cc7f align=center>
<tr bgcolor="#476a94">
<td align="center"><font color="white">Îáúåêò</font></td>
<td align="center"><font color="white">Óñòðîéñòâî</font></td>
<td align="center"><font color="white">Äàòà</font></td>
<td align="center"><font color="white">Tèï ñîáûòèÿ</font></td>
<td align="center"><font color="white">Ñîáûòèå</font></td>
<td align="center"><font color="white">Çíà÷åíèå</font></td>
</tr>
<?php
$query = 'SELECT * FROM devices';
$e = mysql_query ($query,$i);
if ($e) $ui = mysql_fetch_row ($e);
while ($ui)
{
$tpod=$tobr=$vpod=$vobr=$qpod=$qobr=$qpot=$vgvs=$vhvs=0;
$query = 'SELECT * FROM data WHERE type=0 AND value>0 AND device='.$ui[11].' ORDER BY date DESC';
$y = mysql_query ($query,$i);
if ($y) $uy = mysql_fetch_row ($y);
while ($uy)
{
if ($uy[8]==4 && $uy[6]==0 && !$tpod) $tpod=$uy[3];
if ($uy[8]==4 && $uy[6]==1 && !$tobr) $tobr=$uy[3];
if ($uy[8]==11 && $uy[6]==0 && !$vpod) $vpod=$uy[3];
if ($uy[8]==11 && $uy[6]==1 && !$vobr) $vobr=$uy[3];
if ($uy[8]==13 && $uy[6]==0 && !$qpod) $qpod=$uy[3];
if ($uy[8]==13 && $uy[6]==1 && !$qobr) $qobr=$uy[3];
if ($uy[8]==13 && $uy[6]==2 && !$qpot) $qpot=$uy[3];
if ($uy[8]==12 && $uy[6]==5 && !$vgvs) $vgvs=$uy[3];
if ($uy[8]==12 && $uy[6]==6 && !$vhvs) $vhvs=$uy[3];
$uy = mysql_fetch_row ($y);
}
if ($vpod<$vobr) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Ðàñõîä îáðàòíîé áîëüøå ïîäàþùåé (âîçìîæíî ïåðåïóòàíû ìåñòàìè èëè íåò îòîïëåíèÿ) Vïîä='.$vpod.' Vîáð='.$vobr.'\',\''.$vpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($tpod<$tobr) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Òåìïåðàòóðà îáðàòíîé áîëüøå ïîäàþùåé (âîçìîæíî ïåðåïóòàíû ìåñòàìè èëè íåò îòîïëåíèÿ) Tïîä='.$tpod.' Tîáð='.$tobr.'\',\''.$tpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($qpod<$qobr) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Òåïëîâàÿ ýíåðãèÿ îáðàòíîé áîëüøå ïîäàþùåé (âîçìîæíî ïåðåïóòàíû ìåñòàìè èëè íåò îòîïëåíèÿ) Qïîä='.$qpod.' Qîáð='.$qobr.'\',\''.$qpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($vpod>$vobr+$vobr && $vobr>0) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Ðàñõîä ïîäàþùåé áîëüøå ÷åì â äâà ðàçà áîëüøå îáðàòíîé (âîçìîæíî íåêîððåêòíàÿ íàñòðîéêà îáîðóäîâàíèÿ) Vïîä='.$vpod.' Vîáð='.$vobr.'\',\''.$vpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($tpod>$tobr+$tobr) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Òåìïåðàòóðà ïîäàþùåé áîëüøå ÷åì â äâà ðàçà áîëüøå îáðàòíîé (âîçìîæíî íåêîððåêòíàÿ íàñòðîéêà îáîðóäîâàíèÿ) Tïîä='.$tpod.' Tîáð='.$tobr.'\',\''.$tpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($qpod>$qobr+$qobr && $qobr>0) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Òåïëîâàÿ ýíåðãèÿ ïîäàþùåé áîëüøå ÷åì â äâà ðàçà áîëüøå îáðàòíîé (âîçìîæíî íåêîððåêòíàÿ íàñòðîéêà îáîðóäîâàíèÿ) Qïîä='.$qpod.' Qîáð='.$qobr.'\',\''.$qpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($qpot<0) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Òåïëîâàÿ ýíåðãèÿ îòðèöàòåëüíà (âîçìîæíî ïåðåïóòàíû äàò÷èêè íà ïðÿìîì è îáðàòíîì òðóáîïðîâîäå) Qïîò='.$qpot.'\',\''.$qpot.'\')'; $e2 = mysql_query ($query,$i); }
/*
$today=getdate();
if ($_GET["year"]=='') $ye=$today["year"];
else $ye=$_GET["year"];
if ($_GET["month"]=='') $mn=$today["mon"];
else $mn=$_GET["month"];
$x=0; $nn=1; $ts=23;
$tm=$dy=$today["mday"]-1;
for ($tn=0; $tn<=250; $tn++)
{
$date1[$tn]=sprintf ("%d%02d%02d%02d0000",$ye,$mn,$tm,$ts);
$dat[$tn]=sprintf ("%d-%02d-%02d %02d:00:00",$ye,$mn,$tm,$ts);
$data0[$tn]=$data1[$tn]=$data2[$tn]=$data3[$tn]=$data4[$tn]=$data5[$tn]=$data6[$tn]=$data7[$tn]=$data8[$tn]=$data9[$tn]='-';
if ($tm==1 && $ts==0)
{
$mn--; $ts=24;
$dy=31;
if (!checkdate ($mn,31,$ye)) { $dy=30; }
if (!checkdate ($mn,30,$ye)) { $dy=29; }
if (!checkdate ($mn,29,$ye)) { $dy=28; }
$tm=$dy;
}
if ($ts==0) { $ts=24; $tm--; }
$ts--;
}
$query = 'SELECT * FROM data WHERE type=1 AND device='.$ui[11].' ORDER BY date DESC LIMIT 30000';
$a = mysql_query ($query,$i);
if ($a) $uy = mysql_fetch_row ($a);
while ($uy)
{
$x=451;
for ($tn=0; $tn<=450; $tn++)
if ($uy[2]==$dat[$tn]) $x=$tn;
if ($uy[8]==4 && $uy[6]==0) $data0[$x]=number_format($uy[3],3);
if ($uy[8]==4 && $uy[6]==1) $data1[$x]=number_format($uy[3],3);
if ($uy[8]==11 && $uy[6]==0) $data2[$x]=number_format($uy[3],3);
if ($uy[8]==11 && $uy[6]==1) $data3[$x]=number_format($uy[3],3);
if ($uy[8]==13 && $uy[6]==0) $data4[$x]=number_format($uy[3],4);
if ($uy[8]==13 && $uy[6]==1) $data5[$x]=number_format($uy[3],4);
if ($uy[8]==13 && $uy[6]==2) $data6[$x]=number_format($uy[3],4);
if ($uy[8]==12 && $uy[6]==5) $data7[$x]=number_format($uy[3],5);
$uy = mysql_fetch_row ($a);
}
for ($tn=0; $tn<=450; $tn++)
{
if ($vpod<$vobr) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Ðàñõîä îáðàòíîé áîëüøå ïîäàþùåé (âîçìîæíî ïåðåïóòàíû ìåñòàìè èëè íåò îòîïëåíèÿ) Vïîä='.$vpod.' Vîáð='.$vobr.'\',\''.$vpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($tpod<$tobr) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Òåìïåðàòóðà îáðàòíîé áîëüøå ïîäàþùåé (âîçìîæíî ïåðåïóòàíû ìåñòàìè èëè íåò îòîïëåíèÿ) Tïîä='.$tpod.' Tîáð='.$tobr.'\',\''.$tpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($qpod<$qobr) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Òåïëîâàÿ ýíåðãèÿ îáðàòíîé áîëüøå ïîäàþùåé (âîçìîæíî ïåðåïóòàíû ìåñòàìè èëè íåò îòîïëåíèÿ) Qïîä='.$qpod.' Qîáð='.$qobr.'\',\''.$qpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($vpod>$vobr+$vobr && $vobr>0) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Ðàñõîä ïîäàþùåé áîëüøå ÷åì â äâà ðàçà áîëüøå îáðàòíîé (âîçìîæíî íåêîððåêòíàÿ íàñòðîéêà îáîðóäîâàíèÿ) Vïîä='.$vpod.' Vîáð='.$vobr.'\',\''.$vpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($tpod>$tobr+$tobr) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Òåìïåðàòóðà ïîäàþùåé áîëüøå ÷åì â äâà ðàçà áîëüøå îáðàòíîé (âîçìîæíî íåêîððåêòíàÿ íàñòðîéêà îáîðóäîâàíèÿ) Tïîä='.$tpod.' Tîáð='.$tobr.'\',\''.$tpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($qpod>$qobr+$qobr && $qobr>0) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Òåïëîâàÿ ýíåðãèÿ ïîäàþùåé áîëüøå ÷åì â äâà ðàçà áîëüøå îáðàòíîé (âîçìîæíî íåêîððåêòíàÿ íàñòðîéêà îáîðóäîâàíèÿ) Qïîä='.$qpod.' Qîáð='.$qobr.'\',\''.$qpod.'\')'; $e2 = mysql_query ($query,$i);}
if ($qpot<0) { $query = 'INSERT INTO register (device, type, descr, value) VALUES (\''.$ui[11].'\',\'3\',\'Òåïëîâàÿ ýíåðãèÿ îòðèöàòåëüíà (âîçìîæíî ïåðåïóòàíû äàò÷èêè íà ïðÿìîì è îáðàòíîì òðóáîïðîâîäå) Qïîò='.$qpot.'\',\''.$qpot.'\')'; $e2 = mysql_query ($query,$i); }
} */
$ui = mysql_fetch_row ($e);
}
if ($_GET["id"])
{
if ($_GET["type"]) $query = 'SELECT * FROM register WHERE type='.$_GET["type"].' AND device='.$ui[11].' ORDER BY date DESC';
else $query = 'SELECT * FROM register WHERE device='.$ui[11].' ORDER BY date DESC';
}
else
{
if ($_GET["type"]) $query = 'SELECT * FROM register WHERE type='.$_GET["type"].' ORDER BY date DESC';
else $query = 'SELECT * FROM register ORDER BY date DESC';
}
$y = mysql_query ($query,$i);
if ($y) $uo = mysql_fetch_row ($y);
while ($uo)
{
$query = 'SELECT * FROM devices WHERE device='.$uo[1];
$e = mysql_query ($query,$i);
if ($e) $ui = mysql_fetch_row ($e);
if ($ui)
{
$query = 'SELECT * FROM objects WHERE id='.$ui[8];
$e2 = mysql_query ($query,$i);
if ($e2) $ur = mysql_fetch_row ($e2);
}
print '<tr id="row'.$ui[0].'" bgcolor="#ffffff">';
print '<td align="left"><b>'.$ur[1].'</b></td>';
print '<td align="left"><b>'.$ui[1].'('.$ui[11].')</b></td>';
print '<td align="center">'.$uo[5].'</td>';
if ($uo[2]==1) print '<td align="center">êðèòè÷åñêîå</td>';
if ($uo[2]==2) print '<td align="center">ïðåäóïðåæäåíèå</td>';
if ($uo[2]==3) print '<td align="center">èíôîðìàöèîííîå</td>';
if ($uo[2]==4) print '<td align="center">âêë./âûêë.</td>';
print '<td align="left">'.$uo[3].'</td>';
print '<td align="center">'.$uo[4].'</td></tr>';
$uo = mysql_fetch_row ($y);
}
?>
</tbody></table>
</td>
</tr>
</tbody></table>
</td></tr></tbody></table>
</td></tr>
</tbody></table>
<br><br><br>
<br><br><br><br><br>
</div>