<commit_before><?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');
	//error_reporting(0);
	class Signup extends CI_Controller
	{
		function __construct()
		{
			parent::__construct();
			$this->session->set_userdata(array('redirecturl'=>null));
			$this->authentication->redirect2Dash();
			$this->load->model(array('signup_model','login_model'));
		}

		public function user()
		{
			$data['successmsg'] = '';
			$data['errmsg'] = '';
			$data['step'] = 1;
			//$this->load->view('usersignup_view', $data);
		}

		public function index()
		{
			$data['message'] = 'Something went wrong, please try again.';
			$data['error'] = true;

			$user['email'] = $this->security->xss_clean($this->input->post('email'));
			if(empty($user['email'])){
				$data['message'] = 'Email/Username is required.';
				echo json_encode($data);
				exit;
			}
			if (filter_var($user['email'], FILTER_VALIDATE_EMAIL) === false) {
				$data['message'] = 'Enter valid email.';
				echo json_encode($data);
				exit;
			}
			
			if($this->signup_model->isUserExists($user['email'])){
				$data['message'] = 'User already exists.';
				echo json_encode($data);
				exit;
			}

			$password = $this->security->xss_clean($this->input->post('password'));
			if(!$password){
				$data['message'] = 'Password is required.';
				echo json_encode($data);
				exit;
			}
			$user['password'] = <PASSWORD>($password);
			$user['user_type'] = 'User';
			$user['contact_name']	= 'Anonymous';
			
			$result = $this->signup_model->addSystemUser($user);
			if($result){
				$this->login_model->forceUserLogin($user['email']);
				$data['message'] = 'User signup successfully.';
				$data['error'] = false;
				echo json_encode($data);
				exit;
			}else{
				echo json_encode($data);
				exit;
			}
		}
		
		public function details(){
			$data['message'] = 'Something went wrong, please try again.';
			$data['error'] = true;
			
			$emailid = $this->security->xss_clean($this->input->post('email'));
			if(empty($emailid)){
				$data['message'] = 'Email/Username is required.';
				echo json_encode($data);
				exit;
			}
			if (filter_var($emailid, FILTER_VALIDATE_EMAIL) === false) {
				$data['message'] = 'Enter valid email.';
				echo json_encode($data);
				exit;
			}
			
			$contact_name = $this->security->xss_clean($this->input->post('contact_name'));
			$user['contact_name']	= $contact_name?$contact_name:'Anonymous';
			$user['age']	= $this->security->xss_clean($this->input->post('age'));
			$user['gender']	= $this->security->xss_clean($this->input->post('gender'));
			$user['user_type']	= 'User';
			$result = $this->signup_model->updateSystemUserByMail($emailid, $user);
			if($result){
				$data['message'] = 'Details saved successfully.';
				$data['error'] = false;
				echo json_encode($data); exit;
			}else{
				echo json_encode($data); exit;
			}
		}
	}
	?><commit_msg>sign up API's<commit_after><?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');
	//error_reporting(0);
	class Signup extends CI_Controller
	{
		function __construct()
		{
			parent::__construct();
			//$this->session->set_userdata(array('redirecturl'=>null));
			//$this->authentication->redirect2Dash();
			$this->load->model(array('signup_model','login_model'));
		}

		public function user()
		{
			$data['successmsg'] = '';
			$data['errmsg'] = '';
			$data['step'] = 1;
			//$this->load->view('usersignup_view', $data);
		}

		public function index()
		{
			$data['message'] = 'Something went wrong, please try again.';
			$data['error'] = true;

			$user['email'] = $this->security->xss_clean($this->input->post('email'));
			if(empty($user['email'])){
				$data['message'] = 'Email/Username is required.';
				echo json_encode($data);
				exit;
			}
			if (filter_var($user['email'], FILTER_VALIDATE_EMAIL) === false) {
				$data['message'] = 'Enter valid email.';
				echo json_encode($data);
				exit;
			}
			
			if($this->signup_model->isUserExists($user['email'])){
				$data['message'] = 'User already exists.';
				echo json_encode($data);
				exit;
			}

			$password = $this->security->xss_clean($this->input->post('password'));
			if(!$password){
				$data['message'] = 'Password is required.';
				echo json_encode($data);
				exit;
			}
			$user['password'] = <PASSWORD>($password);
			$user['user_type'] = 'User';
			$user['contact_name']	= 'Anonymous';
			
			$result = $this->signup_model->addSystemUser($user);
			if($result){
				$this->login_model->forceUserLogin($user['email']);
				$data['message'] = 'User signup successfully.';
				$data['error'] = false;
				echo json_encode($data);
				exit;
			}else{
				echo json_encode($data);
				exit;
			}
		}
		
		public function details(){
			$data['message'] = 'Something went wrong, please try again.';
			$data['error'] = true;
			
			$emailid = $this->security->xss_clean($this->input->post('email'));
			if(empty($emailid)){
				$data['message'] = 'Email/Username is required.';
				echo json_encode($data);
				exit;
			}
			if (filter_var($emailid, FILTER_VALIDATE_EMAIL) === false) {
				$data['message'] = 'Enter valid email.';
				echo json_encode($data);
				exit;
			}
			
			$contact_name = $this->security->xss_clean($this->input->post('contact_name'));
			$user['contact_name']	= $contact_name?$contact_name:'Anonymous';
			$user['age']	= $this->security->xss_clean($this->input->post('age'));
			$user['gender']	= $this->security->xss_clean($this->input->post('gender'));
			$user['user_type']	= 'User';
			$result = $this->signup_model->updateSystemUserByMail($emailid, $user);
			if($result){
				$data['message'] = 'Details saved successfully.';
				$data['error'] = false;
				echo json_encode($data); exit;
			}else{
				echo json_encode($data); exit;
			}
		}
	}
	?>
{'fraction_non_alphanumeric': 0.2090562109646079, 'fraction_numerical': 0.001040943789035392, 'mean_word_length': 4.052585451358458, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 89, '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': '7234881', 'n_tokens_mistral': 2359, 'n_tokens_neox': 1939, 'n_words': 326}