-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalyse.php
275 lines (262 loc) · 10.3 KB
/
analyse.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<?php include("config/local.php"); ?>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<!doctype php manual "-//by the PHP Documentation Group//en">
<!doctype odbc manual "-//by microsoft corp.//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link rel="stylesheet" href="shablon.css" type="text/css">
<?
include_once("../../adodb/adodb.inc.php");
$db= &ADONewConnection($sqldriver);
if (!$db->Connect($mysql_host, $mysql_user, $mysql_password, $mysql_db_name))
{die("Error: ".$db->ErrorMsg());}
$resq = "SELECT * FROM users WHERE user='".$PHP_AUTH_USER."' AND passwd='".$PHP_AUTH_PW."';";
$rc=&$db->Execute($resq);
echo "<title>Àíàëèç - Èíòåðôåéñ'".$priveleges[$rc->fields[user_priveleges]]."'</title></head><body>";
?>
</head>
<body><table cellpadding="0" cellspacing="0" border="0" style="width:100%;">
<tr><td><table cellpadding="0" cellspacing="0" border="0" style="width:100%;">
<tr>
<td id="header" style="width:100%;background-image: url(files/14164-598x134.jpg);">
<a href="http://www.tpchel.ru/" title="Íà ãëàâíóþ ñòðàíèöó ÎÀÎ Òåïëîïðèáîð"><img src="files/logo.gif" alt="Íà ãëàâíóþ ñòðàíèöó" class="logo" align="top" width="103" height="100" border="0"/>
</a><div class="transparent"><a href="http://www.rossich.ru/"><img src="files/transparent.gif" /></a></div>
</div></td></tr></table></td></tr>
<tr><td>
<table border=0 align=center bgcolor=#ffffff valign=top>
<tr><td>
<? include ("inc/menu.inc"); ?>
</td></tr>
<tr><td>
<table border=0 align=center bgcolor=#ffffff valign=top width=800>
<?php
$i = mysql_connect ($mysql_host,$mysql_user,$mysql_password); $e=mysql_select_db ($mysql_db_name);
$today = getdate ();
if ($today[mon]>1)
{
$mon1=$today[mon]-1;
if ($mon1<10) $mon1='0'.$mon1;
$year1=$today[year];
}
else
{
$mon1=12;
$year1=$today[year]-1;
}
if ($mon1==1) $month1='ßíâàðü'; if ($mon1==2) $month1='Ôåâðàëü';
if ($mon1==3) $month1='Ìàðò'; if ($mon1==4) $month1='Àïðåëü';
if ($mon1==5) $month1='Ìàé'; if ($mon1==6) $month1='Èþíü';
if ($mon1==7) $month1='Èþëü'; if ($mon1==8) $month1='Àâãóñò';
if ($mon1==9) $month1='Ñåíòÿáðü'; if ($mon1==10) $month1='Îêòÿáðü';
if ($mon1==11) $month1='Íîÿáðü'; if ($mon1==12) $month1='Äåêàáðü';
if ($mon1>1)
{
$mon2=$mon1-1;
if ($mon2<10) $mon2='0'.$mon2;
$year2=$year1;
}
else
{
$mon2=12;
$year2=$year1-1;
}
if ($mon2==1) $month2='ßíâàðü'; if ($mon2==2) $month2='Ôåâðàëü';
if ($mon2==3) $month2='Ìàðò'; if ($mon2==4) $month2='Àïðåëü';
if ($mon2==5) $month2='Ìàé'; if ($mon2==6) $month2='Èþíü';
if ($mon2==7) $month2='Èþëü'; if ($mon2==8) $month2='Àâãóñò';
if ($mon2==9) $month2='Ñåíòÿáðü'; if ($mon2==10) $month2='Îêòÿáðü';
if ($mon2==11) $month2='Íîÿáðü'; if ($mon2==12) $month2='Äåêàáðü';
//-------------------------------------------------------
print '<tr><td bgcolor=#e6e6e6 colspan=4><font class="menu">Àíàëèç âõîäíîé èíôîðìàöèè, ïîòðåáëåíèÿ, ðàñõîäîâ</font></td></tr>';
print '<tr><td bgcolor=#e6e6e6 colspan=2><font class="menu">'.$month2.'</font></td><td bgcolor=#e6e6e6 colspan=2><font class="menu">'.$month1.'</font></td></tr>';
print '<tr><td width=500 colspan=2>';
$fl='files/'.$mon2.'_'.$year2.'.bmp';
if (is_file($fl)) print '<img border=0 src="'.$fl.'"></td>';
else print '<img border=0 src="charts/pie2.php?month='.$mon2.'&year='.$year2.'"></td>';
print '<td width=500 colspan=2>';
$fl='files/'.$mon1.'_'.$year1.'.bmp';
if (is_file($fl)) print '<img border=0 src="'.$fl.'"></td>';
else print '<img border=0 src="charts/pie2.php?month='.$mon1.'&year='.$year1.'">';
print '</tr>';
print '<tr><td colspan=2><hr><br><font class="or1">';
$ffile='tmp/'.$mon2.'arend.htm';
$fp=fopen($ffile,"r");
$contents = fread ($fp, filesize ($ffile));
fclose($fp);
echo $contents;
print '</font></td>';
print '<td colspan=2><hr><br><font class="or1">';
$ffile='tmp/'.$mon1.'arend.htm';
$fp=fopen($ffile,"r");
$contents = fread ($fp, filesize ($ffile));
fclose($fp);
echo $contents;
print '</font></td></tr>';
print '<tr><td colspan=2><hr><font class="or1">Ìàêñèìàëüíîå ïîòðåáëåíèå çà ìåñÿö '.$month2.' ó ';
$ffile='tmp/'.$mon2.'maxx.htm';
$fp=fopen($ffile,"r");
$contents = fread ($fp, filesize ($ffile));
fclose($fp);
echo $contents;
print '</font></td>';
print '<td colspan=2><hr><font class="or1">Ìàêñèìàëüíîå ïîòðåáëåíèå çà ìåñÿö '.$month1.' ó ';
$ffile='tmp/'.$mon1.'maxx.htm';
$fp=fopen($ffile,"r");
$contents = fread ($fp, filesize ($ffile));
fclose($fp);
echo $contents;
print '</font></td></tr>';
print '<tr><td colspan=2 valign=top><table width=100% valign=top><tr><td><hr><font class="or1">Ïèêîâîå/íàèìåíüøåå ïîòðåáëåíèå òåïëîâîé ýíåðãèè (ÃÊàë) <br></font><font class="or2">';
$armfile='tmp/pike_1.htm';
$fp=fopen($armfile,"r");
$contents = fread ($fp, filesize ($ffile));
fclose($fp);
echo $contents;
print '</font></td></tr>';
sscanf($contents,"ìàêñèìóì %d-%d-%d %f<br>ìèíèìóì %d-%d-%d %f<br>",&$day1,&$month1,&$year1,&$val1,&$day2,&$month2,&$year2,&$val2);
if ($day1<10) $day1='0'.$day1;
if ($month1<10) $month1='0'.$month1;
$query = 'SELECT * FROM korp WHERE korp_id<100';
$b = mysql_query ($query,$i);
if ($b)
for ($l=1;$l<=80;$l++)
{
$ut = mysql_fetch_row ($b);
if ($ut == true)
{
$idkorp = $ut[1];
if ($day1>1) $day3=$day1-1; else $day3=31;
$kname = $ut[2].' ('.$day3.','.$day1.'.'.$month1.'.'.$year1.')';
$query = 'SELECT value FROM data WHERE type=2 AND date='.$year1.$month1.$day1.'000000 AND korp='.$idkorp.' AND source=1 AND name LIKE \'%ýíåðãèè%\'';
//echo $query.'<br>';
$a = mysql_query ($query,$i);
if ($a)
{
$uy = mysql_fetch_row ($a);
if ($uy == true && $uy[0]>($val1/15))
{
print '<tr><td bgcolor=#e6e6e6 colspan=2><font class=menu>'.$kname.'</font></td></tr>';
print '<tr><td colspan=2><img border=0 src="charts/barplot.php?source=1&idkorp='.$idkorp.'&year='.$year1.'&month='.$month1.'&day='.$day1.'"></td></tr>';
}
}
}
}
print '</table></td>';
print '<td colspan=2 valign=top><table valign=top><tr><td valign=top><hr><font class="or1">Ïèêîâîå/íàèìåíüøåå ïîòðåáëåíèå ïîæàðíî-ïèòüåâîé âîäû (ì3)<br></font><font class="or2">';
$armfile='tmp/pike_2.htm';
$fp=fopen($armfile,"r");
$contents = fread ($fp, filesize ($armfile));
fclose($fp);
echo $contents;
print '</font></td></tr>';
sscanf($contents,"ìàêñèìóì %d-%d-%d %f<br>ìèíèìóì %d-%d-%d %f<br>",&$day1,&$month1,&$year1,&$val1,&$day2,&$month2,&$year2,&$val2);
$query = 'SELECT * FROM korp WHERE korp_id<100';
$b = mysql_query ($query,$i);
if ($day1<10) $day1='0'.$day1;
if ($month1<10) $month1='0'.$month1;
if ($b)
for ($l=1;$l<=80;$l++)
{
$ut = mysql_fetch_row ($b);
if ($ut == true)
{
$idkorp = $ut[1];
if ($day1>1) $day3=$day1-1; else $day3=31;
$kname = $ut[2].' ('.$day3.','.$day1.'.'.$month1.'.'.$year1.')';
$query = 'SELECT value FROM data WHERE type=2 AND date='.$year1.$month1.$day1.'000000 AND korp='.$idkorp.' AND source=2 AND name LIKE \'%îáúåì%\'';
//echo $query.'<br>';
$a = mysql_query ($query,$i);
if ($a)
{
$uy = mysql_fetch_row ($a);
if ($uy == true && $uy[0]>($val1/10))
{
print '<tr><td bgcolor=#e6e6e6 colspan=2><font class=menu>'.$kname.'</font></td></tr>';
print '<tr><td colspan=2><img border=0 src="charts/barplot.php?source=2&idkorp='.$idkorp.'&year='.$year1.'&month='.$month1.'&day='.$day1.'"></td></tr>';
}
}
}
}
print '</table></td></tr>';
print '<tr><td colspan=2 valign=top><table width=100% valign=top><tr><td><hr><font class="or1">Ïèêîâîå/íàèìåíüøåå ïîòðåáëåíèå ñæàòîãî âîçäóõà (ì3)<br></font><font class="or2">';
$armfile='tmp/pike_5.htm';
$fp=fopen($armfile,"r");
$contents = fread ($fp, filesize ($armfile));
fclose($fp);
echo $contents;
print '</font></td></tr>';
sscanf($contents,"ìàêñèìóì %d-%d-%d %f<br>ìèíèìóì %d-%d-%d %f<br>",&$day1,&$month1,&$year1,&$val1,&$day2,&$month2,&$year2,&$val2);
if ($day1<10) $day1='0'.$day1;
if ($month1<10) $month1='0'.$month1;
$query = 'SELECT * FROM korp WHERE korp_id<100';
$b = mysql_query ($query,$i);
if ($b)
for ($l=1;$l<=80;$l++)
{
$ut = mysql_fetch_row ($b);
if ($ut == true)
{
$idkorp = $ut[1];
if ($day1>1) $day3=$day1-1; else $day3=31;
$kname = $ut[2].' ('.$day3.','.$day1.'.'.$month1.'.'.$year1.')';
$query = 'SELECT value FROM data WHERE type=2 AND date='.$year1.$month1.$day1.'000000 AND korp='.$idkorp.' AND source=5 AND name LIKE \'%îáúåì%\'';
//echo $query.'<br>';
$a = mysql_query ($query,$i);
if ($a)
{
$uy = mysql_fetch_row ($a);
if ($uy == true && $uy[0]>($val1/50))
{
print '<tr><td bgcolor=#e6e6e6 colspan=2><font class=menu>'.$kname.'</font></td></tr>';
print '<tr><td colspan=2><img border=0 src="charts/barplot.php?source=5&idkorp='.$idkorp.'&year='.$year1.'&month='.$month1.'&day='.$day1.'"></td></tr>';
}
}
}
}
print '</table></td>';
print '<td colspan=2 valign=top><table valign=top><tr><td><hr><font class="or1">Ïèêîâîå/íàèìåíüøåå ïîòðåáëåíèå ýëåêòðè÷åñêîé ýíåðãèè (êÂò)<br></font><font class="or2">';
$armfile='tmp/pike_7.htm';
$fp=fopen($armfile,"r");
$contents = fread ($fp, filesize ($armfile));
fclose($fp);
echo $contents;
print '</font></td></tr>';
sscanf($contents,"ìàêñèìóì %d-%d-%d %f<br>ìèíèìóì %d-%d-%d %f<br>",&$day1,&$month1,&$year1,&$val1,&$day2,&$month2,&$year2,&$val2);
if ($day1<10) $day1='0'.$day1;
if ($month1<10) $month1='0'.$month1;
$query = 'SELECT * FROM korp WHERE korp_id<100';
$b = mysql_query ($query,$i);
if ($b)
for ($l=1;$l<=80;$l++)
{
$ut = mysql_fetch_row ($b);
if ($ut == true)
{
$idkorp = $ut[1];
if ($day1>1) $day3=$day1-1; else $day3=31;
$kname = $ut[2].' ('.$day3.','.$day1.'.'.$month1.'.'.$year1.')';
$query = 'SELECT value FROM data WHERE type=2 AND date='.$year1.$month1.$day1.'000000 AND korp='.$idkorp.' AND source=7 AND name LIKE \'%ýíåðã%\'';
//echo $query.'<br>';
$a = mysql_query ($query,$i);
if ($a)
{
$uy = mysql_fetch_row ($a);
if ($uy == true && $uy[0]>($val1/100))
{
print '<tr><td bgcolor=#e6e6e6 colspan=2><font class=menu>'.$kname.'</font></td></tr>';
print '<tr><td colspan=2><img border=0 src="charts/barplot.php?source=7&idkorp='.$idkorp.'&year='.$year1.'&month='.$month1.'&day='.$day1.'"></td></tr>';
}
}
}
}
print '</table></td></tr>';
print '<tr><td colspan=2><font class="or1">ïðîãíîç ïîòðåáëåíèÿ</font></td></tr>';
?>
</table><br>
</td><tr>
</table><br>
</td><tr>
</table>
</body>
</html>