コード例 #1
0
ファイル: Stocks_object.php プロジェクト: nmadipati/secure
 function newData($params)
 {
     $CI = $this->CI;
     extract($params);
     $newId = dbId();
     if (strlen($post['name1']) < 5) {
         return false;
     }
     $data = array('obj_code' => $post['code'], 'obj_name0' => $post['name1'], 'obj_name' => $post['name2'], 'obj_detail' => $post['note'], 'obj_entity' => $post['entity'], 'obj_category' => (int) $post['category'], 'obj_group' => (int) $post['group'], 'obj_id' => $newId);
     $where = "obj_id={$post['id']}";
     $str = $CI->db->insert_string($CI->objProduct->table, $data, $where);
     dbQuery($str, 1);
     $responce['result'] = 'id:' . $newID . ' created ';
     return $responce;
 }
コード例 #2
0
ファイル: Forex_model.php プロジェクト: nmadipati/secure
 function accountActivation($id, $raw0)
 {
     $sql = "select reg_id id from {$this->tableRegis} where reg_id like '{$id}'";
     $row = $this->db->query($sql)->row_array();
     $idActive = sprintf("%s%05s", dbId('activation', 200005), $row['id']);
     $ar = array('date' => date("Y-m-d H:i:s"), 'id' => $id, 'raw' => $raw0);
     $raw = json_encode($ar);
     $dt = array('id' => $idActive, 'code' => base64_encode($raw), 'userid' => $id, 'expired' => date("Y-m-d H:i:s", strtotime("+4 hours")), 'created' => date("Y-m-d H:i:s", strtotime("now")));
     $sql = $this->db->insert_string($this->tableActivation, $dt);
     dbQuery($sql, 1);
     $data = array('reg_status' => 2);
     $where = "reg_id={$id}";
     $sql = $this->db->update_string($this->tableRegis, $data, $where);
     dbQuery($sql, 1);
     return $idActive;
 }
コード例 #3
0
ファイル: db_helper.php プロジェクト: nmadipati/si-ksc
 function dbIdReport($idTable = '', $types = 'temp', $detail = 'hello', $start = 4000, $counter = 1)
 {
     $CI =& get_instance();
     $id = dbId('report', 100, 1);
     $id2 = dbId($idTable, $start, $counter);
     $name = 'z_logtable';
     if (!$CI->db->table_exists($name)) {
         $fields = array('id' => array('type' => 'BIGINT', 'auto_increment' => TRUE), 'tablename' => array('type' => 'VARCHAR', 'constraint' => '100'), 'detail' => array('type' => 'text'), 'date' => array('type' => 'timestamp'));
         $CI->dbforge->add_field($fields);
         $CI->dbforge->add_key('id', TRUE);
         $CI->dbforge->create_table($name, TRUE);
         $str = $CI->db->last_query();
         logConfig("create table:{$str}", 'logDB');
         $CI->db->reset_query();
     }
     $name = "z_log" . date("Ymd");
     if (!$CI->db->table_exists($name)) {
         $detail = 'create $name';
         $data = array('id' => $id, 'tablename' => trim($name), 'detail' => $detail);
         $sql = $CI->db->insert_string('z_logtable', $data);
         dbQuery($sql, 1);
         $fields = array('id' => array('type' => 'BIGINT', 'auto_increment' => TRUE), 'ref_id' => array('type' => 'BIGINT'), 'table_id' => array('type' => 'VARCHAR', 'constraint' => '100'), 'types' => array('type' => 'VARCHAR', 'constraint' => '160'), 'detail' => array('type' => 'text'), 'date' => array('type' => 'timestamp'));
         $CI->dbforge->add_field($fields);
         $CI->dbforge->add_key('id', TRUE);
         $CI->dbforge->create_table($name, TRUE);
         $str = $CI->db->last_query();
         logConfig("create table:{$str}", 'logDB');
     } else {
     }
     $CI->db->reset_query();
     $id = dbId('report', 100, 2);
     $data = array('id' => $id, 'ref_id' => $id2, 'table_id' => trim($idTable), 'types' => trim($types), 'detail' => $detail);
     $sql = $CI->db->insert_string($name, $data);
     dbQuery($sql, 1);
     return $id2;
 }