예제 #1
0
 /**
  *  Restituisce un singleton per la connessione al Db
  * @return \Db
  */
 public static function getInstance()
 {
     if (!isset(self::$singleton)) {
         self::$singleton = new Db();
     }
     return self::$singleton;
 }
 public static function create($key, $secret)
 {
     $pdo = Db::singleton();
     $pdo->exec("insert into oauth_consumer (consumer_key,consumer_secret,active) values ('" . $key . "','" . $secret . "',1)");
     $consumer = new Consumer($pdo->lastInsertId());
     return $consumer;
 }
예제 #3
0
파일: User.php 프로젝트: Adriangel/omegame
 function __construct()
 {
     $this->db = Db::singleton();
     $this->id = 0;
     $this->user = "";
     $this->pass = "";
     $this->email = "";
 }
 public function __construct($id = 0)
 {
     $this->pdo = Db::singleton();
     if ($id != 0) {
         $this->id = $id;
         $this->load();
     }
 }
예제 #5
0
function order_lookup($order_id)
{
    global $statusArray;
    $pdo = Db::singleton();
    $sql = "SELECT * FROM orders where `ID` = '{$order_id}' OR `order_key` = '{$order_id}' LIMIT 1";
    $res = $pdo->query($sql);
    while ($row = $res->fetch()) {
        return $statusArray[$row['status']];
    }
    return 'No Order Matching that ID was found';
}
예제 #6
0
function get_user($uid)
{
    if (isset($uid) && !empty($uid)) {
        $pdo = Db::singleton();
        $sql = "SELECT * FROM `user` WHERE `ID`='{$uid}';";
        #		echo $sql;
        $res = $pdo->query($sql);
        while ($row = $res->fetch()) {
            return $row;
        }
    }
    return null;
}
예제 #7
0
<?php

session_start();
include "config.php";
include "pdo.class.php";
include 'Services/Twilio.php';
$pdo = Db::singleton();
$client = new Services_Twilio($accountsid, $authtoken);
$room = $_SESSION['room'];
$sql = "SELECT * FROM conference where `ID` = '{$room}'";
$res = $pdo->query($sql);
$row = $res->fetch();
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<Response>
    <Dial>
        <Conference startConferenceOnEnter='false'><?php 
echo $row['ID'];
?>
</Conference>
    </Dial>
</Response>
예제 #8
0
파일: image2.class.php 프로젝트: badtux/pmg
 public function __construct($uploadId)
 {
     $this->db = Db::singleton();
     $this->load($uploadId);
 }
예제 #9
0
 /**
  * db类 使用示例
  */
 public function dbAction()
 {
     //        $db_conf = RThink_Config::get('db.test');
     $db_conf = array('host' => 'localhost', 'dbname' => 'test', 'username' => 'root', 'password' => '');
     $db = Db::singleton($db_conf);
     $db->getProfiler()->setEnabled(true);
     $db_profilers[] = $db->getProfiler();
     $this->getFrontController()->getRequest()->setParam('db_profilers', $db_profilers);
     $stmt = $db->query('SELECT * FROM story where id > :id limit 1', array("id" => 0));
     $res = $stmt->fetchAll();
 }
예제 #10
0
파일: upload.class.php 프로젝트: badtux/pmg
 public function __construct($accept = array())
 {
     $this->db = Db::singleton();
     $this->acceptFileTypes = $accept;
 }