本文整理汇总了PHP中GenQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP GenQuery函数的具体用法?PHP GenQuery怎么用?PHP GenQuery使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GenQuery函数的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: GenQuery
if( !@DbQuery($query,$link) ){echo "<h4>Links ".DbError($link)."</h4>";}else{echo "<h5>Links $dld $dellbl OK</h5>";}
$query = GenQuery('configs','d','','','',array('device'),array('='),array($dld) );
if( !@DbQuery($query,$link) ){echo "<h4>Config ".DbError($link)."</h4>";}else{echo "<h5>Config $dld $dellbl OK</h5>";}
$query = GenQuery('monitoring','d','','','',array('name'),array('='),array($dld) );
if( !@DbQuery($query,$link) ){echo "<h4>Monitoring ".DbError($link)."</h4>";}else{echo "<h5>Monitoring $dld $dellbl OK</h5>";}
$query = GenQuery('incidents','d','','','',array('name'),array('='),array($dld) );
if( !@DbQuery($query,$link) ){echo "<h4>Incidents ".DbError($link)."</h4>";}else{echo "<h5>Incidents $dld $dellbl OK</h5>";}
$query = GenQuery('vlans','d','','','',array('device'),array('='),array($dld) );
if( !@DbQuery($query,$link) ){echo "<h4>Vlans ".DbError($link)."</h4>";}else{echo "<h5>Vlans $dld $dellbl OK</h5>";}
$query = GenQuery('networks','d','','','',array('device'),array('='),array($dld) );
if( !@DbQuery($query,$link) ){echo "<h4>Networks ".DbError($link)."</h4>";}else{echo "<h5>Networks $dld $dellbl OK</h5>";}
$query = GenQuery('events','d','','','',array('source'),array('='),array($dld) );
if( !@DbQuery($query,$link) ){echo "<h4>Events ".DbError($link)."</h4>";}else{echo "<h5>Events $dld $dellbl OK</h5>";}
$query = GenQuery('devdel','i','','','',array('device','user','time'),'',array($dld,$_SESSION['user'],time()) );
if( !@DbQuery($query,$link) ){echo "<h4>".DbError($link)."</h4>";}else{echo "<h5>$dellbl $dld $updlbl OK</h5>";}
$query = GenQuery('events','i','','','',array('level','time','source','info','class'),'',array('100',time(),$dld,"User $_SESSION[user] deleted this device",'usrd') );
if( !@DbQuery($query,$link) ){echo "<h4>".DbError($link)."</h4>";}else{echo "<h5>$msglbl $updlbl OK</h5>";}
#old: DbQuery("DELETE FROM devices WHERE device = '".$rmdev."' LIMIT 1", $link); SteffenScholz-2011-07-05
}
}
}
$collisions = array();
$coll_serials = array();
$devices = DbQuery("SELECT device, devip, serial, firstdis, lastdis FROM devices WHERE serial NOT REGEXP '^$|^-$|noSuch|err|n/a'", $link);
#old $devices = DbQuery("SELECT name, ip, serial, firstseen, lastseen FROM devices WHERE serial REGEXP BINARY '^[-() A-Z0-9]{2,}$'", $link); SteffenScholz-2011-07-05
while ($device = DbFetchArray($devices)):
if (@!in_array($device['serial'], $coll_serials)):
$lookup = DbQuery("SELECT device, devip, firstdis, lastdis FROM devices WHERE serial = '".$device['serial']."' AND NOT device = '".$device['device']."'", $link);
while ($colldev = DbFetchArray($lookup)):
# determine reason for serial number collision
# use
示例3: Bar
$mbar = Bar($m[1], 0, 1);
echo "<a href=Monitoring-Messages.php?ina=time&opa=%3E=&sta={$fs}&cop=AND&inb=time&opb=%3C&stb={$fe}&lvl={$m['0']}>";
echo "<img src=img/16/" . $mico[$m[0]] . ".png title=\"" . $mlvl[$m[0]] . "\" border=0></a>{$mbar} \n";
$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;
示例4: isset
$st = isset($_GET['st']) ? $_GET['st'] : array();
$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>
示例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: GenQuery
<h2>Recent Vital Messages</h2>
<table bgcolor=#666666 <?php
echo $tabtag;
?>
>
<tr bgcolor=#<?php
echo $bg2;
?>
>
<th width=40><img src=img/16/info.png><br>Level</th>
<th width=100><img src=img/16/clock.png><br>Time</th>
<th><img src=img/16/dev.png><br>Source</th>
<th><img src=img/16/find.png><br>Info</th>
</tr>
<?php
$query = GenQuery('messages', 's', '*', 'id desc', $lim, array('level'), array('>'), array('100'));
$res = @DbQuery($query, $link);
if ($res) {
$row = 0;
while ($m = @DbFetchRow($res)) {
if ($row % 2) {
$bg = $bgb;
$bi = $bib;
} else {
$bg = $bga;
$bi = $bia;
}
$row++;
$hint = "";
$time = date($datfmt, $m[2]);
$fd = str_replace(" ", "%20", date("m/d/Y H:i:s", $m[2]));
示例7: substr
$_SESSION['lang'] = $usr[8];
$_SESSION['theme'] = $usr[9];
$_SESSION['vol'] = ($usr[10] & 3) * 33;
$_SESSION['lsiz'] = ($usr[10] & 124) >> 2;
$_SESSION['col'] = $usr[11];
$_SESSION['lim'] = $usr[12];
$_SESSION['gsiz'] = $usr[13] & 7;
$_SESSION['gbit'] = $usr[13] & 8;
$_SESSION['far'] = $usr[13] & 16;
$_SESSION['opt'] = $usr[13] & 32;
$_SESSION['map'] = $usr[13] & 64;
$_SESSION['gneg'] = $usr[13] & 128;
$_SESSION['nip'] = $usr[13] & 256;
$_SESSION['date'] = $usr[14] ? substr($usr[14], 0, -3) : 'j.M y G:i';
$_SESSION['tz'] = $tzone[substr($usr[14], -3)];
$query = GenQuery('users', 'u', 'usrname', '=', $user, array('lastlogin'), array(), array(time()));
DbQuery($query, $link);
}
} else {
print DbError($link);
}
if (isset($_SESSION['group'])) {
echo "<body style=\"background-color: #666666;\"><script>document.location.href='{$goto}';</script></body>\n";
} elseif ($raderr) {
$disc = "<h4>{$raderr}</h4>";
} else {
$disc = "<h4>Incorrect login!</h4>";
}
}
?>
<html>
示例8: GenQuery
?>
<h2>Message Sources</h2><p>
<table bgcolor=#666666 <?php
echo $tabtag;
?>
><tr bgcolor=#<?php
echo $bg2;
?>
>
<th width=10%><img src=img/32/say.png><br>Source</th>
<th><img src=img/32/umgr.png><br>Contact</th>
<th><img src=img/32/say.png><br>Messages</th>
</tr>
<?php
$rord = $ord ? " desc" : "";
$query = GenQuery('messages', 'g', 'source,level', "source{$rord}");
$res = @DbQuery($query, $link);
if ($res) {
while ($s = @DbFetchRow($res)) {
$source[$s[0]][$s[1]] = $s[2];
}
@DbFreeResult($res);
} else {
print @DbError($link);
die;
}
$row = 0;
foreach (array_keys($source) as $s) {
if ($row % 2) {
$bg = $bga;
$bi = $bia;
示例9: GenQuery
</th></table>
<?php
} 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">
示例10: ColHead
echo $bg2;
?>
>
<?php
ColHead('name');
ColHead('email');
ColHead('phone');
ColHead('comment');
ColHead('language');
ColHead('time');
ColHead('lastseen');
echo "<th>Groups</th><th>Action</th></tr>\n";
if ($grp) {
$query = GenQuery('user', 's', '*', $ord, '', array($grp), array('='), array('1'));
} else {
$query = GenQuery('user', 's', '*', $ord);
}
$res = @DbQuery($query, $link);
if ($res) {
$row = 0;
while ($u = @DbFetchRow($res)) {
if ($row % 2) {
$bg = $bgb;
$bi = $bib;
} else {
$bg = $bga;
$bi = $bia;
}
$row++;
list($cc, $lc) = Agecol($u[10], $u[11], $row % 2);
echo "<tr bgcolor=#{$bg}>\n";
示例11: while
while ($d = @DbFetchRow($res)) {
echo "<option value=\"{$d['0']}\" ";
if ($dv == $d[0]) {
echo "selected";
}
echo " >{$d['0']}\n";
}
@DbFreeResult($res);
} else {
print @DbError($link);
}
?>
</select>
<?php
if ($dv) {
$query = GenQuery('interfaces', 's', '*', 'ifname', '', array('device'), array('='), array($dv));
$res = @DbQuery($query, $link);
if ($res) {
?>
<select multiple size=6 name="if[]">
<?php
while ($i = @DbFetchRow($res)) {
echo "<OPTION VALUE=\"{$i['1']}\" ";
if (in_array($i[1], $if)) {
echo "selected";
}
echo " >{$i['1']}\n";
}
@DbFreeResult($res);
echo "</select>";
}
示例12: foreach
if ($ifm[$i]) {
echo "<a href=Nodes-Status.php?mac={$ifm[$i]}>{$ifm[$i]}</a><br>";
}
foreach ($net[$in] as $ip => $dmsk) {
list($pfix, $msk, $bmsk) = Masker($dmsk);
$dnet = long2ip($ip);
echo "<a href=Reports-Networks.php?ipf={$dnet}%2F{$pfix}&shw=1 title=\"{$dnet}/{$pfix} Report-Networks\">{$dnet}</a>/{$pfix} ";
}
echo "</td></tr>\n";
}
echo "</table><table bgcolor=#666666 {$tabtag} >\n";
echo "<tr bgcolor=#{$bg2}><td>{$nif} Interfaces</td></tr></table>\n";
} elseif ($dld) {
if (preg_match("/adm/", $_SESSION['group'])) {
$now = time();
$query = GenQuery('devdel', 'i', '', '', '', array('device', 'user', 'time'), '', array($dld, $_SESSION['user'], $now));
if (!@DbQuery($query, $link)) {
echo "<h4>" . DbError($link) . "</h4>";
} else {
echo "<h3>Device {$_GET['del']} {$upokmsg}</h3>";
}
?>
<script language="JavaScript"><!--
setTimeout("history.go(-2)",2000);
//--></script>
<?php
} else {
echo $nokmsg;
}
}
include_once "inc/footer.php";
示例13: GenQuery
?>
</tr>
<tr bgcolor=#<?php
echo $bg2;
?>
><th>Total Devices</th><td align=center><?php
echo $ndev;
?>
</td></tr>
</table>
</td><td valign=top align=center>
<h3>Messages</h3><p>
<?php
$query = GenQuery('messages', 'g', 'level', 'level desc');
$res = @DbQuery($query, $link);
if ($res) {
$nlev = @DbNumRows($res);
if ($nlev) {
?>
<table bgcolor=#666666 <?php
echo $tabtag;
?>
><tr bgcolor=#<?php
echo $bg2;
?>
>
<th width=80><img src=img/32/impt.png><br>Level</th>
<th><img src=img/32/eyes.png><br>Events</th>
<?php
示例14: GenQuery
echo $tabtag;
?>
>
<tr bgcolor=#<?php
echo $bg2;
?>
>
<th colspan=2><img src=img/32/nglb.png><br>Destination</th>
<th><img src=img/32/neti.png ><br>Next Hop</th>
<th><img src=img/32/dumy.png><br>Interface</th>
<th><img src=img/32/tap.png ><br>Bandwidth</th>
<th><img src=img/32/casp.png><br>Metric 1</th>
<th><img src=img/32/edit.png><br>Protocol</th>
<th><img src=img/32/clock.png><br>Age [s]</th>
<?php
$query = GenQuery('interfaces', 's', '*', '', '', array('device'), array('='), array($rtr));
$res = @DbQuery($query, $link);
while ($i = @DbFetchRow($res)) {
$ina[$i[2]] = $i[1];
$ity[$i[2]] = $i[4];
$ial[$i[2]] = $i[7];
$icm[$i[2]] = $i[20];
$isp[$i[2]] = $i[9];
}
@DbFreeResult($res);
$r = DevRoutes($devip[$rtr], $devcom[$rtr]);
$row = 0;
foreach (array_keys($r) as $rd) {
if ($row % 2) {
$bg = $bga;
$bi = $bia;
示例15: GenQuery
?>
</span>
<img src="img/16/exit.png" title="Stop" onClick="stop_countdown(interval);">
</th>
<th width="80">
<input type="submit" name="create" value="<?php
echo $wrtlbl;
?>
"></th>
</table></form>
<p>
<?php
}
$query = GenQuery('chat', 's', '*', 'time desc', 100);
$res = DbQuery($query, $link);
if ($res) {
?>
<h2><?php
echo $msglbl;
?>
</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="100"><img src="img/16/clock.png"><br><?php
echo $timlbl;
?>