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.
 
 
 
 

48 lines
979 B

<?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'));
// Search for user
$this->db->select('id, regioid');
$this->db->where('username', $username);
$this->db->where('password', sha1($password));
$this->db->where('regioid', $regioid);
$this->db->from('user');
$query = $this->db->get();
if ($query->num_rows() == 1)
{
$row = $query->row();
$userdata = array(
'id' => $row->id,
'regio' => $row->regioid,
'validated' => true
);
// Sent user information
return $userdata;
} else {
return FALSE;
}
}
}