Select Git revision
-
David Sehnal authoredDavid Sehnal authored
show_SourceActivity.php 1.57 KiB
<?
include("db.php");
$db=$db;
if(IsSet($_GET['source']) && !IsSet($_POST['source'])) {
$_POST['source'] = $_GET['source'];
$_POST['limit'] = "";
$_POST['btnSubmit'] = "Submit";
}
#http://www.midnighthax.com/quickform.php
require_once "HTML/QuickForm.php";
print json_encode(($_POST));
if(IsSet($_POST['limit']) && !is_numeric($_POST['limit'])){
$_POST['limit'] = 5000;
}
?>
<table width="100%" border=1>
<tr><td width="1px">
<?
$form = new HTML_QuickForm('formRemote', 'post');
$form->addElement('text', 'source', 'source');
$form->addElement('text', 'limit', 'limit');
$form->addElement('submit', 'btnSubmit', 'Submit');
$form->display();
?>
</td><td width=1px>COSI
<?
#fuck mvc
?>
</td><td>
<?
if(! empty($_POST["source"])) {
print("<iframe src=\"graph_SourceActivity_html.php?per=day&source=".$_POST['source']."\" style=\"width:100%; height:500\"></iframe>");
}
?>
</td>
</tr>
</table>
<hr>
<?
#TODO: strip vsechny superznaky
if( IsSet($_POST["btnSubmit"])) {
if( ! empty($_POST['source'])) {
$where = "source like'".$_POST['source']."'";
//$where = "source like '".$_POST['source']."%'";
$q = "SELECT * FROM events WHERE $where ORDER BY detected DESC LIMIT ".$_POST['limit'];
$res = mysql_query($q, $db);
print "Query: ".json_encode($q)."<br>";
print "Found: ".mysql_num_rows($res)."<br>";
print("<pre>");
while ($tmp = mysql_fetch_assoc($res)) {
#var_dump($tmp);
print json_encode(view_recode($tmp))."\n";
}
print("</pre>");
}