本文整理汇总了PHP中dba_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP dba_exists函数的具体用法?PHP dba_exists怎么用?PHP dba_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dba_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
public function __get($name)
{
$db = dba_open($this->filePath, 'wl', 'db4');
$value = dba_exists($name, $db) ? dba_fetch($name, $db) : null;
dba_close($db);
return $value;
}
示例2: delete
/**
* Delete cache
* @param string $id
* @return boolean
*/
public function delete($key)
{
if (!dba_exists($key, $this->_handler('r'))) {
return true;
}
return dba_delete($key, $this->_handler('w'));
}
示例3: getComments
function getComments($req)
{
$err = "";
$ra = array();
$encoder = new PhpXmlRpc\Encoder();
$msgID = $encoder->decode($req->getParam(0));
$dbh = dba_open("/tmp/comments.db", "r", "db2");
if ($dbh) {
$countID = "{$msgID}_count";
if (dba_exists($countID, $dbh)) {
$count = dba_fetch($countID, $dbh);
for ($i = 0; $i < $count; $i++) {
$name = dba_fetch("{$msgID}_name_{$i}", $dbh);
$comment = dba_fetch("{$msgID}_comment_{$i}", $dbh);
// push a new struct onto the return array
$ra[] = array("name" => $name, "comment" => $comment);
}
}
}
// if we generated an error, create an error return response
if ($err) {
return new PhpXmlRpc\Response(0, PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser, $err);
} else {
// otherwise, we create the right response
return new PhpXmlRpc\Response($encoder->encode($ra));
}
}
示例4: exists
public function exists($key)
{
if (!$this->db_file_exists()) {
return FALSE;
}
return dba_exists($key, $this->get_db_handle('r'));
}
示例5: getcomments
function getcomments($m)
{
global $xmlrpcerruser;
$err = "";
$ra = array();
// get the first param
if (XMLRPC_EPI_ENABLED == '1') {
$msgID = xmlrpc_decode($m->getParam(0));
} else {
$msgID = php_xmlrpc_decode($m->getParam(0));
}
$dbh = dba_open("/tmp/comments.db", "r", "db2");
if ($dbh) {
$countID = "{$msgID}_count";
if (dba_exists($countID, $dbh)) {
$count = dba_fetch($countID, $dbh);
for ($i = 0; $i < $count; $i++) {
$name = dba_fetch("{$msgID}_name_{$i}", $dbh);
$comment = dba_fetch("{$msgID}_comment_{$i}", $dbh);
// push a new struct onto the return array
$ra[] = array("name" => $name, "comment" => $comment);
}
}
}
// if we generated an error, create an error return response
if ($err) {
return new xmlrpcresp(0, $xmlrpcerruser, $err);
} else {
// otherwise, we create the right response
// with the state name
return new xmlrpcresp(php_xmlrpc_encode($ra));
}
}
示例6: lookup_nonce
function lookup_nonce($consumer, $token, $nonce, $timestamp) {/*{{{*/
if (dba_exists("nonce_$nonce", $this->dbh)) {
return TRUE;
} else {
dba_insert("nonce_$nonce", "1", $this->dbh);
return FALSE;
}
}/*}}}*/
示例7: lookupNonce
function lookupNonce($consumer, $token, $nonce, $timestamp)
{
if (dba_exists("nonce_{$nonce}", $this->dbh)) {
return true;
} else {
dba_insert("nonce_{$nonce}", "1", $this->dbh);
return false;
}
}
示例8: dba_open
//�ppna databasen
$db = dba_open("my_db.db", "c", "db4");
$entry = 0;
// R�knar hur m�nga entries som finns i databasen
while (dba_exists($entry, $db)) {
$entry++;
}
// G�r ett l�mplig datum och tidsvisning till en str�ng
$time = date("Y-n-d G:i:s");
// Fyller databasen med v�sentliga v�rden
dba_insert($entry, $_SERVER['HTTP_USER_AGENT'], $db);
dba_insert(++$entry, $_SERVER['REMOTE_ADDR'], $db);
dba_insert(++$entry, $time, $db);
//H�mtar fr�n databasen s�l�nge som det finns n�got i en viss entry
$counter = 3;
while (dba_exists($entry, $db)) {
//�r det tiden som h�mtades?
if ($counter == 3) {
echo "Time: " . dba_fetch($entry, $db) . "\n";
} else {
if ($counter == 2) {
echo "Remote address: " . dba_fetch($entry, $db) . "\n";
} else {
echo "User Agent: " . dba_fetch($entry, $db) . "\n\n";
}
}
// Minska r�knaren nu med ett
--$counter;
// �r r�knaren lika med noll?, i s�nna fall b�rja om fr�n b�rjan med r�knandet
if (!$counter) {
$counter = 3;
示例9: dirname
$handler = 'cdb';
$db_file = dirname(__FILE__) . '/test.cdb';
if (($db_file = dba_open($db_file, "r", $handler)) !== FALSE) {
// read key sequence
$a = dba_firstkey($db_file);
$count = 0;
$keys = $a;
while ($a) {
$a = dba_nextkey($db_file);
$keys .= $a;
$count++;
}
// display number of entries and key existence
echo $count;
for ($i = 1; $i < 8; $i++) {
echo dba_exists($i, $db_file) ? "Y" : "N";
}
echo "\n=";
echo dba_fetch(1, $db_file);
echo dba_fetch(2, $db_file);
echo dba_fetch(3, $db_file);
echo dba_fetch(4, $db_file);
echo "\n#";
echo dba_fetch(1, $db_file);
echo dba_fetch(1, $db_file);
echo dba_fetch(2, $db_file);
echo dba_fetch(2, $db_file);
echo "\n?" . $keys;
// with skip = 0 dba_fetch must fetch the first result
echo "\n#";
$skip = array();
示例10: ifAlreadyDownloaded
function ifAlreadyDownloaded($uri)
{
$fam = new familysite();
$parse_url = parse_url($uri);
$hostname = $parse_url["host"];
$familysite = $fam->GetFamilySites($hostname);
$dbfile = "{$GLOBALS["HyperCacheStoragePath"]}/cache.db";
if (!is_file($dbfile)) {
events("ifAlreadyDownloaded:: {$dbfile} no such file...");
return false;
}
$db_con = @dba_open($dbfile, "c", "db4");
if (!$db_con) {
events("analyze:: FATAL!!!::{$dbfile}, unable to open");
return false;
}
if (@dba_exists($uri, $db_con)) {
$array = unserialize(dba_fetch($uri, $db_con));
$filepath = $array["filepath"];
if (is_file("{$GLOBALS["HyperCacheStoragePath"]}/{$filepath}")) {
$filesize = $array["filesize"];
if ($filesize == @filesize("{$GLOBALS["HyperCacheStoragePath"]}/{$filepath}")) {
events("ifAlreadyDownloaded:: {$GLOBALS["HyperCacheStoragePath"]}/{$filepath} already exists");
@dba_close($db_con);
return true;
}
}
} else {
events("ifAlreadyDownloaded:: {$uri} doesn't exists...");
}
@dba_close($db_con);
return false;
}
示例11: internalRemoveItem
/**
* Internal method to remove an item.
*
* @param string $normalizedKey
* @return bool
* @throws Exception\ExceptionInterface
*/
protected function internalRemoveItem(&$normalizedKey)
{
$options = $this->getOptions();
$namespace = $options->getNamespace();
$prefix = $namespace === '' ? '' : $namespace . $options->getNamespaceSeparator();
$internalKey = $prefix . $normalizedKey;
$this->_open();
// Workaround for PHP-Bug #62490
if (!dba_exists($internalKey, $this->handle)) {
return false;
}
return dba_delete($internalKey, $this->handle);
}
示例12: bExists
/**
* @return bool
*/
public function bExists($sKey)
{
return dba_exists($sKey, $this->_hFile);
}
示例13: delete
function delete($key)
{
if (dba_exists($key, $this->_id)) {
return dba_delete($key, $this->_id);
}
return 1;
}
示例14: Phistank
function Phistank($ARRAY)
{
$URI = $ARRAY["URI"];
if (!is_file("/etc/squid3/phistank.db")) {
if ($GLOBALS["VERBOSE"]) {
events("/etc/squid3/phistank.db no such file");
}
return false;
}
$CONNECT = false;
$KEY = null;
if (isset($ARRAY["MAC"])) {
$MAC = $ARRAY["MAC"];
}
$H = parse_url($URI);
$domain = $H["host"];
$md51 = md5($domain);
$md52 = md5($URI);
$md53 = md5($URI . "/");
$userid = $ARRAY["userid"];
$PROTO = $ARRAY["PROTO"];
$IP = $ARRAY["IP"];
if (isset($GLOBALS["PHISHTANK_QUEUE"])) {
if (count($GLOBALS["PHISHTANK_QUEUE"]) > 10000) {
$GLOBALS["PHISHTANK_QUEUE"] = array();
}
}
if (preg_match("#([0-9\\.]+)\\/(.*)#", $IP, $re)) {
$hostname = $re[2];
$IP = $re[1];
}
$SquidGuardIPWeb = $GLOBALS["SquidGuardIPWeb"];
$CONNECT = false;
$KEY = null;
if (isset($ARRAY["MAC"])) {
$MAC = $ARRAY["MAC"];
}
$urlenc = urlencode($URI);
$returned = "{$GLOBALS["SquidGuardIPWeb"]}?rule-id=0SquidGuardIPWeb=" . base64_encode($GLOBALS["SquidGuardIPWeb"]) . "&clientaddr={$IP}&clientname={$IP}&clientuser={$userid}" . "&clientgroup=default&targetgroup=phishtank&url={$urlenc}";
$md5Key = md5("{$userid}{$IP}{$URI}");
if (isset($GLOBALS["PHISHTANK_QUEUE"][$md5Key])) {
ufdbgevents("default", "phishtank");
Output_results($GLOBALS["PHISHTANK_QUEUE"][$md5Key], __FUNCTION__, __LINE__);
return true;
}
$db_con = @dba_open("/etc/squid3/phistank.db", "r", "db4");
if (!$db_con) {
if ($GLOBALS["VERBOSE"]) {
events("Phistank: FATAL!!!::/etc/squid3/phistank.db, unable to open");
}
return false;
}
if (@dba_exists($md51, $db_con)) {
@dba_close($db_con);
ufdbgevents("phishtank", "phishtank");
$GLOBALS["PHISHTANK_QUEUE"][$md5Key] = $returned;
Output_results($returned, __FUNCTION__, __LINE__);
return true;
}
if (@dba_exists($md52, $db_con)) {
@dba_close($db_con);
ufdbgevents("default", "phishtank");
$GLOBALS["PHISHTANK_QUEUE"][$md5Key] = $returned;
Output_results($returned, __FUNCTION__, __LINE__);
return true;
}
if (@dba_exists($md53, $db_con)) {
@dba_close($db_con);
ufdbgevents("phishtank", "phishtank");
$GLOBALS["PHISHTANK_QUEUE"][$md5Key] = $returned;
Output_results($returned, __FUNCTION__, __LINE__);
return true;
}
return false;
}
示例15: exists
/**
* Checks if a key/value pair exists in the database.
*
* @access public
* @param string $key
* @return boolean
*
*/
function exists($key)
{
return @dba_exists($key, $this->connection);
}