mysql_select_db($mysqlDbName, $con); if (!$con) { die('Could not connect to MySQL: ' . mysql_error()); } } // Insert Sensor if needed. Get Sensor information if (DEBUG) { echo "Insert sensor, if needed\n"; } $scanner = $client->scannerOpenWithStop("hogzilla_sensor", "", "", array("sensor:description", "sensor:hostname"), array()); $row = $client->scannerGet($scanner); if (sizeof($row) == 0) { die("Sensor table is empty in HBase. Hogzilla didn't run for the first time.\n"); } if (MYSQL) { saveSensor($row, $con); } $client->scannerClose($scanner); saveSignaturesIfNeeded($con); // Close everything if (DEBUG) { echo "Close connections\n"; } if (MYSQL) { mysql_close($con); } $transport->close(); /* * INFITY LOOP PHASE: fetch events from HBase, insert into MySQL, wait $waitTime and do everything again... */ while (true) {
if ($typeCount == $key + 1) { print "Invalid sensor type!"; break 2; } } if ($_POST['clientIPinHeader'] == "1") { $clientIpInHeader = true; $clientIpHeader = @sanitize_paranoid_string($_POST['clientIPHeader'], $min = '2', $max = '40'); } else { $clientIpInHeader = false; $clientIpHeader = null; } $sensorDescription = @sanitize_paranoid_string($_POST['Description']); $sensorToSave = "new"; if ($sensorToSave) { $sensorSaveResult = saveSensor($sensorToSave, $sensorName, $sensorIp, $sensorDescription, $sensorType, $sensorPass, $clientIpInHeader, $clientIpHeader); if (!$sensorSaveResult) { print $sensorSaveResult; } } } } while (false); } elseif (isset($_GET['u'])) { // Users Tasks // Delete a user do { if (isset($_GET['Delete']) and isset($_GET['User']) and $_GET['User'] > 1) { $userToDelete = @sanitize_int($_GET['User'], $min = '2'); if ($userToDelete == 1) { print "User Admin cannot be deleted!"; break;