You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
969 B
42 lines
969 B
9 years ago
|
<?php
|
||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||
|
|
||
|
/**
|
||
|
* Regio model
|
||
|
*/
|
||
|
class Login_model extends CI_Model
|
||
|
{
|
||
|
|
||
|
public function __construct()
|
||
|
{
|
||
|
parent::__construct();
|
||
|
}
|
||
|
|
||
|
public function check_user()
|
||
|
{
|
||
|
// Validate POST
|
||
|
$username = $this->security->xss_clean($this->input->post('username'));
|
||
|
$password = $this->security->xss_clean($this->input->post('password'));
|
||
|
$regioid = $this->security->xss_clean($this->input->post('regioid'));
|
||
|
//$username = $this->input->post('username');
|
||
|
//$password = $this->input->post('password');
|
||
|
//$regioid = $this->input->post('regioid');
|
||
|
|
||
|
// Search for user
|
||
|
$this->db->select('id');
|
||
|
$this->db->where('username', $username);
|
||
|
$this->db->where('password', sha1($password));
|
||
|
$this->db->where('regioid', $regioid);
|
||
|
$this->db->from('user');
|
||
|
|
||
|
$query = $this->db->get();
|
||
|
//echo $query->num_rows();
|
||
|
if ($query->num_rows() == 1)
|
||
|
{
|
||
|
return TRUE;
|
||
|
} else {
|
||
|
return FALSE;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|