<commit_before><?php session_start();

	$user = $_POST["username"];
	$pass = <PASSWORD>($_POST["password"]);

	function login($user,$pass)
	{
		$servername = "localhost";
		$username = "root";
		$password = "";
		$dbname = "proiect";

		// Create connection
		$conn = new mysqli($servername, $username, $password, $dbname);

		// Check connection
		if ($conn->connect_error) {
			die("Connection failed: " . $conn->connect_error);
		} 
		
		$sql = "SELECT * FROM date_user WHERE username='$user' AND password='$pass'";
		$result = $conn->query($sql);
		
		if ($result->num_rows > 0) {
			$sql = "UPDATE loggedcounter SET counter = counter + 1";
			$result = $conn->query($sql);
			$sql = "INSERT INTO loggedusers(username) VALUES ('$user')";
			$result = $conn->query($sql);
			return 1;
		}
		return 0;
		
	}
	
	
	
	$_SESSION["username"] = $user;
	if(login($user,$pass))
		{
			if(isset($_POST["remember"]))
			{
			$cookie_username = "username";
			$cookie_username_value = $user;
			$cookie_pass = "password";
			$cookie_pass_value = $pass;
			setcookie($cookie_username, $cookie_username_value, time() + (86400), "/"); // 86400 = 1 day
			setcookie($cookie_pass, $cookie_pass_value, time() + (86400), "/"); // 86400 = 1 day
			}
			
			//header("Location: ../php/chat.php");
			header("Location:home.php");


		}
	else
	{
		
		echo "<script>alert('Parola este gresita');window.location.href='/index.php';</script>";
		/*header("Location: /index.php");*/

	}
	
?>
<commit_msg>changed the cookies time<commit_after><?php session_start();

	$user = $_POST["username"];
	$pass = <PASSWORD>($_POST["password"]);

	function login($user,$pass)
	{
		$servername = "localhost";
		$username = "root";
		$password = "";
		$dbname = "proiect";

		// Create connection
		$conn = new mysqli($servername, $username, $password, $dbname);

		// Check connection
		if ($conn->connect_error) {
			die("Connection failed: " . $conn->connect_error);
		} 
		
		$sql = "SELECT * FROM date_user WHERE username='$user' AND password='$pass'";
		$result = $conn->query($sql);
		
		if ($result->num_rows > 0) {
			$sql = "UPDATE loggedcounter SET counter = counter + 1";
			$result = $conn->query($sql);
			$sql = "INSERT INTO loggedusers(username) VALUES ('$user')";
			$result = $conn->query($sql);
			return 1;
		}
		return 0;
		
	}
	
	
	
	$_SESSION["username"] = $user;
	if(login($user,$pass))
		{
			if(isset($_POST["remember"]))
			{
			$cookie_username = "username";
			$cookie_username_value = $user;
			$cookie_pass = "password";
			$cookie_pass_value = $pass;
			setcookie($cookie_username, $cookie_username_value, time() + (43200), "/"); // 86400 = 1 day
			setcookie($cookie_pass, $cookie_pass_value, time() + (43200), "/"); // 86400 = 1 day
			}
			
			//header("Location: ../php/chat.php");
			header("Location:home.php");


		}
	else
	{
		
		echo "<script>alert('Parola este gresita');window.location.href='/index.php';</script>";
		/*header("Location: /index.php");*/

	}
	
?>

{'fraction_non_alphanumeric': 0.19321486268174476, 'fraction_numerical': 0.01680129240710824, 'mean_word_length': 3.117021276595745, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, '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': '2793436', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1032, 'n_words': 203}