当前位置: 首页>>代码示例>>PHP>>正文


PHP DbQuery函数代码示例

本文整理汇总了PHP中DbQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP DbQuery函数的具体用法?PHP DbQuery怎么用?PHP DbQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DbQuery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: user_from_ldap_servers

/**
 * ldap by Stephane Garret & vtur
 * Check all the directories. When the user is found, then import it
 * @param $login : user login
 * @param $password : user password 
 * @param $import : import user or check
**/
function user_from_ldap_servers($login, $password = '', $import = true)
{
    global $ldapsrv, $user_dn, $fields;
    global $dbhost, $dbuser, $dbpass, $dbname;
    // search if user exist in local user DB
    $link = DbConnect($dbhost, $dbuser, $dbpass, $dbname);
    $query = GenQuery('users', 's', '*', '', '', array('user'), array('='), array($login));
    $res = DbQuery($query, $link);
    if ($import) {
        if (DbNumRows($res) == 0) {
            $result = ldapFindDn($login);
            if ($result != false) {
                return $result;
            }
        }
        return false;
    } else {
        $result = ldapFindDn($login);
        if ($result != false) {
            $ds1 = connect_ldap($ldapsrv[0], $ldapsrv[1], $user_dn, $password, 0, 0);
            if ($ds1) {
                //Authetication OK for user
                return true;
            } else {
                //Authetication Failed for user
                return false;
            }
        }
    }
    return false;
}
开发者ID:pl0o0f,项目名称:nedi-puppet,代码行数:38,代码来源:libldap.php

示例2: AddRecord

function AddRecord($table, $key, $col, $val)
{
    global $link, $alrlbl, $addlbl;
    $mres = DbQuery("SELECT * FROM {$table} WHERE {$key}", $link);
    if ($mres) {
        if (DbNumRows($mres)) {
            $status = "<img src=\"img/16/bdis.png\" title=\"{$alrlbl} OK\" vspace=\"4\">";
        } else {
            if (!DbQuery("INSERT INTO {$table} ({$col}) VALUES ({$val})", $link)) {
                $status = "<img src=\"img/16/bcnl.png\" title=\"" . DbError($link) . "\" vspace=\"4\">";
            } else {
                $status = "<img src=\"img/16/bchk.png\" title=\"{$addlbl} OK\" vspace=\"4\">";
            }
        }
    } else {
        print DbError($link);
    }
    return $status;
}
开发者ID:pl0o0f,项目名称:nedi-puppet,代码行数:19,代码来源:libdb-pg.php

示例3: while

    ?>
</th>

