<commit_before><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Member extends CI_Model {
	
	protected $expiration;
	
	public function __construct()
	{
		parent::__construct();
		
		$this->load->library('encrypt');
	}
	
	public function Login($username, $password, $remember = FALSE)
	{
		$this->db->select('Username, Password, Picture, Role');
		$this->db->from('member');
		$this->db->join('role', 'member.R_Id = role.Id');
		$this->db->where('member.UserName', $username);
		$this->db->where('member.Password', $password);
		$query = $this->db->get();

		if ($query->num_rows() > 0)
		{
			$member = $query->first_row();
			if(strcmp($password, $member->Password) === 0)
			{
				$this->expiration = $remember ? 60*60*24 : 3600;
				$this->Save($member);
				return TRUE;
			}
		}

		return FALSE;
	}
	
	private function Save($member)
	{
		$this->User->Set(array(
			'Username'  => $member->Username,
			'Email'     => $member->Username,
			'Logged'    => TRUE,
			'Role'      => $member->Role,
			'Picture'   => $member->Picture ? $member->Picture : ''
		), $this->expiration);
	}
}

/* End of file Member.php */
/* Location: ./application/models/Shared/Member.php */<commit_msg>add Create() to Member<commit_after><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Member extends CI_Model {
	
	protected $expiration;
	
	public function __construct()
	{
		parent::__construct();
		
		$this->load->library('encrypt');
	}
	
	public function Create($username, $password, $role)
	{
		$query = $this->db->get_where('role', array('Role' => $role));
		$Id = $query->first_row()->Id;
		
		$member = array(
				'Username' => $username,
				'Password' => <PASSWORD>,
				'R_Id' => $Id
		);
		
		$this->db->insert('member', $member);
	}
	
	public function Login($username, $password, $remember = FALSE)
	{
		$this->db->select('Username, Password, Picture, Role');
		$this->db->from('member');
		$this->db->join('role', 'member.R_Id = role.Id');
		$this->db->where('member.UserName', $username);
		$this->db->where('member.Password', $password);
		$query = $this->db->get();

		if ($query->num_rows() > 0)
		{
			$member = $query->first_row();
			if(strcmp($password, $member->Password) === 0)
			{
				$this->expiration = $remember ? 60*60*24 : 3600;
				$this->Save($member);
				return TRUE;
			}
		}

		return FALSE;
	}
	
	private function Save($member)
	{
		$this->User->Set(array(
			'Username'  => $member->Username,
			'Email'     => $member->Username,
			'Logged'    => TRUE,
			'Role'      => $member->Role,
			'Picture'   => $member->Picture ? $member->Picture : ''
		), $this->expiration);
	}
}

/* End of file Member.php */
/* Location: ./application/models/WebPortal/Member.php */
{'fraction_non_alphanumeric': 0.21094890510948905, 'fraction_numerical': 0.008759124087591242, 'mean_word_length': 3.6144781144781146, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 80, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6632067', 'n_tokens_mistral': 1092, 'n_tokens_neox': 933, 'n_words': 180}