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

class Main extends CI_Controller {

  public function __construct()
  {
      parent::__construct();
      $this->load->model('Lessees');
  }

	public function index()
  {
    // $data['title'] = 'New Title';

    $data['content'] = $this->load->view('pages/main', '', TRUE);

    /* SAMPLE of Additional Styles and Scripts */

    // $data['style'] = array(
    //   'folder/thestyle',
    //   'folder/thestyle2'
    // );
    // $data['script'] = array(
    //   'folder/script1',
    //   'folder/script2'
    // );

    $this->load->view('common/main', $data);
	}

  public function admin()
  {
    $data['content'] = $this->load->view('pages/admin', '', TRUE);
    $this->load->view('common/main', $data);
  }

  public function signUp()
  {
    // field name, error message, validation rules
    $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]|xss_clean');
    $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[32]|xss_clean');
    $this->form_validation->set_rules('password2', '<PASSWORD>ation', 'trim|required|matches[password]|xss_clean');
    $this->form_validation->set_rules('lessee_fname', 'Firstname', 'trim|required|xss_clean');
    $this->form_validation->set_rules('lessee_lname', 'Lastname', 'trim|required|xss_clean');
    $this->form_validation->set_rules('lessee_email', 'Email', 'trim|required|valid_email|xss_clean');
    $this->form_validation->set_rules('lessee_phoneno', 'Phone No', 'trim|required|xss_clean');

    if($this->form_validation->run() == FALSE):

      $this->session->set_flashdata('error', validation_errors());
      redirect('main#signup','refresh');

    else:

      $data = array('username'=>$this->input->post('username'),
                    'password'=>$this->encrypt->encode($this->input->post('password')),
                    'lessee_fname'=>$this->input->post('lessee_fname'),
                    'lessee_lname'=>$this->input->post('lessee_lname'),
                    'lessee_email'=>$this->input->post('lessee_email'),
                    'lessee_phoneno'=>$this->input->post('lessee_phoneno'));

      $this->Lessees->create($data);
      $this->session->set_flashdata('success', TRUE);
      redirect('main#signup','refresh');

    endif;


  }

  public function lesseeLogin()
  {
    $username = $this->input->post('username',TRUE);
    $password = $this->input->post('password',TRUE);
    $user = $this->Lessees->login($username,$password);

    if(!empty( $user ) && $this->encrypt->decode($user['password']) == $password):

      $userdata = array('lessee_id' => $user['lessee_id'],
                       'username' => $user['username'],
                       'lessee_fname' => $user['lessee_fname'],
                       'lessee_lname' => $user['lessee_lname'],
                       'lessee_email' => $user['lessee_email'],
                       'lessee_phoneno' => $user['lessee_phoneno'],
                       'logged_in' => TRUE);

      $this->session->set_userdata($userdata);
      redirect(base_url().'main/lesseeDashboard');

    else:

      $this->session->set_flashdata('error', TRUE);
      $this->load->view('common/main', $data);

    endif;
  }

  public function lesseeDashboard()
  {
    echo 'TODO';
  }


}
<commit_msg>Modified methods<commit_after><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Main extends CI_Controller {

  public function __construct()
  {
      parent::__construct();
      $this->load->model('Lessees');
  }

	public function index()
  {
    // $data['title'] = 'New Title';

    $data['content'] = $this->load->view('pages/main', '', TRUE);

    /* SAMPLE of Additional Styles and Scripts */

    // $data['style'] = array(
    //   'folder/thestyle',
    //   'folder/thestyle2'
    // );
    // $data['script'] = array(
    //   'folder/script1',
    //   'folder/script2'
    // );

    $this->load->view('common/main', $data);
	}

  public function admin()
  {
    $data['content'] = $this->load->view('pages/admin', '', TRUE);
    $this->load->view('common/main', $data);
  }

  public function signUp()
  {
    // field name, error message, validation rules
    $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]|xss_clean');
    $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[32]|xss_clean');
    $this->form_validation->set_rules('password2', '<PASSWORD>', 'trim|required|matches[password]|xss_clean');
    $this->form_validation->set_rules('lessee_fname', 'Firstname', 'trim|required|xss_clean');
    $this->form_validation->set_rules('lessee_lname', 'Lastname', 'trim|required|xss_clean');
    $this->form_validation->set_rules('lessee_email', 'Email', 'trim|required|valid_email|xss_clean');
    $this->form_validation->set_rules('lessee_phoneno', 'Phone No', 'trim|required|xss_clean');

    if($this->form_validation->run() == FALSE):

      $this->session->set_flashdata('error', validation_errors());
      redirect('main#signup','refresh');

    else:

      $data = array('username'=>$this->input->post('username'),
                    'password'=>$<PASSWORD>->encrypt->encode($this->input->post('password')),
                    'lessee_fname'=>$this->input->post('lessee_fname'),
                    'lessee_lname'=>$this->input->post('lessee_lname'),
                    'lessee_email'=>$this->input->post('lessee_email'),
                    'lessee_phoneno'=>$this->input->post('lessee_phoneno'));

      $this->Lessees->create($data);
      $this->session->set_flashdata('success', TRUE);
      redirect('main#signup','refresh');

    endif;


  }

  public function signIn()
  {
    $username = $this->input->post('username',TRUE);
    $password = $this->input->post('password',TRUE);
    $user = $this->Lessees->login($username,$password);

    if(!empty( $user ) && $this->encrypt->decode($user['password']) == $password):

      $userdata = array('lessee_id' => $user['lessee_id'],
                        'username' => $user['username'],
                        'lessee_fname' => $user['lessee_fname'],
                        'lessee_lname' => $user['lessee_lname'],
                        'lessee_email' => $user['lessee_email'],
                        'lessee_phoneno' => $user['lessee_phoneno'],
                        'logged_in' => TRUE);

      $this->session->set_userdata($userdata);
      print_r($this->session->all_userdata());
      //redirect(base_url().'main/lesseeDashboard');

    else:

      $this->session->set_flashdata('error', TRUE);
      redirect('signin-page','refresh');

    endif;
  }

  public function signinPage()
  {
    $data['content'] = $this->load->view('pages/signin', '', TRUE);
    $this->load->view('common/main', $data);
  }

  public function lesseeDashboard()
  {
    echo 'TODO';
  }

  public function logout()
  {
    $this->session->sess_destroy();
    redirect('main', 'refresh');
  }


}

{'fraction_non_alphanumeric': 0.19892625035320713, 'fraction_numerical': 0.0022605255721955355, 'mean_word_length': 3.2440047961630696, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 158, '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': '2113930', 'n_tokens_mistral': 2310, 'n_tokens_neox': 2222, 'n_words': 295}