public function __construct() { $this->_table = DB_PREFIX . 'Roles'; $this->_rows = 'ID, Name, Role'; $this->_colums = array('ID', 'Name', 'Role'); $this->_database = DB::load(); }
public function __construct() { parent::__construct(); $this->_table = DB_PREFIX . 'News'; $this->_type = 'news'; $this->_database = DB::load(); }
/** * Test selecting a row using conn->load() */ public function testLoad() { $this->assertEquals(array('id' => 1, 'key' => 'one', 'title' => 'first row', 'status' => 'ACTIVE'), $this->conn->load("test", 1, DB::FETCH_ASSOC), 'Using id=1'); $this->assertEquals(array('id' => 3, 'key' => 'three', 'title' => 'another row', 'status' => 'PASSIVE'), $this->conn->load("test", array('key' => 'three'), DB::FETCH_ASSOC), 'Using id=array("key"=>"three")'); $this->assertEquals(array(1, 'one', 'first row', 'ACTIVE'), $this->conn->load("test", 1, DB::FETCH_ORDERED), 'Using id=1'); $this->assertEquals(array(1, 'one', 'first row', 'ACTIVE', 'id' => 1, 'key' => 'one', 'title' => 'first row', 'status' => 'ACTIVE'), $this->conn->load("test", 1, DB::FETCH_FULLARRAY), 'Using id=1'); $this->assertNull($this->conn->load("test", 99), 'Using id=99'); }
public function testTransaction() { $fuck = DB::dispense('fuck'); $fuck->name = 'Learn to Program'; $id = DB::store($fuck); DB::begin(); try { $fuck = DB::load('fuck', $id); $fuck->name = 'miss'; DB::store($fuck); throw new Exception(''); DB::commit(); } catch (Exception $e) { DB::rollback(); } }
if( isset($_SESSION['sIdname']) ){ redirect('../nindex.htm'); } // redirect to where are you from $match = preg_match('/login\_page/', $_SERVER['HTTP_REFERER']); if( isset($_SERVER['HTTP_REFERER']) && $match === 0 ){ $actual_link = "http://$_SERVER[HTTP_HOST]/sm3/surasak3/"; $_SESSION['refer'] = str_replace($actual_link, '', $_SERVER['HTTP_REFERER']); } $action = isset($_REQUEST['action']) ? trim($_REQUEST['action']) : false ; if( $action === 'login' ){ DB::load(); $sql = "SELECT * FROM `inputm` WHERE `idname` = :test_idname AND `pword` = :test_pword AND `status` = 'y'"; $data = array( ':test_idname' => trim($_POST['username']), ':test_pword' => trim($_POST['password']), ); $item = DB::select($sql, $data, true); if( $item ){ // Set session to one day
/** * Log a user into the application by their ID */ static function loginUsingId($id) { $session = App::get('session'); $user = DB::load('users', $id); if ($user->group > 0) { $user['rights'] = self::loadRights((int) $user->group); } self::$user = $user; $session->set('user', self::$user); self::createSession($id); }
/** * Удаляет item * * @param type $item * @return type */ public static function remove( $item ){ $table = self::getTableName($item->model); $id = $item->id; $bean = DB::load($table, $id ); return DB::trash($bean); }
} }); // Setup DB-Wrapper if (!empty($AoWoWconf['aowow']['db'])) { DB::load(DB_AOWOW, $AoWoWconf['aowow']); } if (!empty($AoWoWconf['world']['db'])) { DB::load(DB_WORLD, $AoWoWconf['world']); } if (!empty($AoWoWconf['auth']['db'])) { DB::load(DB_AUTH, $AoWoWconf['auth']); } if (!empty($AoWoWconf['characters'])) { foreach ($AoWoWconf['characters'] as $realm => $charDBInfo) { if (!empty($charDBInfo)) { DB::load(DB_CHARACTERS . $realm, $charDBInfo); } } } // load config to constants $sets = DB::isConnectable(DB_AOWOW) ? DB::Aowow()->select('SELECT `key` AS ARRAY_KEY, `value`, `flags` FROM ?_config') : []; foreach ($sets as $k => $v) { // this should not have been possible if (!strlen($v['value'])) { continue; } $php = $v['flags'] & CON_FLAG_PHP; if ($v['flags'] & CON_FLAG_TYPE_INT) { $val = intVal($v['value']); } else { if ($v['flags'] & CON_FLAG_TYPE_FLOAT) {
$values = array(); foreach($items as $key => $item){ if(!empty($item)){ list($user, $pass) = explode(',', $item); $values[] = "( '0000-00-00 00:00:00', '$day_type', '$user', '$pass' )"; } $i++; } $sql .= implode(',', $values); $db = DB::load('utf8'); $insert = $db->exec($sql); if($insert != false){ $_SESSION['x-msg'] = '�����ӹǹ�����ҹ�Թ���������º����'; $_SESSION['type'] = 'success'; }else{ $_SESSION['x-msg'] = '�����ӹǹ�����ҹ�Թ������������� ��سҵԴ��ͼ������к�'; $_SESSION['type'] = 'warning'; } // header('Location: import-internet.php'); redirect('import-internet.php'); exit; } include 'templates/classic/header.php';
public function __construct() { $this->_table = DB_PREFIX . 'Options'; $this->_database = DB::load(); }
public function __construct() { $this->_table = 'TABLE_NAME'; $this->_attributes = "{$this->_table}.ID"; $this->_db = DB::load(); }
<li><a href="regis_patient.php?action=form">เพิ่มไฟล์</a></li> </ul> <?php if( !$action ){ ?> <h1>ค้นหาเอกสารตาม HN</h1> <form action="regis_patient.php" method="post"> <input type="text" name="hn_search" value="<?php echo $hn;?>"> <button type="submit">ค้นหา</button> <input type="hidden" name="task" value="search_hn"> </form> <?php if( $task === 'search_hn' ){ DB::load('utf8'); $items = DB::select("SELECT * FROM `data_patient` WHERE `hn` = :hn", array(':hn' => $hn)); $user = DB::select("SELECT * FROM `opcard` WHERE `hn` = :hn ;", array(':hn' => $hn), true); ?> <div> <p><b>ชื่อ: </b><?php echo $user['yot'].' '.$user['name'].' '.$user['surname']?></p> </div> <table> <tr> <th>#</th> <th>ไฟล์</th> </tr> <?php $i = 1; ?> <?php foreach($items as $key => $item): ?> <tr>