Chce zaimplementować gotowy skrypt pokazujący przepustowość łącza na interfejsie w postaci wykresu.
Projekt te znajduje się w tym odośniku http://www.codejungle.org/site/Realtime+ba...and+jquery.html
Gdy odpalam projekt jako nowy VirtualnyHost w serwerze apache i podaje scieżke do pliku index.php z projektu to wtedy wykres działa poprawnie.
Problem zaczyna się gdy skopiuje dany skrypt javy z pliku index.php do mojego projektu to wtedy wykres wgl się nie tworzy. Nie mam pojęcia czym to jest spowodowane. Z góry dziękuje za pomoc.
Poniżej wycinek mojego kodu z projektu gdzie ma być utworzony wykres.
Kod
<?php
session_start();
session_destroy();
session_start();
?>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery.flot.js"></script>
<script id="source" language="javascript" type="text/javascript">
$(document).ready(function() {
var options = {
lines: { show: true },
points: { show: true },
xaxis: { mode: "time" }
};
var data = [];
var placeholder = $("#placeholder");
$.plot(placeholder, data, options);
var iteration = 0;
function fetchData() {
++iteration;
function onDataReceived(series) {
// we get all the data in one go, if we only got partial
// data, we could merge it with what we already got
data = [ series ];
$.plot($("#placeholder"), data, options);
}
$.ajax({
url: "data.php",
method: 'GET',
dataType: 'json',
success: onDataReceived
});
setTimeout(fetchData, 1060);
}
setTimeout(fetchData, 1000);
});
</script>
</head>
<body>
<div id="pan-l" class="well">
<span id="cos"><h4>ATTACKERS</h4></span> <a href="index.php?id=3" > <i class=" glyphicon glyphicon-user " style="color:white; font-size: 60px"></i></span></a><span class="badge" style="font-size: 25px"><?php $output = shell_exec('sudo ./scr1');
echo $output; ?></span>
</div>
<div id="pan-l-1" class="well">
<span id="cos"><h4>BLOCKED_IP</h4></span> <a href="index.php?id=1" > <i class=" fa fa-lock " style="color:white; font-size: 75px"></i></span></a><span class="badge" style="font-size: 25px"><?php $output3 = shell_exec('sudo ./scr1');
echo $output3; ?></span>
</div>
<div id="pan-l-2" class="well">
<span id="cos"><h4>TOP_SIGNATURES</h4></span> <a href="index.php?id=2" > <i class="fa fa-list" style="color:white; font-size: 65px"></i></span></a><span class="badge" style="font-size: 25px"><?php $output2 = shell_exec('sudo ./scr2');
echo $output2; ?></span>
</div>
<div id="pan-l-3" class="well">
<div class="row">
<div class="col-md-5">
<span id="cos"><h4>WAŻNE INFO</h4></span>
<i class="glyphicon glyphicon-info-sign" style="color:white; font-size: 65px"></i></span><span id="cos"></span>
</div>
<div class="col-md-7">
<span id="cos">Zal z IP: </span>
<span id="cos2">
<?php
$a=$_SERVER['REMOTE_ADDR'];
echo $a;
?></span><br>
<span id="cos">Ost. aktu. sygnatur:</span><br>
<span id="cos2">
<?php
$fp = fopen("d_upd", "r");
$dane = fread($fp, filesize("d_upd"));
fclose($fp);
echo $dane;
?></span>
</div>
<br><br>
</div>
</div>
<br><br>
<div id="placeholder" style="width:600px;height:300px;"></div>
</body>
</html>
session_start();
session_destroy();
session_start();
?>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery.flot.js"></script>
<script id="source" language="javascript" type="text/javascript">
$(document).ready(function() {
var options = {
lines: { show: true },
points: { show: true },
xaxis: { mode: "time" }
};
var data = [];
var placeholder = $("#placeholder");
$.plot(placeholder, data, options);
var iteration = 0;
function fetchData() {
++iteration;
function onDataReceived(series) {
// we get all the data in one go, if we only got partial
// data, we could merge it with what we already got
data = [ series ];
$.plot($("#placeholder"), data, options);
}
$.ajax({
url: "data.php",
method: 'GET',
dataType: 'json',
success: onDataReceived
});
setTimeout(fetchData, 1060);
}
setTimeout(fetchData, 1000);
});
</script>
</head>
<body>
<div id="pan-l" class="well">
<span id="cos"><h4>ATTACKERS</h4></span> <a href="index.php?id=3" > <i class=" glyphicon glyphicon-user " style="color:white; font-size: 60px"></i></span></a><span class="badge" style="font-size: 25px"><?php $output = shell_exec('sudo ./scr1');
echo $output; ?></span>
</div>
<div id="pan-l-1" class="well">
<span id="cos"><h4>BLOCKED_IP</h4></span> <a href="index.php?id=1" > <i class=" fa fa-lock " style="color:white; font-size: 75px"></i></span></a><span class="badge" style="font-size: 25px"><?php $output3 = shell_exec('sudo ./scr1');
echo $output3; ?></span>
</div>
<div id="pan-l-2" class="well">
<span id="cos"><h4>TOP_SIGNATURES</h4></span> <a href="index.php?id=2" > <i class="fa fa-list" style="color:white; font-size: 65px"></i></span></a><span class="badge" style="font-size: 25px"><?php $output2 = shell_exec('sudo ./scr2');
echo $output2; ?></span>
</div>
<div id="pan-l-3" class="well">
<div class="row">
<div class="col-md-5">
<span id="cos"><h4>WAŻNE INFO</h4></span>
<i class="glyphicon glyphicon-info-sign" style="color:white; font-size: 65px"></i></span><span id="cos"></span>
</div>
<div class="col-md-7">
<span id="cos">Zal z IP: </span>
<span id="cos2">
<?php
$a=$_SERVER['REMOTE_ADDR'];
echo $a;
?></span><br>
<span id="cos">Ost. aktu. sygnatur:</span><br>
<span id="cos2">
<?php
$fp = fopen("d_upd", "r");
$dane = fread($fp, filesize("d_upd"));
fclose($fp);
echo $dane;
?></span>
</div>
<br><br>
</div>
</div>
<br><br>
<div id="placeholder" style="width:600px;height:300px;"></div>
</body>
</html>