本文整理汇总了PHP中Sqlite::rawQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Sqlite::rawQuery方法的具体用法?PHP Sqlite::rawQuery怎么用?PHP Sqlite::rawQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sqlite
的用法示例。
在下文中一共展示了Sqlite::rawQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: security_blanket_main
function security_blanket_main()
{
global $argv;
//sleep(100);
$rem = unserialize(lfile_get_contents($argv[1]));
unlink($argv[1]);
if (!$rem) {
exit;
}
// Merged from 6.1.x/kloxo/bin/common/securityblanket.php (revision 472)
// workaround for the following php bug:
// http://bugs.php.net/bug.php?id=47948
// http://bugs.php.net/bug.php?id=51329
if (is_array($rem->func) && count($rem->func) > 0) {
$class = $rem->func[0];
class_exists($class);
}
// ---
call_user_func_array($rem->func, $rem->arglist);
$sq = new Sqlite(null, $rem->table);
$res = $sq->getRowsWhere("nname = '{$rem->nname}'", array($rem->flagvariable));
if ($res[0][$rem->flagvariable] === 'doing') {
$sq->rawQuery("update {$rem->table} set {$rem->flagvariable} = 'Program Got aborted in the midst. Please try again.' where nname = '{$rem->nname}'");
}
}
示例2: updateRemove
function updateRemove($param)
{
if_demo_throw_exception();
$server = $this->syncserver;
$sq = new Sqlite(null, "lxguardhit");
foreach ($param['_accountselect'] as $ip) {
$sq->rawQuery("delete from lxguardhit where syncserver = '{$server}' AND ipaddress = '{$ip}'");
}
self::save_current_hitlist($server);
}
示例3: driverload_main
function driverload_main()
{
global $argv, $gbl, $sgbl, $login, $ghtml;
initProgram('admin');
$p = parse_opt($argv);
if (isset($p['clear-existing'])) {
$sq = new Sqlite(null, "driver");
$sq->rawQuery("delete from driver");
}
$list = $login->getList('pserver');
foreach ($list as $l) {
$l->getandWriteModuleDriver();
}
}
示例4: database_main
function database_main()
{
global $argc, $argv;
global $gbl, $login, $ghtml;
initProgram('admin');
if ($argv[1] == 'exec') {
$db = new Sqlite(null, 'client');
$res = $db->rawQuery($argv[2]);
foreach ($res as &$r) {
foreach ($r as $k => &$__r) {
if (csb($k, "ser_")) {
$__r = unserialize(base64_decode($__r));
}
}
}
print_r($res);
exit;
}
}
示例5: time
if (isset($list['day'])) {
$day = $list['day'];
} else {
print "Day not set... Defaulting to {$day}\n";
}
$oldtime = time() - $day * 24 * 3600;
$sq = new Sqlite(null, "{$class}traffic");
$res = $sq->getTable();
foreach ($res as $r) {
if (!csa($r['nname'], ":")) {
continue;
}
$t = explode(":", $r['nname']);
$ot = $t[1];
if ($ot > $oldtime) {
print "deleting {$oldtime} {$r['nname']}\n";
$sq->rawQuery("delete from {$class}traffic where nname = '{$r['nname']}'");
} else {
//print("not deleting $oldtime {$r['nname']}\n");
}
}
$c = "{$class}traffic";
$laccess = new $c(null, null, '__last_access_domain_');
$laccess->get();
if ($laccess->timestamp > $oldtime) {
$laccess->timestamp = $oldtime;
$laccess->setUpdateSubaction();
$laccess->write();
}
system("lphp.exe ../bin/gettraffic.php");
system("lphp.exe ../bin/collectquota.php");
示例6: write_to_object
function write_to_object($object, $message, $syncserver)
{
$sq = new Sqlite(null, $object->get__table());
$sq->rawQuery("update {$object->get__table()} set olddeleteflag = 'Switch to {$syncserver} failed due to {$message}' where nname = '{$object->nname}'");
}
示例7: addToTmpIpAssign
static function addToTmpIpAssign($l)
{
$sq = new Sqlite(null, 'tmpipassign');
$date = time();
$sq->rawQuery("insert into tmpipassign (nname, ddate) values ('{$l}', '{$date}');");
}
示例8: Sqlite
<?php
include_once "htmllib/lib/include.php";
initProgram('admin');
$list = $login->getList('ippool');
$sq = new Sqlite(null, 'tmpipassign');
$res = $sq->getTable();
foreach ($res as $r) {
if (!ippool::checkIfAlreadyAssigned('vps', $r['nname'])) {
$sq->rawQuery("delete from tmpipassign where nname = '{$r['nname']}';");
continue;
}
if (time() - $r['ddate'] > 40) {
$sq->rawQuery("delete from tmpipassign where nname = '{$r['nname']}';");
}
}
foreach ($list as $l) {
$l->freeflag = 'on';
$fip = $l->getFreeIp(10000);
if ($fip) {
$l->freeflag = 'on';
} else {
$l->freeflag = 'dull';
}
$l->setUpdateSubaction();
$l->write();
}
示例9: elseif
<?php
} elseif ($cgi_forgotpwd == 2) {
$progname = $sgbl->__var_program_name;
$cprogname = ucfirst($progname);
$cgi_clientname = $ghtml->frm_clientname;
$cgi_email = $ghtml->frm_email;
htmllib::checkForScript($cgi_clientname);
$classname = $ghtml->frm_class;
if (!$classname) {
$classname = getClassFromName($cgi_clientname);
}
if (!empty($cgi_clientname) && !empty($cgi_email)) {
$tablename = $classname;
$database = new Sqlite(null, $tablename);
$data = $database->rawQuery("select contactemail from {$tablename} where nname = '{$cgi_clientname}';");
if (empty($data)) {
$ghtml->print_redirect("/login/?frm_emessage=nouser_email");
//throw lxException('Contact email is not set on Kloxo, it could not be send to a empty address.');
} elseif (!isset($data[0]['contactemail'])) {
$ghtml->print_redirect("/login/?frm_emessage=nouser_email");
//throw lxException('Contact email is not set on Kloxo, it could not be send to a empty address.');
} else {
$contact_email = $data[0]['contactemail'];
if (empty($contact_email)) {
//throw lxException('Contact email is not set on Kloxo, it could not be send to a empty address.');
$ghtml->print_redirect("/login/?frm_emessage=nouser_email");
}
}
if ($cgi_email == $contact_email) {
$rndstring = randomString(8);
示例10: Sqlite
<?php
include "htmllib/lib/include.php";
$db = new Sqlite(null, $argv[1]);
$res = $db->getTable();
$class = $argv[1];
foreach ($res as $r) {
if (isset($stored[$r['nname']])) {
print "duplicate found {$r['nname']}\n";
$db->rawQuery("delete from {$class} where nname = '{$r['nname']}'");
$ob = new $class(null, null, $r['nname']);
$ob->create($r);
$ob->write();
continue;
}
$stored[$r['nname']] = $r;
}
示例11: add
static function add($parent, $class, $param)
{
global $gbl, $sgbl, $login, $ghtml;
if (if_demo()) {
throw new lxException("demo", $v);
}
lxclient::fixpserver_list($param);
$param['nname'] = strtolower($param['nname']);
if (!cse($param['nname'], ".vm")) {
$param['nname'] .= ".vm";
}
if (csa($param['nname'], '-')) {
throw new lxexception('name_cannot_contain_dash', 'nname', '');
}
if (csa($param['nname'], ' ')) {
throw new lxexception('name_cannot_contain_space', 'nname', '');
}
// the uuser is two steps removed from the main object (domain), and thus the automatic nname creation doesn't seem to work. So we have to do it here.
$param['realpass'] = $param['password'];
$param['password'] = crypt($param['password']);
$total = db_get_value("pserver", $param['syncserver'], "max_vps_num");
if ($total) {
$sq = new Sqlite(null, 'vps');
$countres = $sq->rawQuery("select count(*) from vps where syncserver = '{$param['syncserver']}'");
$countres = $countres[0]['count(*)'];
if ($countres >= $total) {
throw new lxexception('vps_per_server_exceeded', 'syncserver', "{$countres} > {$total}");
}
}
return $param;
}
示例12:
exit;
}
//dprintr($nlist);
foreach ($res as $r) {
if ($slave) {
if ($r['syncserver'] !== $slave) {
continue;
}
} else {
if (!csa($r['nname'], "openvz")) {
print "Not imported ... Skipping\n";
continue;
}
}
print "Fixing {$r['nname']} ..\n";
print_r($nlist[$r['vpsid']]);
print "\n";
if (!isset($nlist[$r['vpsid']])) {
print "No Data entry for {$r['vpsid']} {$r['nname']}\n";
continue;
}
$l = $nlist[$r['vpsid']];
$newname = $l['nname'];
$contact = $l['contactemail'];
$password = $l['password'];
$rootpassword = $l['rootpassword'];
$sq->rawQuery("update vps set nname = '{$newname}' where nname = '{$r['nname']}'");
$sq->rawQuery("update vps set contactemail = '{$contact}' where nname = '{$r['nname']}'");
$sq->rawQuery("update vps set password = '{$password}' where nname = '{$r['nname']}'");
$sq->rawQuery("update vps set rootpassword = '{$rootpassword}' where nname = '{$r['nname']}'");
}
示例13: getTabledetails
function getTabledetails($tbl_name)
{
dprint("table. values are ..........\n");
$db = new Sqlite($tbl_name);
$res = $db->rawQuery("select * from " . $tbl_name);
print_r($res);
}
示例14: Sqlite
<?php
include_once "htmllib/lib/include.php";
initProgram('admin');
if (!$sgbl->isHyperVM()) {
print "Only implemented for hyperVM\n";
exit;
}
$oslave = $argv[1];
$nslave = $argv[2];
if (!$nslave) {
print "Usage: change-slave-name old-slave-id new-slave-id\n";
exit;
}
$sq = new Sqlite(null, "pserver");
$r = $sq->getRowsWhere("nname = '{$oslave}'");
if (!$r) {
print "No slave as {$oslave}\n";
exit;
}
$r = $sq->getRowsWhere("nname = '{$nslave}'");
if ($r) {
print "slave {$nslave} already exists\n";
exit;
}
$sq->rawQuery("update driver set nname = '{$nslave}' where nname = '{$oslave}'");
$sq->rawQuery("update vps set syncserver = '{$nslave}' where syncserver = '{$oslave}'");
$sq->rawQuery("update pserver set syncserver = '{$nslave}' where nname = '{$oslave}'");
$sq->rawQuery("update pserver set nname = '{$nslave}' where nname = '{$oslave}'");
$sq->rawQuery("update dirlocation set nname = '{$nslave}' where nname = '{$oslave}'");
$sq->rawQuery("update ipaddress set syncserver = '{$nslave}' where syncserver = '{$oslave}'");
示例15: do_remote_exec
function do_remote_exec($machine, $rmt, $cmdtype, $nname, $dbaction)
{
global $gbl, $sgbl, $login, $ghtml;
$remotechar = $sgbl->__var_remote_char;
if ($login && $login->isSuperClient()) {
$table = 'node';
$class = 'admin';
} else {
$table = 'pserver';
$class = 'slave';
}
if (!isLocalhost($machine)) {
$var = $table . "_password";
if (isset($gbl->{$var}) && $gbl->{$var}) {
$password = $gbl->{$var};
} else {
$ssm = new Sqlite(null, $table);
$res = $ssm->rawQuery("select realpass from {$table} where nname = '{$machine}'");
if ($res) {
$password = $res[0]['realpass'];
} else {
throw new lxException("machine_doesnt_exist_in_db", 'nname', $machine);
}
}
} else {
$password = getAdminDbPass();
$machine = 'localhost';
}
$port = $sgbl->__var_prog_port;
$rmt->version = $sgbl->__ver_major_minor_release;
$rmt->machine = $machine;
$rmt->remote_login = $class;
$rmt->password = $password;
$rmt->master_c = getOneIPForLocalhost($machine);
$var = base64_encode(serialize($rmt));
if (!isLocalhost($rmt->machine)) {
$user = base64_encode('slave');
$pass = base64_encode($rmt->password);
$var = $remotechar . "\n" . $user . "\n" . $pass . "\n" . $var;
}
$totalout = send_to_some_server($machine, $var);
$res = unserialize(base64_decode($totalout));
if (!$res) {
throw new lxException('could_not_connect_to_server', 'syncserver', $machine);
}
//dprint($res->message);
if ($res->exception) {
throw $res->exception;
}
//dprint($res->message);
//print_time('server', "remote<b> $raddress</b>: $size KB", 2);
// We have only return values. The output of the command is discarded. This leads to tremendous savings of bandwidth; makes the communication almost one way. If you want to get the output, you have to use the lxshell_output function and give your command as the argument. This function changes the output as a return value which is then returned back. The whole concept is about function execution, and returning the ret value of the function.
$err = $res ? 3 : 2;
dprint("<br> <table border=2> <tr> <td > Remote: {$machine}, {$cmdtype}, {$nname}, {$dbaction}<br> ", $err);
if (!$res) {
dprint("<b> <font color=red>Got Error: </b> </font> {$res}", $err);
//$ser = base64_decode($res);
//dprint($ser);
} else {
dprint("Message: " . $res->message . "<br> ", $err);
}
dprint("</td> </tr> </table> ", $err);
if (!$res) {
dprint("Warning");
}
if ($res->__this_warning) {
$gbl->__this_warning = $res->__this_warning;
}
return $res;
}