Viewing file: m_umuser.php (1.73 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("da_umuser.php");
class M_umuser extends Da_umuser {
/* * aOrderBy = array('fieldname' => 'ASC|DESC', ... ) */ function get_all($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; } /* * create array of pk field and value for generate select list in view, must edit PK_FIELD and FIELD_NAME manually * the first line of select list is '-----เลือก-----' by default. * if you do not need the first list of select list is '-----เลือก-----', please pass $optional parameter to other values. * you can delete this function if it not necessary. */ function get_options($optional='y') { $qry = $this->get_all(); if ($optional=='y') $opt[''] = '-----เลือก-----'; foreach ($qry->result() as $row) { $opt[$row->PK_FIELD] = $row->FIELD_NAME; } return $opt; } // add your functions here
function check_user() { $sql = "SELECT * FROM ".$this->ums_db.".umuser WHERE UsLogin = ? AND UsPassword = ? "; $query = $this->db->query($sql,array($this->UsLogin,md5('12345678'.$this->UsPassword.'12345678'))); return $query; } function check_user2($un, $pwd, $secretcode){ $sql = "SELECT * from ".$this->ums_db.".umuser WHERE UsLogin =? and UsPassword =? "; $result = $this->db->query($sql, array($un,md5($secretcode.$pwd.$secretcode))); if($result->num_rows()<>0){ //if($result){ return $result->row_array(); }else{ return false; } }
} // end class M_umuser ?>
|