本文整理汇总了PHP中database::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP database::getInstance方法的具体用法?PHP database::getInstance怎么用?PHP database::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database
的用法示例。
在下文中一共展示了database::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($BikeId = null, $BranchId = null, $Number = null)
{
$this->bikes_id = $BikeId;
$this->branch_identifier = $BranchId;
$this->number_of_bikes = $Number;
$this->db = database::getInstance();
}
示例2: __construct
private function __construct()
{
require_once './database.class.php';
require_once './movie.class.php';
$this->db = database::getInstance();
$this->db->connect();
}
示例3: init
public function init()
{
if (database::getInstance()->isDown() || !property::getInstance()->get('collect_statistic')) {
return;
}
$realip = system::getInstance()->getRealIp();
$visittime = time();
$browser = self::user_browser($_SERVER['HTTP_USER_AGENT']);
$os = self::user_os($_SERVER['HTTP_USER_AGENT']);
$cookie = $_COOKIE['source'] ?: '';
$userid = user::getInstance()->get('id');
if ($userid == null) {
$userid = 0;
}
if ($cookie == null) {
$settime = $visittime + 365 * 24 * 60 * 60;
setcookie('source', system::getInstance()->md5random(), $settime, '/');
$cookie = '';
}
$referer = $_SERVER['HTTP_REFERER'] ?: '';
$path = $_SERVER['REQUEST_URI'] ?: '';
$query = "INSERT INTO " . property::getInstance()->get('db_prefix') . "_statistic (ip, cookie, browser, os, time, referer, path, reg_id) VALUES(?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = database::getInstance()->con()->prepare($query);
$stmt->bindParam(1, $realip, \PDO::PARAM_STR);
$stmt->bindParam(2, $cookie, \PDO::PARAM_STR, 32);
$stmt->bindParam(3, $browser, \PDO::PARAM_STR);
$stmt->bindParam(4, $os, \PDO::PARAM_STR);
$stmt->bindParam(5, $visittime, \PDO::PARAM_INT);
$stmt->bindParam(6, $referer, \PDO::PARAM_STR);
$stmt->bindParam(7, $path, \PDO::PARAM_STR);
$stmt->bindParam(8, $userid, \PDO::PARAM_INT);
$stmt->execute();
}
示例4: init
/**
* Check if user is permament banned in database and display ban.tpl theme
*/
public function init()
{
$ip = system::getInstance()->getRealIp();
$time = time();
$userid = user::getInstance()->get('id');
if ($userid > 0) {
$stmt = database::getInstance()->con()->prepare("SELECT COUNT(*) FROM " . property::getInstance()->get('db_prefix') . "_user_block WHERE (user_id = ? or ip = ?) AND (express > ? OR express = 0)");
$stmt->bindParam(1, $userid, \PDO::PARAM_INT);
$stmt->bindParam(2, $ip, \PDO::PARAM_STR);
$stmt->bindParam(3, $time, \PDO::PARAM_INT);
$stmt->execute();
} else {
$stmt = database::getInstance()->con()->prepare("SELECT COUNT(*) FROM " . property::getInstance()->get('db_prefix') . "_user_block WHERE ip = ? AND (express > ? OR express = 0)");
$stmt->bindParam(1, $ip, \PDO::PARAM_STR);
$stmt->bindParam(2, $time, \PDO::PARAM_INT);
$stmt->execute();
}
$rowFetch = $stmt->fetch();
$count = $rowFetch[0];
if ($count > 0) {
// block founded in db
$content = template::getInstance()->twigRender('ban.tpl', array('local' => array('admin_email' => property::getInstance()->get('mail_from'))));
template::getInstance()->justPrint($content);
}
}
示例5: __construct
function __construct($un = null, $pwd = null, $branch_n = null, $branch_location = null)
{
$this->username = $un;
$this->password = $pwd;
$this->branch_name = $branch_n;
$this->branch_location = $branch_location;
$this->db = database::getInstance();
}
示例6: __construct
public function __construct($number = null, $brand_id = null, $branch_identifier = null, $limit_set = null)
{
$this->db = database::getInstance();
$this->bike_id = $brand_id;
$this->number_of_items = $number;
$this->branch_id = $branch_identifier;
$this->limit = $limit_set;
}
示例7: __construct
public function __construct($id = 0)
{
$this->pdo = database::getInstance();
if ($id != 0) {
$this->id = $id;
$this->getFromDatabase();
}
}
示例8: get_title
function get_title()
{
$db_once = database::getInstance();
$sql = "SELECT * FROM common_entry where ID = 1";
$row = $db_once->getDataSingle($sql);
$Name = $row['Name'];
echo $Name;
//$db_once->closeConn();
}
示例9: __construct
public function __construct($id = 0)
{
$this->pdo = database::getInstance();
$this->tf = new textFinder();
$this->products = array();
if ($id != 0) {
$this->id = $id;
$this->getFromDatabase();
}
}
示例10: __construct
public function __construct($id = 0)
{
$this->pdo = database::getInstance();
$this->tf = new textFinder();
$this->id_address = -1;
if ($id != 0) {
$this->id = $id;
$this->getFromDatabase();
}
}
示例11: __construct
private function __construct()
{
require_once './database.class.php';
require_once './event.class.php';
/* echo 'Creating database instance. <br/>'; */
$this->db = database::getInstance();
/* echo 'Database instance created. <br/>';
echo 'Creating connection. <br/>'; */
$this->db->connect();
/* echo 'Database connected. <br/>'; */
}
示例12: getUserByEmail
public static function getUserByEmail($email)
{
$db = database::getInstance();
$stmt = $db->prepare("SELECT uid FROM users WHERE email=? LIMIT 1");
$stmt->bind_param("s", $email);
$db->select($stmt);
$stmt->bind_result($id);
if ($stmt->fetch()) {
$stmt->close();
return new User($id);
}
return NULL;
}
示例13: __construct
public function __construct($id = 0)
{
$this->pdo = database::getInstance();
$this->tf = new textFinder();
$this->id = $id;
$this->name = '';
$this->description = '';
$this->cost = 0;
$this->price = 0;
$this->unit = '';
$this->id_group = 0;
if ($id != 0) {
$this->getFromDatabase();
}
}
示例14: getUser
public static function getUser($username, $input)
{
$db = database::getInstance();
$stmt = $db->prepare("SELECT uid,password FROM users WHERE username=? LIMIT 1");
$stmt->bind_param("s", $username);
$db->select($stmt);
$stmt->bind_result($id, $password);
if ($stmt->fetch()) {
if (self::ValidatePassword($input, $password)) {
$stmt->close();
return new User($id);
}
}
return NULL;
}
示例15: __construct
public function __construct($id = 0)
{
$this->pdo = database::getInstance();
$this->id_contact = "";
$this->id_billing_address = "";
$this->id_receiving_address = "";
$this->normal_billing_period = "";
$this->receiving_address = new address();
$this->billing_address = new address();
$this->tf = new textFinder();
$this->orders = array();
$this->ordersMonth = array();
$this->alreadyPaid = 0;
$this->ca = 0;
if ($id != 0) {
$this->id = $id;
$this->getFromDatabase();
}
}