Viewing file: m_umuser.php (3.02 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include_once("da_umuser.php"); class M_Umuser extends Da_umuser {
function getAll($aOrderBy=""){ $orderBy = ""; if (is_array($aOrderBy)) { $orderBy.="ORDER BY "; foreach ($aOrderBy as $key => $value) { $orderBy.= "$key $value, "; } $orderBy = substr($orderBy, 0, strlen($orderBy)-2); } $sql = "SELECT * FROM umuser $orderBy"; $query = $this->db->query($sql); return $query ; } //and UsActive=1" function check_user($un, $pwd){ $sql = "select * from umuser where UsLogin =? and UsPassword =? "; $result = $this->db->query($sql, array($un,md5("O]O".$pwd."O[O"))); if($result->num_rows()<>0){ //if($result){ return $result->row_array(); }else{ return false; } }
public function qry() { $sql = "SELECT * FROM UMUSER"; $query = $this->db->query($sql); return $query; }
function test2db(){ $db_rg=$this->load->database('rg',TRUE); $db_ppc=$this->load->database('ppc',TRUE); $sql = "SELECT * FROM $db_rg->database.rg_Person, $db_rg->database.rg_Prefix, $db_ppc->database.Person WHERE $db_rg->database.rg_Person.prsUsId=$db_ppc->database.Person.personId AND $db_ppc->database.Person.prefixId=$db_rg->database.rg_Prefix.pfId" ; $query = $db_rg->query($sql); return $query; }
function checkUserByPsId ($ps_id) { $sql = "select * from umuser where UsPsCode =?"; $result = $this->db->query($sql, array($ps_id)); if ($result->num_rows() <> 0) { return $result->row_array(); } else { return false; } }
function qryUmUserByUsPsCode($usPsCode){ $sql = "select * from umuser where UsPsCode =?"; $query = $this->db->query($sql, array($usPsCode)); return $query; }
/* ค้นหาหน่วยงานของบุคคลภายนอก */ function getPsoutDpt(){ $db_ppc= $this->config->item('ppc_dbname'); $sql = " select outtypeName as deptName from $db_ppc.Personout prs inner join $db_ppc.Outtype dpt on dpt.outtypeId=prs.outtypeId WHERE psoutId = ? "; $result = $this->db->query($sql, array($this->UsPsCode)); return $result; }
/* ค้นหาหน่วยงานของบุคลากร */ function getPrsDpt(){ $db_ppc= $this->config->item('ppc_dbname'); $sql = " select deptName from $db_ppc.Person prs inner join $db_ppc.Department dpt on dpt.deptId=prs.deptId WHERE personId = ? "; $result = $this->db->query($sql, array($this->UsPsCode)); return $result; } /* * Check UsLogin and UsPsCode * @author beeroma * @Create Date 2554-10-28 */ function checkUserAdd($option){ $sql = "SELECT UsID FROM umuser WHERE "; $option_str = ""; foreach($option as $key => $value){ if($option_str != ""){ $option_str .= " AND "; } $option_str .= " {$key} = '{$value}' "; } $sql = $sql.$option_str; $result = $this->db->query($sql); return ($result->num_rows()>0)?1:0; }
} //=== end class Umuser
?>
|