Файл: Main Website Files/application/models/Login_model.php
Строк: 24
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Login_model extends CI_Model {
public function __construct()
{
parent::__construct();
}
///////////////////////////////////////
/////// BEGIN LOGIN /////////
///////////////////////////////////////
function login($email,$password) {
$this->db->where("email",$email);
$this->db->where("password",$password);
$query=$this->db->get("users");
if($query->num_rows()>0)
{
foreach($query->result() as $rows)
{
//add all data to session
$newdata = array(
'user_id' => $rows->id,
'user_email' => $rows->email,
'user_name' => $rows->username,
'logged_in' => TRUE,
);
}
$this->session->set_userdata($newdata);
return true;
}
return false;
}
//////////////////////////////////////
}#End Login model