Rev | Line | |
---|
[324] | 1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
---|
| 2 |
|
---|
| 3 |
|
---|
[340] | 4 | class Admin_model extends MY_Model
|
---|
[324] | 5 | {
|
---|
[340] | 6 | protected $table_name = 'tbladmin';
|
---|
[350] | 7 | protected $id_name = 'admin_id';
|
---|
| 8 |
|
---|
[324] | 9 | function __construct()
|
---|
| 10 | {
|
---|
| 11 | parent::__construct();
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | function check_login($login_name, $password)
|
---|
| 15 | {
|
---|
| 16 | $hash_password = md5($password);
|
---|
| 17 | $query = "SELECT * FROM tbladmin WHERE login_name = ? AND passwd = ?";
|
---|
[360] | 18 | $result = $this->db->query($query, array($login_name, $hash_password));
|
---|
[324] | 19 | if($result->num_rows() == 1){
|
---|
| 20 | return $result->row(0);
|
---|
| 21 | }else
|
---|
| 22 | {
|
---|
| 23 | return null;
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
[369] | 26 |
|
---|
| 27 | function check_data($login_name)
|
---|
| 28 | {
|
---|
| 29 | $this->db->where('login_name', $login_name);
|
---|
| 30 | $query = $this->db->get($this->table_name);
|
---|
| 31 | return $query->num_rows();
|
---|
| 32 | }
|
---|
[324] | 33 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.