本文整理汇总了PHP中MysqliDb::has方法的典型用法代码示例。如果您正苦于以下问题:PHP MysqliDb::has方法的具体用法?PHP MysqliDb::has怎么用?PHP MysqliDb::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MysqliDb
的用法示例。
在下文中一共展示了MysqliDb::has方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MysqliDb
<?php
require_once 'MysqliDb.php';
require_once 'constantes.php';
$bd = new MysqliDb(SERVER_DB_URL, SERVER_DB_USUARIO, SERVER_DB_PASS, SERVER_DB_NOMBRE);
if (!$bd->ping()) {
$bd->connect();
}
if ($_SERVER['REQUEST_METHOD'] == REQUEST_METODO_POST) {
$postdata = json_decode(file_get_contents('php://input'));
$usuario_form = $postdata->usuario;
$pass_form = md5($postdata->pass);
$bd->where(COLUMNA_EMAIL, $usuario_form);
$bd->where(COLUMNA_PASS, $pass_form);
if ($bd->has(TABLA_USUARIO)) {
// CORRECTO
$accion_form = $postdata->form_accion;
if ($accion_form == ACCION_OBTENER) {
$query = $bd->get(TABLA_CATEGORIA);
$arr = array(RESPUESTA_DATA => $query, RESPUESTA_MENSAJE => MENSAJE_OK, RESPUESTA_ERROR => ERROR_NINGUNO);
} else {
if ($accion_form == ACCION_OBTERNER_POR_ID) {
$parametros = $postdata->form_parametros;
foreach ($parametros as $parametro_key => $parametro_valor) {
// var_dump($parametro_key);
// var_dump($parametro_valor);
foreach ($parametro_valor as $key => $val) {
// var_dump($key);
// var_dump($val);
switch ($key) {
case PARAMETRO_ID:
示例2: getAllSheet
public function getAllSheet()
{
$db = new MysqliDb(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$result = $db->get("trails");
$trails = array();
foreach ($result as $id => $trail) {
$trails[$trail['id']] = $trail;
$attractions = json_decode(stripslashes($trail['attractions']));
$trails[$trail['id']]['attractions'] = $attractions;
$loops = json_decode(stripslashes($trail['loops']));
$trails[$trail['id']]['loops'] = array();
foreach ($loops as $id => $data) {
$trails[$trail['id']]['loops'][$id] = (array) $data;
}
$db->where("trail_id", $trail['id']);
if ($db->has("translations")) {
$db->where("trail_id", $trail['id']);
$result2 = $db->get("translations");
$translations = array();
foreach ($result2 as $id => $translation) {
array_push($translations, $translation['lang']);
}
$trails[$trail['id']]['translations'] = $translations;
} else {
$trails[$trail['id']]['translations'] = "none";
}
$trails[$trail['id']]['satImgURL'] = BASE_URL . $trail['satImgURL'];
$trails[$trail['id']]['largeImgURL'] = BASE_URL . $trail['largeImgURL'];
$trails[$trail['id']]['thumbURL'] = BASE_URL . $trail['thumbURL'];
$trails[$trail['id']]['url'] = BASE_URL . "trail/" . $trail['id'] . "/" . $this->slugify($trail['name']) . "/";
}
$total = count($trails);
$response['trails'] = $trails;
$response['totalMatched'] = $total;
return $response;
}
示例3: header
header("Location: " . $baseurl . "user/new/provider/?status=error&code=password&" . $querystring);
exit;
}
$secret = "6LfdFBUTAAAAAF40Be_HnpwT_Oj6CyDAsgtLohW_";
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
if ($resp->isSuccess()) {
// verified!
} else {
$errors = $resp->getErrorCodes();
header("Location: " . $baseurl . "user/new/provider/?status=error&code=captcha&" . $querystring . "&respcode=" . http_build_query($errors));
exit;
}
$db = new MysqliDb(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$db->where("email", $email);
if ($db->has("users")) {
header("Location: " . $baseurl . "user/new/provider/?status=error&code=exists&" . $querystring);
exit;
}
$Auth = new Auth();
// $result = $Auth->createUser($email, $password, $fname, $lname, $is_active = 1, $is_admin = 0, $is_provider = 0, $is_super = 0, $is_verified = 0);
$result = $Auth->createUser($email, $password1, $fn, $ln, 1, 0, 1, 0, 0);
if ($result['status']) {
$attribute = array('pn' => $pn, 'ph' => $ph, 'title' => $prof, 'zip' => $zip);
if ($Auth->setAttr($result['id'], $attribute)) {
header("Location: " . $baseurl . "user/new/provider/done.php?e=" . $email);
} else {
die("auth error");
}
} else {
die("auth error");
示例4: setAttr
public function setAttr($id, $attribute)
{
$db = new MysqliDb(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$db->where("id", $id);
if ($db->has("users")) {
$db->where('id', $id);
$user = $db->getOne("users");
if (empty($user['data'])) {
$data = $attribute;
} else {
$userData = json_decode($user['data'], true);
$data = array_merge($userData, $attribute);
}
$newData = array("data" => json_encode($data));
$db->where('id', $id);
if ($db->update('users', $newData)) {
return true;
} else {
return 'update failed: ' . $db->getLastError();
}
} else {
return false;
}
}