本文整理汇总了PHP中ossim_db::close方法的典型用法代码示例。如果您正苦于以下问题:PHP ossim_db::close方法的具体用法?PHP ossim_db::close怎么用?PHP ossim_db::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ossim_db
的用法示例。
在下文中一共展示了ossim_db::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_phpgacl_install
function check_phpgacl_install()
{
global $gacl;
$db_table_prefix = $gacl->_db_table_prefix;
require_once "ossim_db.inc";
$db = new ossim_db();
if (!($conn = $db->phpgacl_connect())) {
echo "<p align=\"center\">\n <b>Can't connect to OSSIM acl database (phpgacl)</b><br/>\n Check for phpgacl values at framework configuration\n </p>";
exit;
}
$query1 = OssimQuery("SELECT * FROM acl");
$query2 = OssimQuery("SELECT * FROM " . $db_table_prefix . "_acl");
if (!$conn->Execute($query1) and !$conn->Execute($query2)) {
echo "\n <p align=\"center\"><b>You need to configure phpGACL</b><br/>\n Remember to setup the database connection at phpGACL config files!\n <br/>\n Click <a href=\"/phpgacl/setup.php\">here</a> to enter setup\n </p>\n ";
exit;
}
$db->close($conn);
}
示例2: get_user_icon
function get_user_icon($login, $pro)
{
${$pixmaps} = '../pixmaps/user-green.png';
$db = new ossim_db();
$conn = $db->connect();
$user = Session::get_list($conn, "WHERE login='{$login}'");
if ($pro) {
// Pro-version
if ($login == ACL_DEFAULT_OSSIM_ADMIN || $user[0]->get_is_admin()) {
$pixmaps = '../pixmaps/user-gadmin.png';
} elseif (Acl::is_proadmin($conn, $user[0]->get_login())) {
$pixmaps = '../pixmaps/user-business.png';
}
} else {
// Open Source
if ($login == ACL_DEFAULT_OSSIM_ADMIN || $user[0]->get_is_admin()) {
$pixmaps = "../pixmaps/user-gadmin.png";
}
}
$db->close();
return $pixmaps;
}
示例3: ProcessCriteria
//.........这里部分代码省略.........
// DEPRECATED tcp_join_sql
//if (!$cs->criteria['tcp_flags']->isEmpty() || !$cs->criteria['tcp_field']->isEmpty()) $join_sql = $tcp_join_sql . $join_sql;
}
}
/* ********************** UDP Criteria ********************************************* */
if ($layer4 == "UDP") {
$proto_tmp = "";
/* UDP Ports */
if (FieldRows2sql($udp_port, $udp_port_cnt, $proto_tmp) == 0) {
$cs->criteria['udp_port']->SetFormItemCnt(0);
}
$criteria_sql = $criteria_sql . $proto_tmp;
$proto_tmp = "";
// ********************** DEPRECATED UDP Fields *************************
/* UDP Fields */
//if (FieldRows2sql($udp_field, $udp_field_cnt, $proto_tmp) == 0) $cs->criteria['udp_field']->SetFormItemCnt(0);
//if (!$cs->criteria['udp_port']->isEmpty() || !$cs->criteria['udp_field']->isEmpty()) {
// **********************************************************************
if (!$cs->criteria['udp_port']->isEmpty()) {
$criteria_sql = $criteria_sql . $proto_tmp;
// DEPRECATED udp_join_sql
//if (!$cs->criteria['udp_field']->isEmpty()) $join_sql = $udp_join_sql . $join_sql;
}
}
// DEPRECATED: ICMP
/* ********************** ICMP Criteria ******************************************** */
/*
if ($layer4 == "ICMP") {
$proto_tmp = "";
// ICMP Fields
if (FieldRows2sql($icmp_field, $icmp_field_cnt, $proto_tmp) == 0) $cs->criteria['icmp_field']->SetFormItemCnt(0);
if (!$cs->criteria['icmp_field']->isEmpty()) {
$criteria_sql = $criteria_sql . $proto_tmp;
$join_sql = $icmp_join_sql . $join_sql;
}
}
*/
/* ********************** Packet Scan Criteria ************************************* */
if ($layer4 == "RawIP") {
$proto_tmp = "";
/* RawIP Fields */
if (FieldRows2sql($rawip_field, $rawip_field_cnt, $proto_tmp) == 0) {
$cs->criteria['rawip_field']->SetFormItemCnt(0);
}
if (!$cs->criteria['rawip_field']->isEmpty()) {
$criteria_sql = $criteria_sql . $proto_tmp;
$join_sql = $rawip_join_sql . $join_sql;
}
}
/* ********************** Payload Criteria ***************************************** */
//$tmp_payload = "";
if (DataRows2sql($data, $data_cnt, $data_encode, $tmp_payload) == 0) {
$cs->criteria['data']->SetFormItemCnt(0);
} else {
$use_ac = false;
}
//echo "<br><br><br>";
//print_r($data);
//print_r("data_cnt: [".$data_cnt."]");
//print_r($cs->criteria['data']->isEmpty());
//print_r("criteria_ sql: [".$criteria_sql."]");
//print_r("tmp_payload: [".$tmp_payload."]");
//print_r($data);
if (!$cs->criteria['data']->isEmpty()) {
$sql = "SELECT acid_event.*, HEX(acid_event.ctx) AS ctx, HEX(acid_event.src_host) AS src_host, HEX(acid_event.dst_host) AS dst_host, HEX(acid_event.src_net) AS src_net, HEX(acid_event.dst_net) AS dst_net, extra_data.* FROM acid_event";
if (!preg_match("/extra_data/", $data_join_sql)) {
$data_join_sql .= ",extra_data ";
}
$criteria_sql = $criteria_sql . $tmp_payload;
$use_ac = false;
}
// special distinct for idm_username
if (preg_match("/idm_data/", $data_join_sql)) {
$sql = preg_replace("/^SELECT/", "SELECT DISTINCT", $sql);
}
if ($sig_join) {
$join_sql = $join_sql . $sig_join_sql;
}
$join_sql = $join_sql . $data_join_sql;
$csql[0] = $join_sql;
// Ready to ac_acid_event
$criteria1_sql = $criteria_sql . preg_replace("/ \\d\\d:\\d\\d:\\d\\d/", "", str_replace("timestamp", "day", $real_time_meta));
$criteria1_sql = preg_replace("/AND\\s+\\)/", " )", preg_replace("/OR\\s+\\)/", " )", $criteria1_sql));
// Ready to ac_acid_event next day
$criteria2_sql = $criteria_sql . preg_replace("/ \\d\\d:\\d\\d:\\d\\d/", "", str_replace("timestamp", "day", $time_meta));
$criteria2_sql = preg_replace("/AND\\s+\\)/", " )", preg_replace("/OR\\s+\\)/", " )", $criteria2_sql));
// to acid_event
$criteria_sql = $criteria_sql . $time_meta;
$criteria_sql = preg_replace("/AND\\s+\\)/", " )", preg_replace("/OR\\s+\\)/", " )", $criteria_sql));
$csql[1] = $criteria_sql;
$csql[2] = $perms_sql . preg_replace("/ \\d\\d:\\d\\d:\\d\\d/", "", str_replace("timestamp", "day", $time_meta));
// $real_time_criteria
$csql[3] = $use_ac;
// true if we use ac_acid_event instead acid_event
$csql[4] = $criteria1_sql;
$csql[5] = $criteria2_sql;
$db_aux->close();
//print_r($csql);
return $csql;
}
示例4: saveprefs
case "saveprefs":
saveprefs($sid);
break;
case "update":
$stype = "";
if (intval($user) != -1) {
$stype = $user;
} elseif (intval($entity) != -1) {
$stype = $entity;
}
if ($stype == "") {
$stype = Session::get_session_user();
}
update_profile($sid, $sname, $sdescription, $stype, $sautoenable, $auto_cat_status, $auto_fam_status, $tracker);
break;
case "updateusers":
update_users($sid, $users);
break;
case "viewconfig":
view_config($sid);
break;
default:
select_profile();
break;
}
echo " </td></tr>";
echo " </table>";
echo "</td></tr>";
echo "</table>";
$db->close($dbconn);
require_once 'footer.php';
示例5: _
echo _('Reference SID Name');
?>
</th>
<td id="sid2" class="left">
<span style='font-style:italic;'><?php
echo _('Please, select Reference Data Source Name');
?>
</span>
</td>
</tr>
<tr>
<td colspan="2" class="noborder" style="padding: 10px;">
<input type="button" id='back' name='back' class='av_b_secondary' onclick="document.location.href='pluginref.php'" value="<?php
echo _("Back");
?>
"/>
<input type="submit" id='send' name='send' value="<?php
echo $button_text;
?>
"/>
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
$db->close();
示例6: unset
if (preg_match("/^(_|alarms_|back_list|current_cview|views|ports_cache|acid_|report_|graph_radar|siem_event|deletetask|mdspw).*/", $k)) {
unset($session_data[$k]);
}
}
$_SESSION['views']['default']['data'] = $session_data;
$config->set($login, 'custom_views', $_SESSION['views'], 'php', 'siem');
}
if ($_GET["search_str"] == "search term") {
unset($_GET["search_str"]);
}
// resolv host2ip if needed
if ($_GET["search_str"] != "" && preg_match("/.*IP/", $_GET["submit"]) && !preg_match("/\\d+\\.\\d+(\\.\\d+\\.\\d+)?/", $_GET["search_str"])) {
include_once "classes/Host.inc";
$_GET["search_str"] = Host::hostname2ip($conn_aux, $_GET["search_str"], true);
}
$db_aux->close($conn_aux);
if ($_SESSION['view_name_changed']) {
$_GET['custom_view'] = $_SESSION['view_name_changed'];
$_SESSION['view_name_changed'] = "";
$_SESSION['norefresh'] = 1;
} else {
$_SESSION['norefresh'] = "";
}
$custom_view = $_GET['custom_view'];
if ($custom_view != "") {
$_SESSION['current_cview'] = $custom_view;
if (is_array($_SESSION['views'][$custom_view]['data'])) {
foreach ($_SESSION['views'][$custom_view]['data'] as $skey => $sval) {
if (!preg_match("/^(_|alarms_|back_list|current_cview|views|ports_cache|acid_|report_|graph_radar|siem_event|deletetask|mdspw).*/", $skey)) {
$_SESSION[$skey] = $sval;
} else {
示例7: array
}
// Conversion: Searching by IP, but Host selected
if ($_GET["search_str"] != "" && in_array($_GET["submit"], $host_submit) && preg_match("/^\\!?\\d+\\.\\d+\\.\\d+\\.\\d+\$/", $_GET["search_str"])) {
$_GET['submit'] = str_replace(" Host", " IP", $_GET['submit']);
}
// Hostname
if ($_GET["search_str"] != "" && in_array($_GET["submit"], $host_submit) && !preg_match("/\\d+\\.\\d+\\.\\d+\\.\\d+/", $_GET["search_str"])) {
$negated_op = preg_match('/^\\!/', $_GET["search_str"]) ? 'NOT IN' : 'IN';
$_GET["search_str"] = Util::htmlentities(preg_replace("/[^0-9A-Za-z\\!\\-\\_\\.]/", "", $_GET["search_str"]));
// htmlentities for fortify test
$hids = Asset_host::get_id_by_name($conn_aux, $_GET["search_str"]);
$htype = $_GET["submit"] == _("Src or Dst Host") ? "both" : ($_GET["submit"] == _("Src Host") ? "src" : "dst");
$_SESSION["hostid"] = array(array_shift(array_keys($hids)), $_GET["search_str"], $htype, $negated_op);
unset($_GET["search_str"]);
}
$db_aux->close();
if ($_SESSION['view_name_changed']) {
$_GET['custom_view'] = $_SESSION['view_name_changed'];
$_SESSION['view_name_changed'] = "";
$_SESSION['norefresh'] = 1;
} else {
$_SESSION['norefresh'] = "";
}
$custom_view = $_GET['custom_view'];
ossim_valid($custom_view, OSS_NULLABLE, OSS_ALPHA, OSS_SPACE, OSS_PUNC, "Invalid: custom_view");
if (ossim_error()) {
die(ossim_error());
}
if ($custom_view != "") {
$_SESSION['current_cview'] = Util::htmlentities($custom_view);
if (is_array($_SESSION['views'][$custom_view]['data'])) {
示例8: SendHeader
//.........这里部分代码省略.........
send($(this).val(), $('#interface option:selected').text());
});
<?php
if (isset($_POST['ip'])) {
?>
send('<?php
echo Util::htmlentities($_POST['ip']);
?>
', $('#interface option:selected').text());
<?php
}
?>
// ************
$('.scriptinfo').tipTip({
defaultPosition: "down",
content: function (e) {
var ip_data = $(this).attr('data-title');
ip_data = ip_data.split('-');
$.ajax({
url: '../alarm/alarm_netlookup.php?ip=' + ip_data[0],
success: function (response) {
e.content.html(response); // the var e is the callback function data (see above)
}
});
return '<?php
echo _("Searching") . "...";
?>
'; // We temporary show a Please wait text until the ajax success callback is called.
}
});
$(".repinfo").tipTip({
defaultPosition: 'left',
content: function (e) {
return $(this).attr('txt');
}
});
$('#filter').on('keyup', function(e){
$(this).val(function(i, val) {
return val.replace(/[\t\r\b]/g, '');
});
});
<?php
if (GET('ip') != "") {
?>
$("#process_button").click();
<?php
}
?>
}
function lastsessions() {
$('#modeselect0').click();
$("#listN option[value='3']").attr('selected', 'selected');
$("#process_button").click();
}
function launch(val,order) {
$('#modeselect1').click();
$("#TopN option[value='0']").attr('selected', 'selected');
$("#StatTypeSelector option[value='"+val+"']").attr('selected', 'selected');
$("#statorder option[value='"+order+"']").attr('selected', 'selected');
$("#process_button").click();
}
function remote_interface(ip) {
$("#FlowProcessingForm").attr("action", "menu.php");
$("#FlowProcessingForm").attr("target", "menu_nfsen");
$("#FlowProcessingForm").append("<input type='hidden' name='process' value='Process' />");
$("#FlowProcessingForm").append("<input type='hidden' name='ip' value='"+ip+"' />");
$("#FlowProcessingForm").submit();
}
function clean_remote_data() {
$("#FlowProcessingForm").removeAttr("target");
$("#FlowProcessingForm").attr("action", $("#FlowProcessingForm").attr("laction")); // set the local action
}
</script>
</head>
<body>
<?php
$db_aux = new ossim_db();
$conn_aux = $db_aux->connect();
$aux_ri_interfaces = Remote_interface::get_list($conn_aux, "WHERE status = 1");
$ri_list = $aux_ri_interfaces[0];
$ri_total = $aux_ri_interfaces[1];
$db_aux->close();
if (Session::am_i_admin() && count($ri_total) > 0) {
include 'menu.php';
}
}
示例9: gettext
</tr>
<tr>
<td style="' . $td_style . ' width: 27mm;" class="noborder"><strong>' . gettext("Source ports") . ':</strong></td>
<td colspan="3" style="' . $td_style . ' width: 66mm;" class="noborder">' . $value['SourcePorts'] . '</td>
</tr>
<tr>
<td style="' . $td_style . ' width: 27mm;"><strong>' . gettext("Destination ports") . ':</strong></td>
<td colspan="3" style="' . $td_style . ' width: 66mm;" class="noborder">' . $value['DestinationPorts'] . '</td>
</tr>
<tr>
<td style="' . $td_style . ' width: 27mm;"><strong>' . gettext("In charge") . ':</strong></td>
<td colspan="3" style="' . $td_style . ' width: 66mm;" class="noborder">' . Util::wordwrap($value['InCharge'], 35, "<br/>", true) . '</td>
</tr>
</table>
</td>
');
if ($c % 2 != 0) {
$htmlPdfReport->set('</tr>');
}
$c++;
}
if ($c % 2 != 0) {
$htmlPdfReport->set('
<td></td>
</tr>');
}
$htmlPdfReport->set('</table><br/><br/>');
}
}
$db->close($conn1);
示例10: ReadProfile
function ReadProfile($profileswitch)
{
// User sensors filtering
require_once 'classes/Session.inc';
require_once 'classes/Sensor.inc';
require_once 'ossim_db.inc';
$db_aux = new ossim_db();
$conn_aux = $db_aux->connect();
$sensors_list = Sensor::get_list($conn_aux);
$db_aux->close($conn_aux);
$opts['profile'] = $profileswitch;
$profileinfo = nfsend_query("get-profile", $opts, 0);
if (!is_array($profileinfo)) {
return false;
}
if (!array_key_exists('description', $profileinfo)) {
$profileinfo['description'] = array();
}
$channels = array();
// in case it's a new profile with no channels associated yet
if (!array_key_exists('channel', $profileinfo)) {
$profileinfo['channel'] = $channels;
}
// Decode channel information
foreach ($profileinfo['channel'] as $channel) {
list($name, $sign, $colour, $order, $sourcelist) = explode(":", $channel);
$has_perm = 0;
foreach ($sensors_list as $s) {
if ($name == $s->get_name()) {
$has_perm = 1;
}
}
if (Session::am_i_admin()) {
$has_perm = 1;
}
if (!$has_perm) {
continue;
}
$_tmp = array();
$_tmp['name'] = $name;
$_tmp['sign'] = $sign;
$_tmp['colour'] = $colour;
$_tmp['order'] = $order;
$_tmp['sourcelist'] = $sourcelist;
$channels[$name] = $_tmp;
}
$profileinfo['channel'] = $channels;
return $profileinfo;
}
示例11: allowed_nfsen_section
function allowed_nfsen_section()
{
if (Session::am_i_admin()) {
return true;
}
require_once 'ossim_db.inc';
$db = new ossim_db();
$conn = $db->connect();
$flag = true;
// Decode channel information
foreach ($_SESSION['profileinfo']['all_channels'] as $channel) {
if (!Av_sensor::is_channel_allowed($conn, $channel)) {
$flag = false;
break;
}
}
$db->close();
return $flag;
}
示例12: SIEM_trends
/**
* This function gets the SIEM trends in hours
*
* @param $h Number of hours of the trend
* @param $assets_filters [Optional] Asset filter applied
*
* @return An array with the result of the query that contains the data of the trend
*/
function SIEM_trends($h = 24, $assets_filters = '', $first_date = '')
{
global $tz;
//Cache file
$file = '_siem_events_' . Session::get_session_user() . '_';
$file .= md5($h . '_' . serialize($assets_filters));
$data = Cache_file::get_asset_data($file, 300);
if (is_array($data)) {
return $data;
}
$db = new ossim_db(TRUE);
$dbconn = $db->connect();
$tzc = Util::get_tzc($tz);
$data = array();
//Filters of assets
if (empty($assets_filters)) {
$assets_filters['assets'] = array();
$assets_filters['ctxs'] = array();
}
$query_where = Security_report::make_where($dbconn, gmdate("Y-m-d H:00:00", gmdate("U") - 3600 * $h), gmdate("Y-m-d H:59:59"), array(), $assets_filters);
$sqlgraph = "SELECT SUM(cnt) AS num_events, hour(convert_tz(timestamp,'+00:00','{$tzc}')) AS intervalo, day(convert_tz(timestamp,'+00:00','{$tzc}')) AS suf \n FROM alienvault_siem.ac_acid_event as acid_event WHERE 1=1 {$query_where} GROUP BY suf,intervalo";
if ($first_date) {
// Test if we have enough data in ac_acid_event
$query = "select cnt from alienvault_siem.ac_acid_event where timestamp between '{$first_date}:00:00' and '{$first_date}:59:59' limit 1";
$rg = $dbconn->CacheExecute($query);
if (!$rg) {
print $dbconn->ErrorMsg();
}
if ($rg->EOF) {
// Test if we have enough data in acid_event
$query = "select hex(id) from alienvault_siem.acid_event where timestamp between '{$first_date}:00:00' and '{$first_date}:59:59' limit 1";
$rg = $dbconn->CacheExecute($query);
if (!$rg) {
print $dbconn->ErrorMsg();
}
if (!$rg->EOF) {
$sqlgraph = "SELECT COUNT(acid_event.id) AS num_events, hour(convert_tz(timestamp,'+00:00','{$tzc}')) AS intervalo, day(convert_tz(timestamp,'+00:00','{$tzc}')) AS suf \n FROM alienvault_siem.acid_event WHERE 1=1 {$query_where} GROUP BY suf,intervalo";
}
}
}
$rg = $dbconn->CacheExecute($sqlgraph);
if (!$rg) {
print $dbconn->ErrorMsg();
} else {
while (!$rg->EOF) {
$data[$rg->fields['suf'] . ' ' . $rg->fields['intervalo'] . 'h'] = $rg->fields['num_events'];
$rg->MoveNext();
}
}
$db->close();
Cache_file::save_file($file, $data);
return $data;
}
示例13: substr
}
while (!$rs->EOF) {
$values .= $rs->fields["num_events"] . ",";
$name = Util::signaturefilter($rs->fields["name"]);
if (strlen($name) > 35) {
$name = substr($name, 0, 35) . "..";
}
$txts .= "'" . str_replace("'", "\\'", $name) . "',";
$urls .= GET("type") == "alarms" ? str_replace("QQQ", $rs->fields["name"], $link) : str_replace("QQQ", $rs->fields["plugin_id"] . "%3B" . $rs->fields["sid"], $link);
$rs->MoveNext();
}
$values = preg_replace("/,\$/", "", $values);
$txts = preg_replace("/,\$/", "", $txts);
$urls = preg_replace("/,\$/", "", $urls);
//
$db->close($conn);
$db->close($conn2);
//
?>
<script class="code" type="text/javascript">
var links = [<?php
echo $urls;
?>
];
function myClickHandler(ev, gridpos, datapos, neighbor, plot) {
//mouseX = ev.pageX; mouseY = ev.pageY;
url = links[neighbor.pointIndex];
if (neighbor.seriesIndex==1) url = '../incidents/index.php?status=&hmenu=Tickets&smenu=Tickets';
示例14: gettext
<td>
<table style="background-color:#8F6259" height="100%" cellpadding="5">
<tr><td style="font-size:18px;font-weight:bold;color:#EEEEEE;text-align:left;padding-left:10px"><?php
echo gettext("Logger");
?>
</td></tr>
<tr><td class="nobborder"><?php
include "host_report_sem.php";
?>
</td></tr>
<script type="text/javascript">$("#pbar").progressBar(99);$("#progressText").html('<b><?php
echo gettext("Finishing");
?>
</b>...');</script>
<?php
ob_flush();
flush();
usleep(500000);
?>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
<?php
$db->close($conn);
$db->close($conn_snort);
ob_end_flush();
示例15: less_stable_services
function less_stable_services()
{
global $NUM_HOSTS;
/* opennms db connect */
$opennms_db = new ossim_db();
$opennms_conn = $opennms_db->opennms_connect();
$query = OssimQuery("SELECT servicename, count(servicename) \n FROM ifservices ifs, service s \n WHERE ifs.serviceid = s.serviceid AND ifs.status = 'D' \n GROUP BY servicename ORDER BY count(servicename) DESC \n LIMIT {$NUM_HOSTS}");
$rs =& $opennms_conn->Execute($query);
if (!$rs) {
print $opennms_conn->ErrorMsg();
} else {
?>
<h2><?php
echo _("Top");
?>
<?php
echo "{$NUM_HOSTS}";
?>
<?php
echo _("less stable services");
?>
</h2>
<table align="center">
<tr>
<th> <?php
echo gettext("Service");
?>
</th>
<th> <?php
echo gettext("Ocurrences");
?>
</th>
</tr>
<?php
while (!$rs->EOF) {
$service = $rs->fields["servicename"];
$occurrences = number_format($rs->fields["count"], 0, ",", ".");
?>
<tr>
<td><?php
echo $service;
?>
</td>
<td><?php
echo $occurrences;
?>
</td>
</tr>
<?php
$rs->MoveNext();
}
}
$opennms_db->close($opennms_conn);
echo "</table><br/>\n";
}