Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "conn_string.php";
- ?>
- <html>
- <head>
- <!--Load the AJAX API-->
- <script type="text/javascript" src="jsapi.js"></script>
- <script type="text/javascript" src="jquery-1.7.1.min.js"></script>
- <script type="text/javascript">
- // Load the Visualization API and the package.
- google.load('visualization', '1', {'packages':['corechart']});
- // Set a callback to run when the Google Visualization API is loaded.
- google.setOnLoadCallback(drawChart);
- function drawChart() {
- var data = google.visualization.arrayToDataTable([
- ['Time', 'Bots', 'Openresolvers', 'Proxy', 'Malwareurl', 'Phishing', 'Bruteforce', 'Scanners', 'Spam']
- <?php
- $sql_query = "
- SELECT DATE_FORMAT(time, '%Y-%m-%d') AS time,
- SUM(CASE WHEN report = 'bots' THEN ipc ELSE 0 END) AS bots,
- SUM(CASE WHEN report = 'openresolvers' THEN ipc ELSE 0 END) AS openresolvers,
- SUM(CASE WHEN report = 'proxy' THEN ipc ELSE 0 END) AS proxy,
- SUM(CASE WHEN report = 'malwareurl' THEN ipc ELSE 0 END) AS malwareurl,
- SUM(CASE WHEN report = 'phishing' THEN ipc ELSE 0 END) AS phishing,
- SUM(CASE WHEN report = 'bruteforce' THEN ipc ELSE 0 END) AS bruteforce,
- SUM(CASE WHEN report = 'scanners' THEN ipc ELSE 0 END) AS scanners,
- SUM(CASE WHEN report = 'spam' THEN ipc ELSE 0 END) AS spam
- FROM (
- SELECT count(ip) AS ipc, report, DATE(time) as time
- FROM asn_data
- GROUP BY report, DATE(time)) i
- GROUP BY time;
- ";
- $result = mysql_query($sql_query);
- while($row = mysql_fetch_assoc($result)){
- echo ",['{$row['time']}',{$row['bots']},{$row['openresolvers']},{$row['proxy']},{$row['malwareurl']},{$row['phishing']},{$row['br
- uteforce']},{$row['scanners']},{$row['spam']}]\r\n";
- }
- ?>
- ]);
- var options = {
- title : 'Category Counts',
- vAxis: {title: "Counts"},
- hAxis: {title: "Date"},
- seriesType: "bars",
- series: {5: {type: "line"}}
- };
- var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
- chart.draw(data, options);
- }
- </script>
- </head>
- <body>
- <br>
- <div id="chart_div"></div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment