<commit_before>	<?php 

header("Content-Type: text/html; charset=ISO-8859-1", true);

	include("database.php");

	function validating_posts($post_name,&$erros)
	{
			$key = $post_name."Err";
			
				if($post_name == 'email' || $post_name == 'matricula')
				{
					$user_choice = $_POST[$post_name];
					define_validator($post_name, $user_choice, $erros, $key);
				}	
	}

	function define_validator($post_name, $user_choice , &$erros, $key)
	{
		switch($post_name)
		{

			case 'email': validating_email($user_choice, $erros, $key);
				break;

			case 'matricula': validating_matricula($user_choice, $erros, $key);
				break;
		}
	}


	function check_on_database($db_column_value,$db_column_name)//bool
	{

		 $db = Database::connect();
         $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
		 
		 $query = "select {$db_column_name} from Users where {$db_column_name} = '{$db_column_value}'";
		 $finds = $db->prepare($query);
		 $finds->execute();
		 $rows = $finds->rowCount();

		 if($rows > 0)
		 	return true;
		 
		else
 		return false;

 		Database::disconnect();


	}


	function validating_email($email,&$erros,$key)
	{
		$db_colluns = array("Userid","Curso","Nome","Matricula","Email" ,"Senha", "Nascimento","Genero");

 		if(check_on_database($email, $db_colluns[4]))
 		$erros[$key] = "Email already registered!";

	}

	function validating_matricula($matricula, &$erros, $key)<commit_msg>mudança sutil no check_on_database função do arquivo validating_register_info<commit_after>	<?php 

header("Content-Type: text/html; charset=ISO-8859-1", true);

	include("database.php");

	function validating_posts($post_name,&$erros)
	{
			$key = $post_name."Err";
			
				if($post_name == 'email' || $post_name == 'matricula')
				{
					$user_choice = $_POST[$post_name];
					define_validator($post_name, $user_choice, $erros, $key);
				}	
	}

	function define_validator($post_name, $user_choice , &$erros, $key)
	{
		switch($post_name)
		{

			case 'email': validating_email($user_choice, $erros, $key);
				break;

			case 'matricula': validating_matricula($user_choice, $erros, $key);
				break;
		}
	}


	function check_on_database($db_column_value,$db_column_name)//bool
	{

		 $db = Database::connect();
         $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
		 
		 $query = "select {$db_column_name} from Users where {$db_column_name} = '{$db_column_value}'";
		 $finds = $db->prepare($query);
		 $finds->execute();
		 $rows = $finds->rowCount();

		 if($rows > 0)
		 {
		 	Database::disconnect();
		 	return true;
		 }

		Database::disconnect();
 		return false;
	}


	function validating_email($email,&$erros,$key)
	{
		$db_colluns = array("Userid","Curso","Nome","Matricula","Email" ,"Senha", "Nascimento","Genero");

 		if(check_on_database($email, $db_colluns[4]))
 		$erros[$key] = "Email already registered!";

	}

	function validating_matricula($matricula, &$erros, $key)
{'fraction_non_alphanumeric': 0.1765710382513661, 'fraction_numerical': 0.0047814207650273225, 'mean_word_length': 4.5790476190476195, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4368235', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1057, 'n_words': 170}