<commit_before><?php

class registration extends CI_Controller{

	public function __construct(){
		parent::__construct();

		$this->load->model('userdb');

		$this->load->library('session');

		$this->load->helper('url');

	}

	public function index(){

		if(isset($_SESSION['loggedin'])){

			redirect('blogcont/', 'refresh');
		}

		else{

			$this->register();

		}
	}

	public function register(){

		$this->load->helper('form');
		$this->load->library('form_validation');

		$this->form_validation->set_rules('username','Username','trim|required|xss_clean|min_length[4]');
		$this->form_validation->set_rules('password','Password','<PASSWORD>]');
		$this->form_validation->set_rules('name','Name','trim|required');
		$this->form_validation->set_rules('email','Email','trim|required|valid_email');
		$this->form_validation->set_rules('repassword','Confirm Password','<PASSWORD>|required|matches[password]');

		if ($this->form_validation->run() == FALSE)
		{	
			echo "Form not validated.";
			echo validation_errors();

			$this->load->view('templates/header.html');
			$this->load->view('authentication/registrationview.php');
			$this->load->view('templates/footer.html');
		}
		else
		{

			echo 'Form validated.';

			var_dump($_POST);

			// if($this->userdb->checkusername($username))

			// 	echo "We will talk with the model now.";

			// else

			// 	echo "That username has been taken by someone already, please select a different one.";
			
		}
	}

}

?><commit_msg>Ensuring that the username is unique.<commit_after><?php

class registration extends CI_Controller{

	public function __construct(){
		parent::__construct();

		$this->load->model('userdb');

		$this->load->library('session');

		$this->load->helper('url');

	}

	public function index(){

		if(isset($_SESSION['loggedin'])){

			redirect('blogcont/', 'refresh');
		}

		else{

			$this->register();

		}
	}

	public function register(){

		$this->load->helper('form');
		$this->load->library('form_validation');

		$this->form_validation->set_rules('username','Username','trim|required|xss_clean|min_length[4]|is_unique[users_blog.username]');
		$this->form_validation->set_rules('password','Password','trim|required|md5|min_length[4]');
		$this->form_validation->set_rules('name','Name','trim|required');
		$this->form_validation->set_rules('email','Email','trim|required|valid_email');
		$this->form_validation->set_rules('repassword','Confirm Password','trim|required|matches[password]');

		if ($this->form_validation->run() == FALSE)
		{	
			echo "Form not validated.";
			echo validation_errors();

			$this->load->view('templates/header.html');
			$this->load->view('authentication/registrationview.php');
			$this->load->view('templates/footer.html');
		}
		else
		{

			echo 'Form validated.';

			var_dump($_POST);
			
		}
	}

}

?>
{'fraction_non_alphanumeric': 0.20035398230088497, 'fraction_numerical': 0.001415929203539823, 'mean_word_length': 5.116883116883117, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 67, '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': '3092503', 'n_tokens_mistral': 1024, 'n_tokens_neox': 884, 'n_words': 125}