<?php 
    $row = 0;
    while ($s = DbFetchRow($res)) {
        if ($row % 2) {
            $bg = "txta";
            $bi = "imga";
        } else {
            $bg = "txtb";
            $bi = "imgb";
        }
        $row++;
        $nquery = GenQuery('nodes', 's', '*', '', '', array('mac'), array('='), array($s[2]));
        $nres = DbQuery($nquery, $link);
        $nnod = DbNumRows($nres);
        if ($nnod == 1) {
            $n = DbFetchRow($nres);
            DbFreeResult($nres);
        } else {
            $n = array($s[0], $s[1], $s[2], '-', 0, 0, 'Not in nodes', '-');
        }
        $dbna = preg_replace("/^(.*?)\\.(.*)/", "\$1", $n[0]);
        $dbip = long2ip($n[1]);
        $img = Nimg("{$n['2']};{$n['3']}");
        $ls = date("r", $n[5]);
        list($fc, $lc) = Agecol($n[4], $n[5], $row % 2);
        $na = preg_replace("/^(.*?)\\.(.*)/", "\$1", $s[0]);
        $ip = long2ip($s[1]);
        $sup = date("r", $s[6]);
开发者ID:pl0o0f,项目名称:nedi-puppet,代码行数:31,代码来源:Nodes-Stolen.php

示例4: str_replace

						$stppri	= str_replace('"','', Get($ip, $dev[14] & 3, $dev[15], "1.3.6.1.2.1.17.2.2.0") );
						if( preg_match("/^No Such|^$/",$stppri) ){
							TblCell("?");
						}else{
							$numchg	= str_replace('"','', Get($ip, $dev[14] & 3, $dev[15], "1.3.6.1.2.1.17.2.4.0") );
							if( preg_match("/^No Such|^$/",$numchg) ){
								TblCell("TC:?");
							}else{
								$laschg	= str_replace('"','', Get($ip, $dev[14] & 3, $dev[15], "1.3.6.1.2.1.17.2.3.0") );
								sscanf($laschg, "%d:%d:%0d:%0d.%d",$tcd,$tch,$tcm,$tcs,$ticks);
								$tcstr  = sprintf("%dD-%d:%02d:%02d",$tcd,$tch,$tcm,$tcs);
								$rport	= str_replace('"','', Get($ip, $dev[14] & 3, $dev[15], "1.3.6.1.2.1.17.2.7.0") );
								if($rport){
									$rootif	 = str_replace('"','', Get($ip, $dev[14] & 3, $dev[15], "1.3.6.1.2.1.17.1.4.1.2.$rport") );
									$ifquery = GenQuery('interfaces','s','*','','',array('device','ifidx'),array('=','='),array($dev[0],$rootif),array('AND') );
									$ifres	 = DbQuery($ifquery,$link);
									if(DbNumRows($ifres) == 1){
										$if = DbFetchRow($ifres);
										$it = "RP:<span class=\"grn\">$if[1] <i>$if[7]</i></span>";
									}else{
										$it = "Rootport n/a!";
									}
								}else{
									$it = "<span class=\"drd\">Root</span>";
								}
								TblCell("$prilbl:<span class=\"prp\">$stppri</span> $it TC:<span class=\"blu\">$numchg</span> $tcstr","","","<a href=\"Topology-Spanningtree.php?dev=$ud\"><img src=\"img/16/traf.png\" title=\"Topology-Spanningtree\"></a>");
							}
						}
					}else{
						TblCell("-");
					}
开发者ID:pl0o0f,项目名称:nedi-puppet,代码行数:31,代码来源:Devices-List.php

示例5: DbDump

function DbDump($tables, $link, $outfile)
{
    // The dump file is created and opened
    $sqlfile = fopen($outfile, "w");
    // The comment header for the MySQL dump is created...
    $sql = "--\n";
    $sql .= "-- NeDi MySQL Dump - " . date("d M Y H:i") . "\n";
    $sql .= "-- ------------------------------------------------------\n\n";
    // ...and written to the file
    fwrite($sqlfile, $sql);
    $sql = "";
    // All the tables are dumped one after the other
    foreach ($tables as $tbl) {
        // Some SQL comments
        $sql .= "--\n";
        $sql .= "-- Table structure for table `" . $tbl . "`\n";
        $sql .= "--\n\n";
        // This is to make sure, that there is no table with the same name
        $sql .= "DROP TABLE IF EXISTS `" . $tbl . "`;\n";
        // This query gives us the complete SQL query to create the table structure
        $res = DbQuery("SHOW CREATE TABLE `{$tbl}`;", $link);
        $field = array();
        while ($field = DbFetchArray($res)) {
            // Now the SQL command used to create the table structure is read from the database
            $sql .= $field['Create Table'] . ";\n\n";
        }
        // Another block of SQL comments
        $sql .= "--\n";
        $sql .= "-- Dumping data for table `" . $tbl . "`\n";
        $sql .= "--\n\n";
        // To make sure, that we are the only one working on the table, when importing the dump,
        // this SQL command is used
        $sql .= "LOCK TABLES `" . $tbl . "` WRITE;\n";
        $chfields = array();
        $field = array();
        // We want to check each column of the table, if its datatype is numeric or not.
        // Because if it's not numeric, we want to surround the content in the INSERT command
        // with "". But if it is numeric we must not put "" around the content.
        $res = DbQuery("DESCRIBE `{$tbl}`;", $link);
        while ($field = DbFetchArray($res)) {
            // If a field is either of type "varchar()" or "text" the we add a '1' to the array...
            if (substr($field['Type'], 0, 8) == "varchar(" || $field['Type'] == "text") {
                $chfields[] = 1;
            } else {
                $chfields[] = 0;
            }
        }
        // The data, which we gathered since the last time we wrote something to the file
        // is written down to the SQL dump file.
        fwrite($sqlfile, $sql);
        $sql = "";
        // Now we want to have all the data from the table
        $res = DbQuery(GenQuery($tbl, "s", "*"), $link);
        // 		$res = DbQuery("SELECT * FROM `".$tbl."`;", $link);
        $field = array();
        while ($field = DbFetchRow($res)) {
            // For each record a new INSERT command is created
            $sql .= "INSERT INTO `" . $tbl . "` VALUES (";
            // The fields of the record are inserted one after the other
            for ($i = 0; $i < count($field); $i++) {
                // If the current field is a "varchar()" or "text" field
                // then it is surrounded by "". The array $chfields[]
                // tells us, if the current field is numeric (0) or not (1).
                if ($chfields[$i] == 1 && $field[$i] != "") {
                    $sql .= "\"";
                }
                if ($field[$i] != "") {
                    $field[$i] = str_replace("\"", "\\\"", $field[$i]);
                    $sql .= $field[$i];
                } else {
                    $sql .= "NULL";
                }
                if ($chfields[$i] == 1 && $field[$i] != "") {
                    $sql .= "\"";
                }
                if ($i < count($field) - 1) {
                    $sql .= ", ";
                }
            }
            $sql .= ");\n";
            // The INSERT command for the current record is written to the dump file
            fwrite($sqlfile, $sql);
            $sql = "";
        }
        // After having inserted all the data to the database table
        // the table can be unlocked
        $sql .= "UNLOCK TABLES;\n\n";
        fwrite($sqlfile, $sql);
        $sql = "";
    }
    // Finally the SQL dump file is closed
    fclose($sqlfile);
}
开发者ID:BackupTheBerlios,项目名称:nedi-svn,代码行数:93,代码来源:Other-Export.php

示例6: switch

    if (isset($_POST["Areaid"]) && !empty($_POST["Areaid"])) {
        //Checks if action value exists
        $Idarea = $_POST["Areaid"];
        if (isset($_POST["startdt"]) && !empty($_POST["startdt"])) {
            //Checks if action value exists
            $startdty = $_POST["startdt"];
            if (isset($_POST["endt"]) && !empty($_POST["endt"])) {
                //Checks if action value exists
                $endty = $_POST["endt"];
                if (isset($_POST["action"]) && !empty($_POST["action"])) {
                    //Checks if action value exists
                    $action = $_POST["action"];
                    switch ($action) {
                        //Switch case for value of action
                        case "go":
                            DbQuery();
                            break;
                    }
                }
            }
        }
    }
}
//Function to check if the request is an AJAX request
function is_ajax()
{
    return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
}
function DbQuery()
{
    include 'databaseconn.php';
开发者ID:ilovemycutebear,项目名称:websolar,代码行数:31,代码来源:getsolardata.php

示例7: Query

        // allet in variablen schreiben
        $radusr[$nres]["UserName"] = $u['UserName'];
        $radusr[$nres]["Name"] = $u['Name'];
        $radusr[$nres]["Department"] = $u['Department'];
        $radusr[$nres]["Mail"] = $u['Mail'];
        $radusr[$nres]["WorkPhone"] = $u['WorkPhone'];
        $nres++;
    }
    @DbFreeResult($radres);
} else {
    print @DbError($radlink);
}
// get online status on these users
for ($i = 0; $i < $nres; $i++) {
    $radquery = Query('radacct', '*', 'UserName', '=', $radusr[$i]["UserName"], 'AND', 'AcctStopTime', '=', '0', $_GET[ord], '');
    $radres = @DbQuery($radquery, $radlink);
    if ($u = @DbFetchArray($radres)) {
        $radusr[$i]["Online"] = true;
        $radusr[$i]["NAS"] = $u['NASIPAddress'];
    } else {
        $radusr[$i]["Online"] = false;
        $radusr[$i]["NAS"] = '';
    }
    @DbFreeResult($radres);
}
// print
for ($i = 0; $i < $nres; $i++) {
    if ($row == "1") {
        $row = "0";
        $bg = $bga;
        $bi = $bia;
开发者ID:BackupTheBerlios,项目名称:nedi-svn,代码行数:31,代码来源:User-Radius.php

示例8: GenQuery

                    if ($devs[$dnet][$n[0]]) {
                        $devs[$dnet][$n[0]] = "<span style=\"color : green\">multiple</span> on {$n['1']}";
                    } else {
                        $devs[$dnet][$n[0]] = "<span style=\"color : green\">ok</span> on {$n['1']}";
                    }
                }
            } else {
                $nets[$dnet] = $n[3];
                $pop[$dnet] = 0;
                $age[$dnet] = 0;
                if ($n[3] == -1) {
                    $devs[$dnet][$n[0]] = "<span style=\"color : yellow\">Loopback</span> on {$n['1']}";
                } else {
                    $devs[$dnet][$n[0]] = "<span style=\"color : blue\">mask base</span> on {$n['1']}";
                    $nquery = GenQuery('nodes', 'a', "ip & {$n['3']}", '', 'lastseen - firstseen', array("ip & {$n['3']}"), array('='), array($dnet));
                    $nodres = @DbQuery($nquery, $link);
                    $nnod = @DbNumRows($nodres);
                    $no = @DbFetchRow($nodres);
                    $pop[$dnet] = $no[1];
                    $age[$dnet] = intval($no[2] / 86400);
                    @DbFreeResult($nodres);
                }
            }
        }
        @DbFreeResult($res);
        if ($nets) {
            ?>
<table bgcolor=#666666 <?php 
            echo $tabtag;
            ?>
 >
开发者ID:BackupTheBerlios,项目名称:nedi-svn,代码行数:31,代码来源:Reports-Networks.php

示例9: isset

$co = isset($_GET['co']) ? $_GET['co'] : array();
$elm = isset($_GET['elm']) ? preg_replace('/\\D+/', '', $_GET['elm']) : 20;
$off = (isset($_GET['off']) and !isset($_GET['sho'])) ? preg_replace('/\\D+/', '', $_GET['off']) : 0;
$nof = $off;
if (isset($_GET['p'])) {
    $nof = abs($off - $elm);
} elseif (isset($_GET['n'])) {
    $nof = $off + $elm;
}
$dlim = $elm ? "{$elm} OFFSET {$nof}" : '';
$link = DbConnect($dbhost, $dbuser, $dbpass, $dbname);
if (isset($_GET['del'])) {
    # TODO fix for Postgres
    if ($isadmin) {
        $query = GenQuery('events', 'd', '*', 'id desc', $elm, $in, $op, $st, $co);
        if (DbQuery($query, $link)) {
            echo "<h5> {$msglbl} {$dellbl} OK </h5>";
        } else {
            echo "<h4>" . DbError($link) . "</h4>";
        }
    } else {
        echo $nokmsg;
    }
}
$cols = array("info" => "Info", "id" => "ID", "level" => "{$levlbl}", "time" => $timlbl, "source" => $srclbl, "class" => $clalbl, "location" => $loclbl, "contact" => $conlbl);
?>
<h1>Monitoring <?php 
echo $msglbl;
?>
</h1>
开发者ID:pl0o0f,项目名称:nedi-puppet,代码行数:30,代码来源:Monitoring-Events.php

示例10: Read

function Read($ina, $filter)
{
    global $link, $locsep, $resmsg;
    global $lev, $ipi, $net, $dev, $ndev, $bdev, $cdev, $rdev;
    global $devlink, $ctylink, $bldlink;
    global $nctylink, $nbldlink, $actylink, $abldlink;
    $net = array();
    if ($ina == "vlan") {
        $query = GenQuery('vlans', 'g', 'device', 'device', '', array('vlanid'), array('regexp'), array($filter));
        $res = @DbQuery($query, $link);
        if ($res) {
            while ($vl = @DbFetchRow($res)) {
                $devs[] = preg_replace('/([\\^\\$+])/', '\\\\\\\\$1', $vl[0]);
                # \Q...\E Doesn't seem to work in MySQL?
            }
            @DbFreeResult($res);
        } else {
            echo @DbError($link);
        }
        if (!is_array($devs)) {
            echo $resmsg;
            die;
        }
        $query = GenQuery('devices', 's', 'name,ip,location,icon', '', '', array('name'), array('regexp'), array(implode("|", $devs)));
    } elseif ($ina == "network") {
        $query = GenQuery('networks', 'g', 'device', 'device', '', array('ip'), array('='), array($filter));
        $res = @DbQuery($query, $link);
        if ($res) {
            while ($net = @DbFetchRow($res)) {
                $devs[] = preg_replace('/([\\^\\$\\*\\+])/', '\\\\\\\\$1', $net[0]);
            }
            @DbFreeResult($res);
        } else {
            echo @DbError($link);
        }
        if (!is_array($devs)) {
            echo $resmsg;
            die;
        }
        $query = GenQuery('devices', 's', 'name,ip,location,icon', '', '', array('name'), array('regexp'), array(implode("|", $devs)));
    } elseif ($ina == "type") {
        $query = GenQuery('devices', 's', 'name,ip,location,icon', '', '', array('type'), array('regexp'), array($filter));
    } else {
        $query = GenQuery('devices', 's', 'name,ip,location,icon', '', '', array('location'), array('regexp'), array($filter));
    }
    $res = @DbQuery($query, $link);
    if ($res) {
        while ($unit = @DbFetchRow($res)) {
            $l = explode($locsep, $unit[2]);
            $ndev["{$l['0']}{$locsep}{$l['1']}"][$l[2]][$l[3]][] = $unit[0];
            $bdev["{$l['0']}{$locsep}{$l['1']}"][$l[2]]++;
            $cdev["{$l['0']}{$locsep}{$l['1']}"]++;
            $rdev[$l[0]][$l[1]]++;
            $dev[$unit[0]]['ip'] = long2ip($unit[1]);
            $dev[$unit[0]]['ic'] = $unit[3];
            $dev[$unit[0]]['cty'] = "{$l['0']}{$locsep}{$l['1']}";
            $dev[$unit[0]]['bld'] = $l[2];
            $dev[$unit[0]]['rom'] = $l[4];
        }
        @DbFreeResult($res);
    } else {
        echo @DbError($link);
    }
    if ($ipi) {
        $query = GenQuery('networks');
        $res = @DbQuery($query, $link);
        if ($res) {
            while ($n = @DbFetchRow($res)) {
                $net[$n[0]][$n[1]] .= " " . long2ip($n[2]);
            }
        } else {
            echo @DbError($link);
        }
        @DbFreeResult($res);
    }
    $query = GenQuery('links');
    $res = @DbQuery($query, $link);
    if ($res) {
        while ($l = @DbFetchRow($res)) {
            if ($dev[$l[1]]['ic'] and $dev[$l[3]]['ic']) {
                # both ends are ok, if an icon exists
                if ($lev == "f") {
                    if (isset($devlink[$l[3]][$l[1]])) {
                        # opposite link doesn't exist?
                        $devlink[$l[3]][$l[1]]['nbw'][$l[3]][$l[4]][$l[1]][$l[2]] = $l[5];
                    } else {
                        $devlink[$l[1]][$l[3]]['bw'][$l[1]][$l[2]][$l[3]][$l[4]] = $l[5];
                    }
                }
                if ($dev[$l[1]]['bld'] != $dev[$l[3]]['bld']) {
                    # is it same bld?
                    $nbldlink[$dev[$l[1]]['bld']]++;
                    $abldlink[$dev[$l[1]]['bld']][$dev[$l[3]]['bld']]++;
                    # needed for Arranging.
                    if (isset($bldlink[$dev[$l[3]]['bld']][$dev[$l[1]]['bld']])) {
                        # link defined already?
                        $bldlink[$dev[$l[3]]['bld']][$dev[$l[1]]['bld']]['nbw'][$l[3]][$l[4]][$l[1]][$l[2]] = $l[5];
                    } else {
                        $bldlink[$dev[$l[1]]['bld']][$dev[$l[3]]['bld']]['bw'][$l[1]][$l[2]][$l[3]][$l[4]] = $l[5];
                    }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:nedi-svn,代码行数:101,代码来源:Topology-MapN.php

示例11: Layout

function Layout() {

	global $link,$locsep,$resmsg;
	global $xm,$ym,$xo,$yo,$len,$geo,$ina,$flt,$lev,$ipi;
	global $mapbg,$rloc,$cloc,$bloc;

	$net       = array();

# Gather Device Info
	if($ina == "vlan"){
		$query	= GenQuery('vlans','g','device','device','',array('vlanid'),array('regexp'),array($flt));
		$res	= @DbQuery($query,$link);
		if($res){
			while( ($vl = @DbFetchRow($res)) ){
				$devs[] = preg_replace('/([\^\$+])/','\\\\\\\\$1',$vl[0]);		# \Q...\E Doesn't seem to work in MySQL?
			}
			@DbFreeResult($res);
		}else{
			echo @DbError($link);
		}
		if (! is_array ($devs) ){echo $resmsg;die;}
		$query	= GenQuery('devices','s','name,ip,location,icon','','',array('name'),array('regexp'),array(implode("|",$devs)));
	}elseif($ina == "network"){
		$query	= GenQuery('networks','g','device','device','',array('ip'),array('='),array($flt));
		$res	= @DbQuery($query,$link);
		if($res){
			while( ($net = @DbFetchRow($res)) ){
				$devs[] = preg_replace('/([\^\$\*\+])/','\\\\\\\\$1',$net[0]);
			}
			@DbFreeResult($res);
		}else{
			echo @DbError($link);
		}
		if (! is_array ($devs) ){echo $resmsg;die;}
		$query	= GenQuery('devices','s','name,ip,location,icon','','',array('name'),array('regexp'),array(implode("|",$devs)));
	}elseif($ina == "type"){
		$query	= GenQuery('devices','s','name,ip,location,icon','','',array('type'),array('regexp'),array($flt));
	}else{
		$query	= GenQuery('devices','s','name,ip,location,icon','','',array('location'),array('regexp'),array($flt));
	}
	$res	= @DbQuery($query,$link);
	if($res){
		while( ($d = @DbFetchRow($res)) ){
			$l = explode($locsep, $d[2]);
			if($lev == "c" or $lev == "C"){
				$locs[$l[0]][$l[1]]++;
			}elseif($lev == "b" or $lev == "B"){
				$locs[$l[0]][$l[1]][$l[2]]++;
			}else{
				$locs[$l[0]][$l[1]][$l[2]][$l[3]][] = $d[0];
			}
			$dev['ip'] [$d[0]] = long2ip($d[1]);
			$dev['ic'] [$d[0]] = $d[3];
			$dev['reg'][$d[0]] = $l[0];
			$dev['cty'][$d[0]] = $l[1];
			$dev['bld'][$d[0]] = $l[2];
			$dev['rom'][$d[0]] = $l[4];
		}
		@DbFreeResult($res);
	}else{
		echo @DbError($link);
	}
	if($ipi){
		$query	= GenQuery('networks');
		$res	= @DbQuery($query,$link);
		if($res){
			while( ($n = @DbFetchRow($res)) ){
				$net[$n[0]][$n[1]] .= " ". long2ip($n[2]);
			}
		}else{
			echo @DbError($link);
		}
		@DbFreeResult($res);
	}

# Gather Link Info
	$query	= GenQuery('links');
	$res	= @DbQuery($query,$link);
	if($res){
		while( ($l = @DbFetchRow($res)) ){
			if($dev[$l[1]]['ic'] and $dev[$l[3]]['ic']){					# both ends are ok, if an icon exists
				if($lev == "f"){
					if( isset($devlink[$l[3]][$l[1]]) ){				# opposite link doesn't exist?
						$devlink[$l[3]][$l[1]]['nbw'][$l[3]][$l[4]][$l[1]][$l[2]] = $l[5];
					}else{
						$devlink[$l[1]][$l[3]]['bw'][$l[1]][$l[2]][$l[3]][$l[4]] = $l[5];
					}
				}
				if($dev[$l[1]]['bld'] != $dev[$l[3]]['bld'])			{	# is it same bld?
					$nbldlink[$dev[$l[1]]['bld']] ++;
					$abldlink[$dev[$l[1]]['bld']][$dev[$l[3]]['bld']]++;		# needed for Arranging.
					if(isset($bldlink[$dev[$l[3]]['bld']][$dev[$l[1]]['bld']]) ){	# link defined already?
						$bldlink[$dev[$l[3]]['bld']][$dev[$l[1]]['bld']]['nbw'][$l[3]][$l[4]][$l[1]][$l[2]] = $l[5];
					}else{
						$bldlink[$dev[$l[1]]['bld']][$dev[$l[3]]['bld']]['bw'][$l[1]][$l[2]][$l[3]][$l[4]] = $l[5];
					}
				}
				if($dev[$l[1]]['cty'] != $dev[$l[3]]['cty']){				# is it same cty?
					$nctylink[$dev[$l[1]]['cty']]++;
					$actylink[$dev[$l[1]]['cty']][$dev[$l[3]]['cty']]++;		# needed for Arranging.
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:odp-svn,代码行数:101,代码来源:Topology-MapR.php

示例12: preg_replace

             $trk[$src] = preg_replace('/.+DP:(.+),.+/', '$1', $trk[$src]);
             $setd = "value='{$trk[$src]}',";
         } else {
             $setd = "value='{$trk[$src]}',";
         }
         if (!DbQuery("UPDATE nodetrack SET {$setd}source='{$src}',usrname='{$_SESSION['user']}',time={$time} WHERE device = '{$dev}' AND ifname = '{$ifn}';", $link)) {
             $cfgst = "<img src=\"img/16/bcnl.png\" title=\"" . DbError($link) . "\">";
         } else {
             $cfgst = "<img src=\"img/16/bchk.png\" title=\"{$srclbl} = {$src} OK\">";
             $trk['source'] = $src;
             if ($src != '-') {
                 $trk['value'] = $trk[$src];
             }
         }
     } elseif ($val) {
         if (!DbQuery("UPDATE nodetrack SET value='{$val}',usrname='{$_SESSION['user']}',time={$time} WHERE device = {$dev}' AND ifname = '{$ifn}';", $link)) {
             $cfgst = "<img src=\"img/16/bcnl.png\" title=\"" . DbError($link) . "\">";
         } else {
             $cfgst = "<img src=\"img/16/bchk.png\" title=\"{$vallbl} = {$val} OK\">";
             $trk['value'] = $val;
         }
     }
     $trk['time'] = $time;
     $trk['user'] = $_SESSION['user'];
 }
 $bst = 'good';
 if ($trk['source'] == '-' or $trk['source'] == '') {
     $bst = $bi;
 } elseif ($trk['source'] == 'comment') {
     if ($trk['value'] != preg_replace('/.+DP:(.+),.+/', '$1', $trk['comment'])) {
         $bst = 'warn';
开发者ID:pl0o0f,项目名称:nedi-puppet,代码行数:31,代码来源:Nodes-Track.php

示例13: while

 $row = 0;
 while ($d = @DbFetchRow($res)) {
     if ($row % 2) {
         $bg = $bga;
         $bi = $bia;
     } else {
         $bg = $bgb;
         $bi = $bib;
     }
     $dev++;
     $row++;
     $ud = rawurlencode($d[0]);
     echo "<tr bgcolor=#{$bg}><th bgcolor=#{$bia}><a href=Devices-Status.php?dev={$ud}><b>{$d['0']}</b></a></th>\n";
     echo "<td align=right>-</td><td><b>{$d['1']}</b></td><td>{$d['2']}</td><td>-</td><td>{$d['3']}</td><td>{$d['4']}</td></tr>\n";
     $mquery = GenQuery('modules', 's', '*', 'slot', '', array('device'), array('='), array($d[0]));
     $mres = @DbQuery($mquery, $link);
     if ($mres) {
         while ($m = @DbFetchRow($mres)) {
             if ($row % 2) {
                 $bg = $bga;
                 $bi = $bia;
             } else {
                 $bg = $bgb;
                 $bi = $bib;
             }
             $row++;
             echo "<tr bgcolor=#{$bg}><td bgcolor=#{$bib}></td>\n";
             echo "<td align=right>{$m['1']}</td><td><b>{$m['2']}</b> {$m['3']}</td><td>{$m['4']}</td><td>{$m['5']}</td><td>{$m['6']}</td><td>{$m['7']}</td></tr>\n";
         }
         @DbFreeResult($mres);
     } else {
开发者ID:BackupTheBerlios,项目名称:nedi-svn,代码行数:31,代码来源:Reports-Modules.php

示例14: host

> Enable notifications for selected host(s)<br>
		</td>
	</tr>
</table>
</form>
<?php 
if ($ERR) {
    ?>
<div class="textpad warn"><center><b><?php 
    echo $ERR;
    ?>
</b></center></div>
<?php 
}
if ($_POST['~']) {
    $result = DbQuery("SELECT device, devip FROM devices WHERE device REGEXP BINARY '" . $_POST['expression'] . "'", $link);
    ?>
<div class="textpad devConf">
<?php 
    if (DbNumRows($result)) {
        ?>
<b>Hosts matching regular expression '<?php 
        echo $_POST['expression'];
        ?>
':</b><br>
<?php 
        while ($row = DbFetchArray($result)) {
            ?>
<br><?php 
            echo $row['device'];
            ?>
开发者ID:pl0o0f,项目名称:nedi-puppet,代码行数:31,代码来源:Other-Nagios.php

示例15: Read

function Read($ina, $filter)
{
    global $link, $locsep, $fpos, $bpos, $cpos, $rpos, $resmsg;
    global $lev, $ipi, $net, $dev, $ndev, $bdev, $fdev;
    global $devlink, $ctylink, $bldlink;
    global $nctylink, $nbldlink, $actylink, $abldlink;
    $net = array();
    if ($ina == "vlan") {
        $query = GenQuery('vlans', 's', '*', '', '', array('vlanid'), array('regexp'), array($filter));
        $res = @DbQuery($query, $link);
        if ($res) {
            while ($vl = @DbFetchRow($res)) {
                $devs[] = preg_replace('/([\\^\\$+])/', '\\\\\\\\$1', $vl[0]);
            }
            @DbFreeResult($res);
        } else {
            print @DbError($link);
        }
        if (!is_array($devs)) {
            echo $resmsg;
            die;
        }
        $query = GenQuery('devices', 's', '*', '', '', array('name'), array('regexp'), array(implode("|", $devs)));
    } elseif ($ina == "network") {
        $query = GenQuery('networks', 's', '*', '', '', array('ip'), array('='), array($filter));
        $res = @DbQuery($query, $link);
        if ($res) {
            while ($vl = @DbFetchRow($res)) {
                $devs[] = preg_replace('/([\\^\\$\\*\\+])/', '\\\\\\\\$1', $vl[0]);
            }
            @DbFreeResult($res);
        } else {
            print @DbError($link);
        }
        if (!is_array($devs)) {
            echo $resmsg;
            die;
        }
        $query = GenQuery('devices', 's', '*', '', '', array('name'), array('regexp'), array(implode("|", $devs)));
    } else {
        $query = GenQuery('devices', 's', '*', '', '', array('location'), array('regexp'), array($filter));
    }
    $res = @DbQuery($query, $link);
    if ($res) {
        while ($unit = @DbFetchRow($res)) {
            $locitems = explode($locsep, $unit[10]);
            if ($cpos === false) {
                $cty = "-";
            } else {
                $cty = $locitems[$cpos];
            }
            if ($bpos === false) {
                $bld = "-";
            } else {
                $bld = $locitems[$bpos];
            }
            if ($fpos === false) {
                $flr = "-";
            } else {
                $flr = $locitems[$fpos];
            }
            if ($rpos === false) {
                $rom = "-";
            } else {
                $rom = $locitems[$rpos];
            }
            $dev[$unit[0]]['ip'] = long2ip($unit[1]);
            $dev[$unit[0]]['ic'] = $unit[18];
            $dev[$unit[0]]['cty'] = $cty;
            $dev[$unit[0]]['bld'] = $bld;
            $dev[$unit[0]]['flr'] = $flr;
            $dev[$unit[0]]['rom'] = $rom;
            $ndev[$cty][$bld][$flr][] = $unit[0];
            $bdev[$cty][$bld]++;
            $fdev[$cty][$bld][$flr]++;
        }
        @DbFreeResult($res);
    } else {
        print @DbError($link);
    }
    if ($ipi) {
        $query = GenQuery('networks');
        $res = @DbQuery($query, $link);
        if ($res) {
            while ($n = @DbFetchRow($res)) {
                $net[$n[0]][$n[1]] .= " " . long2ip($n[2]);
            }
        } else {
            print @DbError($link);
        }
        @DbFreeResult($res);
    }
    $query = GenQuery('links');
    $res = @DbQuery($query, $link);
    if ($res) {
        while ($l = @DbFetchRow($res)) {
            if ($dev[$l[1]]['ic'] and $dev[$l[3]]['ic']) {
                // both ends are ok, if an icon exists
                if ($lev == "f") {
                    if (isset($devlink[$l[3]][$l[1]])) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:nedi-svn,代码行数:101,代码来源:Devices-Map.php


注:本文中的DbQuery函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。