本文整理匯總了PHP中DbNumRows函數的典型用法代碼示例。如果您正苦於以下問題:PHP DbNumRows函數的具體用法?PHP DbNumRows怎麽用?PHP DbNumRows使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DbNumRows函數的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;
}
示例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;
}
示例3: str_replace
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("-");
}
}
示例4: GenQuery
$nmsg += $m[1];
}
if (!$nmsg) {
echo "<img src=img/16/fogy.png title=\"All Messages\"> ";
}
$tmsg += $nmsg;
echo "{$nmsg}</td></tr>\n";
@DbFreeResult($res);
} else {
print @DbError($link);
}
} else {
$query = GenQuery('messages', 's', 'id', '', '', array('time', 'time'), array('>=', '<'), array($istart, $iend), array('AND'));
$res = @DbQuery($query, $link);
if ($res) {
$m = @DbNumRows($res);
$mbar = "";
if ($m) {
$mbar = Bar($m, 0);
}
echo "<img src=img/16/fogy.png title=\"All Messages\">{$mbar} {$m}</td></tr>\n";
$tmsg += $m;
@DbFreeResult($res);
} else {
print @DbError($link);
}
}
$istart = $iend;
flush();
}
echo "</table><table bgcolor=#666666 {$tabtag} >\n";
示例5: TopoFloors
function TopoFloors($r, $c, $b, $siz = 0)
{
global $link, $dev, $img, $modgroup, $self, $v, $place, $netlbl, $acslbl, $porlbl, $frelbl, $refresh;
$query = GenQuery('locations', 's', 'id,x,y,ns,ew,locdesc', '', '', array('region', 'city', 'building'), array('=', '=', '='), array($r, $c, $b), array('AND', 'AND'));
$res = DbQuery($query, $link);
if (DbNumRows($res)) {
list($id, $x, $y, $ns, $ew, $des) = DbFetchRow($res);
echo "<h2>{$b} - {$des}</h2>\n";
} else {
echo "<h2>{$b} {$place['b']}</h2>\n";
}
echo "<table class=\"content fixed\">\n";
uksort($dev, "floorsort");
foreach (array_keys($dev) as $fl) {
echo "<tr>\n\t<td class=\"{$modgroup[$self]}2\" width=\"80\"><h3>\n";
if (!$siz) {
echo "<img src=\"img/stair.png\"><br>\n";
}
echo "{$fl}</h3>\n";
if (!$siz) {
$bas = "topo/" . preg_replace('/\\W/', '', $r) . '/' . preg_replace('/\\W/', '', $c) . '/' . preg_replace('/\\W/', '', $b) . '-' . preg_replace('/\\W/', '', $fl);
foreach (glob("{$bas}*") as $f) {
list($ico, $ed) = FileImg($f);
echo "{$ico} ";
}
}
echo "</td>\n";
$col = 0;
$prm = "";
ksort($dev[$fl]);
foreach (array_keys($dev[$fl]) as $rm) {
if ($prm != $rm) {
$bi = $bi == "imga" ? "imgb" : "imga";
}
$prm = $rm;
foreach (array_keys($dev[$fl][$rm]) as $d) {
$ip = $dev[$fl][$rm][$d]['ip'];
$po = $dev[$fl][$rm][$d]['po'];
$ty = $dev[$fl][$rm][$d]['ty'];
$di = $dev[$fl][$rm][$d]['ic'];
$co = $dev[$fl][$rm][$d]['co'];
$rk = $dev[$fl][$rm][$d]['rk'];
$mn = $dev[$fl][$rm][$d]['mn'];
$al = $dev[$fl][$rm][$d]['al'];
$sz = $dev[$fl][$rm][$d]['sz'];
$sk = $dev[$fl][$rm][$d]['sk'] > 1 ? "<img src=\"img/" . $dev[$fl][$rm][$d]['sk'] . ".png\" title=\"Stack\">" : "";
list($statbg, $stat) = StatusBg(1, $mn, $al, $bi);
$tit = $stat ? $stat : $ty;
$ud = urlencode($d);
$ur = urlencode($r);
$uc = urlencode($c);
$ub = urlencode($b);
$uf = urlencode($fl);
$um = urlencode($rm);
if ($col == $_SESSION['col']) {
$col = 0;
echo "</tr><tr><td> </td>\n";
}
if ($siz) {
echo "<td class=\"{$statbg}\" valign=\"top\"><center><img src=\"img/dev/{$di}.png\" title=\"{$ip}\"><br>{$d}</center></td>\n";
} else {
$ii = $refresh ? 0 : IfFree($d);
$inif = $ii ? "<div style=\"float:right\"><a href=\"Devices-Interfaces.php?in[]=device&op[]==&st[]={$ud}&co[]=AND&in[]=ifstat&op[]=<&st[]=3&co[]=AND&in[]=iftype&op[]=~&st[]=^(6|7|117)\$&col[]=imBL&col[]=ifname&col[]=device&col[]=linktype&col[]=ifdesc&col[]=alias&col[]=lastchg&col[]=inoct&col[]=outoct&ord=lastchg\"><img src=\"img/p45.png\" title=\"{$acslbl} {$porlbl} {$frelbl}\">{$ii}</a></div>" : '';
$rkv = $dev[$fl][$rm][$d]['ru'] ? "<a href=\"Topology-Table.php?reg={$ur}&cty={$uc}&bld={$ub}&fl={$uf}&rm={$um}\">{$rm}</a>" : $rm;
echo "<td class=\"{$statbg}\" valign=\"top\"><b>{$rkv}</b> {$rk} {$inif}<p><div style=\"text-align:center;\">\n";
echo "<a href=\"Devices-Status.php?dev={$ud}\">";
echo "<img src=\"" . ($img ? DevPanel($ty, $di, $sz) . "\" width=\"" . (preg_match('/^ph|^wa|^ca/', $di) ? 40 : 100) . "\"" : "img/dev/{$di}.png\"") . " title=\"{$tit}\"></a>{$sk}<br><b>{$d}</b><br>\n";
echo Devcli($ip, $po);
echo "<p>{$co}</div></td>\n";
}
$col++;
}
}
}
echo "</tr></table>\n";
}
示例6: StatusSys
<?php
StatusSys('cpu');
StatusSys('mem');
StatusSys('tmp');
?>
</th></tr></table>
<p>
<table width=100%>
<tr><th width=20% valign=top>
<h2>Message Statistics</h2>
<?php
$query = GenQuery('messages', 'g', 'level', 'level desc');
$res = @DbQuery($query, $link);
if ($res) {
$nlev = @DbNumRows($res);
if ($nlev) {
?>
<p><table bgcolor=#666666 <?php
echo $tabtag;
?>
><tr bgcolor=#<?php
echo $bg2;
?>
>
<th width=40><img src=img/16/info.png><br>Level</th>
<th><img src=img/16/say.png><br>Messages</th>
<?php
$row = 0;
while ($msg = @DbFetchRow($res)) {
if ($row % 2) {
示例7: elseif
$com = "Building with " . $lopt[$reg][$cty][$bld] . " devices on {$now}";
} elseif ($cty) {
$query = GenQuery('locations', 's', 'id,x,y,comment', '', '', array('region', 'city', 'building'), array('=', '=', '='), array($reg, $cty, ''), array('AND', 'AND'));
$mapbg = TopoMap($reg);
$nam = $cty;
$com = "City with " . count(array_keys($lopt[$reg][$cty])) . " buildings on {$now}";
} elseif ($reg) {
$query = GenQuery('locations', 's', 'id,x,y,comment', '', '', array('region', 'city', 'building'), array('=', '=', '='), array($reg, '', ''), array('AND', 'AND'));
$nam = $reg;
$com = "Region with " . count(array_keys($lopt[$reg])) . " cities on {$now}";
} else {
$query = "";
}
if ($query) {
$res = @DbQuery($query, $link);
$nloc = @DbNumRows($res);
if ($nloc == 1) {
list($id, $x, $y, $com) = @DbFetchRow($res);
$loco = 1;
}
}
?>
<h1>Location Editor</h1>
<form method="get" action="<?php
echo $_SERVER['PHP_SELF'];
?>
" name="lof">
<table bgcolor=#000000 <?php
echo $tabtag;
?>
>
示例8: md5
if (isset($_POST['user'])) {
$pass = md5($_POST['pass']);
$link = @DbConnect($dbhost, $dbuser, $dbpass, $dbname);
if (stristr('p', $guiauth) && $_POST['user'] != "admin") {
# PAM code by Owen Brotherhood & bruberg
if (!extension_loaded('pam_auth')) {
dl("pam_auth.so");
}
$uok = pam_auth($_POST['user'], $_POST['pass']);
$query = GenQuery('user', 's', '*', '', '', array('name'), array('='), array($_POST[user]));
$res = @DbQuery($query, $link);
} else {
$pass = md5($_POST['pass']);
$query = GenQuery('user', 's', '*', '', '', array('name', 'password'), array('=', '='), array($_POST['user'], $pass), array('AND'));
$res = @DbQuery($query, $link);
$uok = @DbNumRows($res);
}
if ($uok == 1) {
$usr = @DbFetchRow($res);
session_start();
$_SESSION['user'] = $_POST['user'];
$_SESSION['group'] = "usr,";
if ($usr[2]) {
$_SESSION['group'] .= "adm,";
}
if ($usr[3]) {
$_SESSION['group'] .= "net,";
}
if ($usr[4]) {
$_SESSION['group'] .= "dsk,";
}
示例9: GenQuery
} else {
$editam = "<a href=\"?eam=1\"><img src=\"img/16/note.png\" title=\"{$chglbl}\"></a>";
}
}
echo "<h2>{$editam} Admin {$mlvl['100']}</h2>\n";
if (file_exists($msgfile)) {
echo "<div class=\"textpad warn\">\n";
include_once $msgfile;
echo "</div><br>";
}
?>
<p>
<?php
$query = GenQuery('chat', 's', '*', 'time desc', $_SESSION['lim']);
$res = DbQuery($query, $link);
$nchat = DbNumRows($res);
if ($nchat) {
?>
<p>
<h2>
<a href="User-Chat.php"><img src="img/16/say.png" title="Chat"></a>
<?php
echo $verb1 ? "{$laslbl} Chat" : "Chat {$laslbl}";
?>
</h2>
<table class="content"><tr class="<?php
echo $modgroup[$self];
?>
2">
<th width="40"><img src="img/16/user.png"><br>User</th>
<th width="120"><img src="img/16/clock.png"><br><?php
示例10: GenQuery
}
echo "</select>";
?>
</th><th width="80">
<input type="submit" value="<?php
echo $sholbl;
?>
">
</th>
</tr></table></form>
<?php
}
if ($dev) {
$query = GenQuery('devices', 's', '*', '', '', array('device'), array('='), array($dev));
$res = DbQuery($query, $link);
$ndev = DbNumRows($res);
if ($ndev != 1) {
echo "<h4>{$dev} {$mullbl} {$vallbl}</h4>";
DbFreeResult($res);
die;
} else {
$dev = DbFetchRow($res);
$ip = long2ip($dev[1]);
$sv = Syssrv($dev[6]);
$ud = rawurlencode($dev[0]);
DbFreeResult($res);
$query = GenQuery('interfaces', 's', 'ifidx,ifname,iftype,alias,comment', '', '', array('device'), array('='), array($rtr));
$res = DbQuery($query, $link);
while ($i = DbFetchRow($res)) {
$ifn[$i[0]] = $i[1];
$ift[$i[0]] = $i[2];
示例11: 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]);
$simg = "";
示例12: DbError
print DbError($link);
}
?>
</table>
<table class="content">
<tr class="<?= $modgroup[$self] ?>2"><td><?= $row ?> Devices</td></tr>
</table>
<?php
}
}elseif($shc){
echo "<h2>$shc</h2>\n";
$query = GenQuery('configs','s','configs.*,inet_ntoa(devip),cliport','','',array('device'),array('='),array($shc),array(),'LEFT JOIN devices USING (device)');
$res = DbQuery($query,$link);
$cfgok = DbNumRows($res);
if ($cfgok == 1) {
$cfg = DbFetchRow($res);
DbFreeResult($res);
}else{
echo "<h4>$shc: $cfgok $vallbl</h4>";
die;
}
$ucfg = rawurlencode($cfg[0]);
$charr = explode("\n",$cfg[2]);
$charr = preg_replace("/^#(.*)$/","<span class='gry'>#$1</span>",$charr);
$charr = preg_replace("/(^\s*[0-9]{1,3}\-.*)$/","<span class='drd'>$1</span>",$charr);
$charr = preg_replace("/(^\s*[0-9]{1,3}\+.*)$/","<span class='olv'>$1</span>",$charr);
?>
<table class="content"><tr class="<?= $modgroup[$self] ?>2">
<th><img src="img/32/note.png"><br><?= $cfglbl ?> (<?= date($_SESSION['date'],$cfg[3]) ?>)</th>
示例13: DbQuery
</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'];
?>
(<?php
echo long2ip($row['devip']);
?>
)
示例14: sanitize
$cico['200'] = "bstp";
$cico['250'] = "bbox";
include_once "inc/header.php";
include_once "inc/libdev.php";
$_GET = sanitize($_GET);
$chg = isset($_GET['chg']) ? $_GET['chg'] : "";
$add = isset($_GET['add']) ? $_GET['add'] : "";
$upd = isset($_GET['upd']) ? $_GET['upd'] : "";
$del = isset($_GET['del']) ? $_GET['del'] : "";
$lst = isset($_GET['lst']) ? $_GET['lst'] : "";
$val = isset($_GET['val']) ? $_GET['val'] : "";
$link = DbConnect($dbhost, $dbuser, $dbpass, $dbname);
if ($chg) {
$query = GenQuery('stock', 's', '*', '', '', array('serial'), array('='), array($chg));
$res = DbQuery($query, $link);
$nitm = DbNumRows($res);
if ($nitm != 1) {
echo "<h4>{$chg}: {$nitm} {$vallbl}!</h4>";
DbFreeResult($res);
} else {
$item = DbFetchRow($res);
}
DbFreeResult($res);
$sta = $item[0];
$sn = $item[1];
$ty = $item[2];
$as = $item[3];
$lo = $item[4];
$ps = $item[5];
$pc = $item[6];
$pn = $item[7];
示例15: GenQuery
</select>
</th>
<th width="80"><input type="submit" value="<?php
echo $sholbl;
?>
"></th>
</table>
</form>
<?php
}
if ($dev) {
$query = GenQuery('configs', 's', 'config,devos', '', '', array('device'), array('='), array($dev), array(), 'LEFT JOIN devices USING (device)');
$res = DbQuery($query, $link);
if (DbNumRows($res) != 1) {
echo "<h4>{$dev}: {$nonlbl}</h4>";
DbFreeResult($res);
die;
}
$cfg = DbFetchRow($res);
DbFreeResult($res);
if ($debug) {
echo "<div class=\"textpad code warn\">{$cfg['0']}</div>\n";
}
?>
<h2>
<a href="Devices-Config.php?shc=<?php
echo urlencode($dev);
?>
"><img src="img/16/conf.png" title="<?php