本文整理汇总了PHP中BD::Exec方法的典型用法代码示例。如果您正苦于以下问题:PHP BD::Exec方法的具体用法?PHP BD::Exec怎么用?PHP BD::Exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BD
的用法示例。
在下文中一共展示了BD::Exec方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LogUsuario
function LogUsuario($pUserid, $pOrigem, $pLogado)
{
$gi = geoip_open($_SERVER['DOCUMENT_ROOT'] . "/geoip/GeoLiteCity.dat", GEOIP_STANDARD);
$geoip = geoip_record_by_addr($gi, $_SERVER['REMOTE_ADDR']);
$db = new BD();
$sql = sprintf("select count(*) qtde from log_usuario\n where\n ip = '%s'\n and sessionid = '%s'", $_SERVER['REMOTE_ADDR'], session_id());
$db->Query($sql);
$db->Next();
if ($db->getValue("qtde") == 0) {
$sql = sprintf("insert into log_usuario\n\t\t\t\t\t(userid,datahora,origem,logado,ip,sessionid,cidade,estado,pais)\n\t\t\t\t\tvalues (%d,now(),'%s','%s','%s','%s','%s','%s','%s')", $pUserid, $pOrigem, $pLogado, $_SERVER['REMOTE_ADDR'], session_id(), $geoip->city, RetornaEstado($geoip->country_code, $geoip->region), $geoip->country_name);
} else {
$sql = sprintf("update log_usuario\n\t\t\t\t\t\t\tset userid = %d,\n\t\t\t\t\t\t\t\torigem = '%s',\n\t\t\t\t\t\t\t\tlogado = '%s',\n\t\t\t\t\t\t\t\tqtde = qtde + 1\n\t\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\tip = '%s'\n\t\t\t\t\t\t\t\tand sessionid = '%s'", $pUserid, $pOrigem, $pLogado, $_SERVER['REMOTE_ADDR'], session_id());
}
$db->Exec($sql);
$db->Close();
geoip_close($gi);
}
示例2: RegistraVoto
function RegistraVoto($opc)
{
//Registra o voto na opção informada
$db = new BD();
$sql = sprintf("insert into cad_enquete_votos\n\t (numero,opcao,ip,datahora,userid)\n\t\t\t\t\t\tvalues (%d,%d,'%s',date_add(now(),interval 1 hour),%d)", $this->getCodigo(), $opc, $_SERVER['REMOTE_ADDR'], $_SESSION['userid']);
$db->Exec($sql);
$db->Close();
}
示例3: trim
<?php
include "sessao.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/class.bd.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/class.usuario.php";
$userid = $_GET['usr'];
$id = trim($_GET['id']);
$usr = new Usuario($userid);
$cnf = md5(trim(trim($usr->getUsername()) . "lstmailexc" . trim($usr->getEMail())));
if ($id == $cnf) {
$db = new BD();
$sql = sprintf("update cad_usuario\n\t\t\t\t\t\t\t\tset recmail = 'N'\n\t\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\tuserid = %d", $userid);
$db->Exec($sql);
$db->Close();
}
echo "<script> window.location = 'index.php'; </script>";
示例4: Exclui
function Exclui()
{
//Exclui a reuniao
if ($this->Existe == 'N') {
return;
}
$db = new BD();
$sql = sprintf("delete from smsserver_out where id = %d", $this->getID());
$db->Exec($sql);
$db->Close();
}
示例5: Exclui
function Exclui()
{
//Exclui o evento
if ($this->Existe == 'N') {
return;
}
$db = new BD();
$sql = sprintf("delete from cad_eventos where id = %d", $this->getID());
$db->Exec($sql);
$db->Close();
$pasta = sprintf("./eventos/%06d/", $this->getID());
if (is_dir($pasta) == true) {
rmdir($pasta) or die("erro excluindo diretorio");
}
}
示例6: RetornaEstado
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/sessao.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/class.bd.php";
include $_SERVER['DOCUMENT_ROOT'] . "/geoipcity.inc";
$gi = geoip_open($_SERVER['DOCUMENT_ROOT'] . "/geoip/GeoLiteCity.dat", GEOIP_STANDARD);
$db = new BD();
$db2 = new BD();
$sql = sprintf("select sequencia,ip,datahora,cidade from log_usuario where cidade is null\nand datahora >= '2008-01-01 00:00' and ip is not null order by sequencia");
$db->Query($sql);
// $db->Next();
while ($db->Next()) {
echo $db->getValue("sequencia") . " " . $db->getValue("ip") . " " . $db->getValue("cidade");
$geoip = geoip_record_by_addr($gi, $db->getValue("ip"));
$sql = sprintf("update log_usuario\n\t\t\t \t\t\t\tset cidade='%s',\n\t\t\t\t\t\t\t\testado='%s',\n\t\t\t\t\t\t\t\tpais='%s'\n\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\tsequencia=%d", $geoip->city, RetornaEstado($geoip->country_code, $geoip->region), $geoip->country_name, $db->getValue("sequencia"));
$db2->Exec($sql);
}
$db->Close();
$db2->Close();
geoip_close($gi);
function RetornaEstado($pais, $regiao)
{
require_once $_SERVER['DOCUMENT_ROOT'] . "/geoipregionvars.php";
return $GEOIP_REGION_NAME[$pais][$regiao];
}