-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapa.php
546 lines (448 loc) · 15.1 KB
/
mapa.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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
<html>
<!-- /*
Este arquivo é parte do programa COCAR
COCAR é um software livre; você pode redistribui-lo e/ou
modifica-lo dentro dos termos da Licença Pública Geral GNU como
publicada pela Fundação do Software Livre (FSF); na versão 2 da
Licença.
Este programa é distribuido na esperança que possa ser util,
mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer
MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a
Licença Pública Geral GNU para maiores detalhes (GPL2.txt).
Você deve ter recebido uma cópia da Licença Pública Geral GNU
junto com este programa, se não, escreva para a Fundação do Software
Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-->
<HTML>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv='refresh' content='60; URL=<?php echo $_SERVER['PHP_SELF'] . "?uf="; ?>'>
<style type=text/css>
.topo
{
background-color: #006666;
border-width: 1px;
border-style: solid;
border-color: #FF9900;
padding-left: 1;
padding-right: 1;
padding-top: 2;
padding-bottom: 2;
FONT: 10pt Verdana, Arial;
FONT-WEIGHT: bold;
COLOR: #FFFFFF;
}
.rly
{
background-color: #CEFFCE;
border-width: 1px;
border-style: solid;
border-color: #FF9900;
padding-left: 1;
padding-right: 1;
padding-top: 2;
padding-bottom: 2;
FONT: 7pt Verdana, Arial;
FONT-WEIGHT: bold;
COLOR: #00000;
}
.alto1
{
background-color: #80FFFF;
border-width: 1px;
border-style: solid;
border-color: #FF9900;
padding-left: 1;
padding-right: 1;
padding-top: 2;
padding-bottom: 2;
FONT: 7pt Verdana, Arial;
FONT-WEIGHT: bold;
COLOR: #000000;
}
.alto2
{
background-color: #B3D9FF;
border-width: 1px;
border-style: solid;
border-color: #FF9900;
padding-left: 1;
padding-right: 1;
padding-top: 2;
padding-bottom: 2;
FONT: 7pt Verdana, Arial;
FONT-WEIGHT: bold;
COLOR: #000000;
}
.zero1
{
background-color: #FFFFDD;
border-width: 1px;
border-style: solid;
border-color: #FF9900;
padding-left: 1;
padding-right: 1;
padding-top: 2;
padding-bottom: 2;
FONT: 7pt Verdana, Arial;
FONT-WEIGHT: bold;
COLOR: #0000BF;
}
.zero2
{
background-color: #F0F000;
border-width: 1px;
border-style: solid;
border-color: #FF9900;
padding-left: 1;
padding-right: 1;
padding-top: 2;
padding-bottom: 2;
FONT: 7pt Verdana, Arial;
FONT-WEIGHT: bold;
COLOR: #0000BF;
}
body
{
scrollbar-face-color: #FFFFFF;
scrollbar-shadow-color: #c0c0c0;
scrollbar-highlight-color: #FFFFFF;
scrollbar-3dlight-color: #c0c0c0;
scrollbar-darkshadow-color: #FFFFFF;
scrollbar-track-color: #ffffff;
scrollbar-arrow-color: #c0c0c0;
font-family: Verdana, Arial;
font-size: 12pt;
}
A:link
{
font-family: Verdana, Arial;
font-size: 8pt;
FONT-WEIGHT: bold;
COLOR: #000000;
TEXT-DECORATION: none;
CURSOR: hand;
}
A:visited
{
font-family: Verdana, Arial;
font-size: 8pt;
FONT-WEIGHT: bold;
COLOR: #333333;
TEXT-DECORATION: none;
CURSOR: hand;
}
A:active
{
font-family: Verdana, Arial;
font-size: 8pt;
FONT-WEIGHT: bold;
COLOR: #FF8000;
TEXT-DECORATION: none;
CURSOR: hand;
}
A:hover
{
font-family: Verdana, Arial;
font-size: 8pt;
FONT-WEIGHT: bold;
TEXT-DECORATION: none;
color:#FF0000;
CURSOR: hand;
}
.result
{
border-width: 1px;
border-style: solid;
border-color: #F58735;
FONT-FAMILY: Verdana, Arial;
FONT-SIZE: 9pt;
FONT-WEIGHT: bold
}
.thd
{
background-color: #006666;
border-width: 1px;
border-style: solid;
border-color: #F58735;
FONT-FAMILY: Verdana, Arial;
FONT-SIZE: 9pt;
FONT-WEIGHT: bold;
COLOR: #FFFFFF;
ALIGN: center;
}
.acessos
{
border: #F58735 1px solid;
FONT-FAMILY: Verdana, Arial;
FONT-SIZE: 9pt;
FONT-WEIGHT: bold
}
</style>
<script language="javascript">
function janela()
{
open ("info/info.html", "janela", "status=no, width=407, height=220")
}
function MM_openBrWindow(theURL,winName,features)
{
window.open(theURL,winName,"width=700,height=460,resizable,scrollbars");
}
function muda_pagina(file1,file2)
{
parent.frames[1].location.href=file1;
parent.frames[2].location.href=file2;
}
function valida_campo(campo){
if (campo==""){
alert("Favor selecionar orgao!");
return false;
document.form_orgao.orgao.value.focus();
}
else {
muda_pagina('mn_aps.php?uf='+ campo,'verifica_alarme.php?uf=' + campo);
return true;
}
}
</script>
</head>
<BODY WIDHT=50% topmargin="0" leftmargin="0" background="imagens/fundoko.gif">
<P ALIGN="CENTER">
<!-- ===============INCLUSAO DE CODIGO PARA FLEXIBILIZACAO =========== -->
<?php
echo "<form name=\"form_orgao\" method=\"post\" >"
?>
<table border=1 cellspacing=0 cellpadding=2 bordercolor="#000000">
<tr bgcolor="#ffffff">
<td><table border=0>
<tr bgcolor="#ffffff">
<td colspan=2 align="center">
<font color="#000000" face="Verdana,Arial,Helvetica,sans-serif" size="-1"><b></b></font>
</td>
</tr>
</td>
</tr>
<tr bgcolor="#ffffff">
<td align="right"><font color="#000000" face="arial" size="-1">orgao: </font></td>
<?//php echo "$uf"; ?>
<TD><select name="orgao">
<?php
include("config/conexao.php");
$conexao = conexao();
mysql_select_db(BANCO);
$query = "select distinct(uf) from rede_acesso order by uf";
$result = mysql_query($query,$conexao) or die (mysql_error());
echo "<option selected value=''>Escolha o orgao desejado";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$query_int="select * from entidades where identificador=\"" . $line['uf'] . "\"";
$result2=mysql_query($query_int,$conexao) or die (mysql_error());
while ($line2 = mysql_fetch_array($result2, MYSQL_ASSOC))
printf ("<option value='%s'>%s",$line2['identificador'],$line2['nome_entidade']);
mysql_free_result($result2);
}
mysql_free_result($result);
?>
</select></TD>
<tr bgcolor="#ffffff">
<td colspan=2 align="center"><input type=button value="acessar" onclick="return valida_campo(document.form_orgao.orgao.value);"></td>
</tr>
</table>
</form>
</table>
<?php
/////////////////////// CONFIGURACOES /////////////////////////////////////////////////
$query = "SELECT IpServerMonitora FROM ". CONFIGURACOES . " WHERE codigo = '1'";
$result = mysql_query($query);
list ($IpServerMonitora) = mysql_fetch_array($result,MYSQL_NUM);
define(LinkGraph, ("rrd_graph.php?log=") );
// define(LinkGraph, ("http://" . $IpServerMonitora . "/cocar/teste/graph.php?log=") );
//////////////////////////////////////////////////////////////////////////////////////
if($uf=="")
{
$consulta = "SELECT count(cod_int) FROM " . TABELA . " WHERE IfStatus='UP' AND gerencia!='Entidades Externas'";
$analise = "";
}
else
{
$consulta = "SELECT count(cod_int) FROM " . TABELA . " WHERE uf='$uf' AND IfStatus='UP' AND gerencia!='Entidades Externas'";
$analise = nome_uf($uf);
}
$consulta = mysql_fetch_row(mysql_query($consulta));
$Total = $consulta[0];
echo "<TABLE WIDTH='100%' CELLSPACING='3' BORDER='0'>
<TR><TD ALIGN='left' VALIGN='middle'><H3>Alertas: <FONT COLOR='#FF0000'>$analise</FONT></H3></TD><TD ALIGN='right' VALIGN='middle'><A HREF='javascript:janela();'>Legenda <IMG SRC='imagens/info.gif' BORDER='0' TITLE='Clique para Informações.' ALIGN='middle'></A></TD></TR>";
$qtd_A = ver_trafego("A", "Unidades que Apresentam Tráfego Alto");
$qtd_Z = ver_trafego("Z", "Unidades que Não Apresentam Tráfego");
$qtd_RLY = ver_rly("Unidades com Problemas de Confiabilidade");
$qtd_total = ($qtd_A + $qtd_Z) + $qtd_RLY;
echo "<BR>
<P align='center'>
<B>Total de Unidades com Alerta de Tráfego Irregular<FONT COLOR='#FF3300'> $qtd_total <FONT COLOR='#000000'>de</FONT> $Total</FONT></B>
";
echo "
<table width='490' cellspacing='2' cellpadding='2' ALIGN='center'>
<TR ALIGN='center' VALIGN='middle'>
<TD CLASS='thd ' >Tráfego Alto</TD>
<TD CLASS='thd' >Tráfego Baixo</TD>
<TD CLASS='thd' >Confiabilidade</TD>
</TR>
<TR ALIGN='center' VALIGN='middle'>
<TD CLASS='result' >$qtd_A</TD>
<TD CLASS='result' >$qtd_Z</TD>
<TD CLASS='result'>$qtd_RLY</TD>
</TR>
</table>
";
function ver_trafego($tipo, $INFO)
{
global $uf;
if ($tipo=="A")
{
$classe1 = "alto1";
$classe2 = "alto2";
}
else
{
$classe1 = "zero1";
$classe2 = "zero2";
}
if ($uf=="")
$consulta = "SELECT cod_int, nome, orgao, uf, history, IfAdminStatus, IfOperStatus FROM " . TABELA . " WHERE history LIKE '$tipo%' AND IfStatus='UP' AND gerencia!='Entidades Externas' ORDER BY uf";
else
$consulta = "SELECT cod_int, nome, orgao, uf, history, IfAdminStatus, IfOperStatus FROM " . TABELA . " WHERE history LIKE '$tipo%' AND uf='$uf' AND IfStatus='UP' AND gerencia!='Entidades Externas' ORDER BY nome";
$matrix = mysql_query($consulta);
$tipo .= "1";
$x=1;
$xl=1;
$qtd_err=0;
////////////////////////////////////////////////////
echo "<table border=0 width='100%' CELLSPACING='4'>";
////////////////////////////////////////////////////
echo "<tr><TD height='26' align='center' valign='middle' CLASS='topo' COLSPAN='5'>$INFO</TD></tr>";
while (list ($cod_int, $nome, $orgao, $estado, $history, $IfAdminStatus, $IfOperStatus) = mysql_fetch_array($matrix,MYSQL_NUM))
{
$nome = eregi_replace("APS ", "", $nome);
$link = LinkGraph . $cod_int;
if ($x == 1)
{
echo "<TR>";
$xl++;
}
if($history == $tipo)
$classe = $classe1;
else
$classe = $classe2;
if($uf=="")
$nome .= "/$estado";
echo
"<TD width='25%' height='26' align='center' valign='middle' CLASS='$classe'>\n
<A HREF='javascript:MM_openBrWindow(\"$link\",\"\")'>$nome</A>";
$IfAdminStatus = strtoupper($IfAdminStatus);
$IfOperStatus = strtoupper($IfOperStatus);
if (eregi("Z", $tipo))
{
if($IfAdminStatus!="INAT")
echo "<BR>Adm: $IfAdminStatus - Oper: $IfOperStatus";
else
echo "<BR>Inacessível";
}
echo "</TD>";
$x++;
$qtd_err++;
if ($x == 5)
{
$x = 1;
echo "</TR>";
}
} // FIM DO WHILE QUE PESQUISA NO BANCO
////////////////////////////////////////////////////
echo "</table><BR>";
////////////////////////////////////////////////////
return $qtd_err;
}
function ver_rly($INFO)
{
global $uf;
$classe = "rly";
/*
echo $uf;
echo TABELA;
*/
if ($uf=="")
$consulta = "SELECT cod_int, nome, orgao, uf, rly FROM " . TABELA . " WHERE rly BETWEEN 0 AND 254 AND IfStatus='UP' AND gerencia!='Entidades Externas' AND gerencia !='Firewall' ORDER BY uf";
else
$consulta = "SELECT cod_int, nome, orgao, uf, rly FROM " . TABELA . " WHERE rly BETWEEN 0 AND 254 AND uf='$uf' AND IfStatus='UP' AND gerencia!='Entidades Externas' AND gerencia !='Firewall' ORDER BY nome";
$matrix = mysql_query($consulta);
$x=1; $xl=1; $qtd_err=0;
////////////////////////////////////////////////////
echo "<table border=0 width='100%' CELLSPACING='4'>";
////////////////////////////////////////////////////
echo "<tr><TD height='26' align='center' valign='middle' CLASS='topo' COLSPAN='5'>$INFO</TD></tr>";
while (list ($cod_int, $nome, $orgao, $estado, $rly) = mysql_fetch_array($matrix,MYSQL_NUM))
{
$nome = eregi_replace("APS ", "", $nome);
$link = LinkGraph . $cod_int . "&Rly=ON";
if ($x == 1)
{
echo "<TR>";
$xl++;
}
if($uf=="")
$nome .= "/$estado";
echo "<TD width='25%' height='26' align='center' valign='middle' CLASS='$classe'>\n
<A HREF='javascript:MM_openBrWindow(\"$link\",\"\")'>$nome ($rly)</A></TD>";
$x++;
$qtd_err++;
if ($x == 5)
{
$x = 1;
echo "</TR>";
}
} // FIM DO WHILE QUE PESQUISA NO BANCO
////////////////////////////////////////////////////
echo "</table><BR>";
////////////////////////////////////////////////////
return $qtd_err;
}
function nome_uf($uf)
{
$uf = strtoupper($uf);
switch($uf)
{
case 'AC': $nome_uf = "Acre"; break;
case 'AL': $nome_uf = "Alagoas"; break;
case 'AM': $nome_uf = "Amazonas"; break;
case 'AP': $nome_uf = "Amapa"; break;
case 'BA': $nome_uf = "Bahia"; break;
case 'CE': $nome_uf = "Ceara"; break;
case 'DF': $nome_uf = "Distrito Federal"; break;
case 'ES': $nome_uf = "Espírito Santo"; break;
case 'GO': $nome_uf = "Goiás"; break;
case 'MA': $nome_uf = "Maranhão"; break;
case 'MG': $nome_uf = "Minas Gerais"; break;
case 'MS': $nome_uf = "Mato Grosso Sul"; break;
case 'MT': $nome_uf = "Mato Grosso"; break;
case 'PA': $nome_uf = "Pará"; break;
case 'PB': $nome_uf = "Paraíba"; break;
case 'PE': $nome_uf = "Pernambuco"; break;
case 'PI': $nome_uf = "Piauí"; break;
case 'PR': $nome_uf = "Parana"; break;
case 'RJ': $nome_uf = "Rio de Janeiro"; break;
case 'RN': $nome_uf = "Rio Grande Norte"; break;
case 'RO': $nome_uf = "Rondônia"; break;
case 'RR': $nome_uf = "Rorâima"; break;
case 'RS': $nome_uf = "Rio Grande do Sul"; break;
case 'SC': $nome_uf = "Santa Catarina"; break;
case 'SE': $nome_uf = "Sergipe"; break;
case 'SP': $nome_uf = "São Paulo"; break;
case 'TO': $nome_uf = "Tocantins"; break;
}
return $nome_uf;
}
mysql_close();
?>
<!--===============FIM DE CODIGO PARA FLEXIBILIZACAO =========== -->
</body>
</html>