<commit_before><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="" />
<meta name="keywords" content="tree, trees, environment, green" />
<title>Tree wars</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<h1></h1>
<div id="wrapper">
<div id="menu">
<a class="item" href="index.php">Home</a>

<div id="userbar">

<?php

include 'connect.php';

session_start();

if(empty($_SESSION['signed_in']))
{
	{
		if($_SERVER['REQUEST_METHOD'] != 'POST')
		{
			echo '<form method="post" action="">
			Username: <input type="text" name="user_name" />
			Password: <input type="password" name="<PASSWORD>_pass">
			<input type="submit" value="Sign in" />
		</form> or <a href="signup.php">sign up</a>';
		}
		else
		{
			$errors = array(); /* declare the array for later use */
			
			if(!isset($_POST['user_name']))
			{
				$errors[] = 'The username field must not be empty.';
			}
			
			if(!isset($_POST['user_pass']))
			{
				$errors[] = 'The password field must not be empty.';
			}
			
			if(!empty($errors)) /*check for an empty array, if there are errors, they're in this array (note the ! operator)*/
			{
				echo 'Uh-oh.. a couple of fields are not filled in correctly..';
				echo '<ul>';
				foreach($errors as $key => $value) /* walk through the array so all the errors get displayed */
				{
					echo '<li>' . $value . '</li>'; /* this generates a nice error list */
				}
				echo '</ul>';	
			}
			else
			{
				$sql = $connection->prepare("
					SELECT
						user_id,
						user_name,
						is_admin
					FROM
						users
					WHERE
						user_name = :user_name
					AND
						user_pass = :<PASSWORD>");
				
				$sql->bindParam(':user_name', $_POST['user_name']);
				$sql->bindParam(':user_pass', <PASSWORD>1($_POST['user_pass']));
				
				$sql->execute();
				
				if(!$sql->execute())
				{
					echo 'Something went wrong while signing in. Please try again later! :(';
				}
				else
				{
					
						$_SESSION['signed_in'] = true;
						
						while($row = $sql->fetch(PDO::FETCH_ASSOC))
						{
							$_SESSION['user_id']	= $row['user_id'];
							$_SESSION['user_name']	= $row['user_name'];
							$_SESSION['is_admin']	= $row['is_admin'];
						}
						
						echo 'Welcome, ' . $_SESSION['user_name'] . '. <a href="index.php">Proceed to the forum overview</a>?.';
				}
			}
		}
	}
}
else
{
	
	echo 'Hello ' . $_SESSION['user_name'] . '. Not you? <a href="signout.php">Sign out</a>.';<commit_msg>Non existent username fix<commit_after><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="" />
<meta name="keywords" content="tree, trees, environment, green" />
<title>Tree wars</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<h1></h1>
<div id="wrapper">
<div id="menu">
<a class="item" href="index.php">Home</a>

<div id="userbar">

<?php

include 'connect.php';

session_start();

if(empty($_SESSION['signed_in']))
{
	{
		if($_SERVER['REQUEST_METHOD'] != 'POST')
		{
			echo '<form method="post" action="">
			Username: <input type="text" name="user_name" />
			Password: <input type="password" name="user_pass">
			<input type="submit" value="Sign in" />
		</form> or <a href="signup.php">sign up</a>';
		}
		else
		{
			$errors = array(); /* declare the array for later use */
			
			if(!isset($_POST['user_name']))
			{
				$errors[] = 'The username field must not be empty.';
			}
			
			if(!isset($_POST['user_pass']))
			{
				$errors[] = 'The password field must not be empty.';
			}
			
			if(!empty($errors)) /*check for an empty array, if there are errors, they're in this array (note the ! operator)*/
			{
				echo 'Uh-oh.. a couple of fields are not filled in correctly..';
				echo '<ul>';
				foreach($errors as $key => $value) /* walk through the array so all the errors get displayed */
				{
					echo '<li>' . $value . '</li>'; /* this generates a nice error list */
				}
				echo '</ul>';	
			}
			else
			{
				$sql = $connection->prepare("
					SELECT
						user_id,
						user_name,
						is_admin
					FROM
						users
					WHERE
						user_name = :user_name
					AND
						user_pass = :user_pass");
				
				$sql->bindParam(':user_name', $_POST['user_name']);
				$sql->bindParam(':user_pass', <PASSWORD>1($_POST['user_pass']));
				
				$sql->execute();
				
				if(!$sql->execute())
				{
					echo 'Something went wrong while signing in. Please try again later! :(';
				}
				else
				{
					if($sql->rowCount() == 0)
					{
						echo 'Wrong username and/or password! :(';
					}
					else
					{
						$_SESSION['signed_in'] = true;
						
						while($row = $sql->fetch(PDO::FETCH_ASSOC))
						{
							$_SESSION['user_id']	= $row['user_id'];
							$_SESSION['user_name']	= $row['user_name'];
							$_SESSION['is_admin']	= $row['is_admin'];
						}
						
					echo 'Welcome, ' . $_SESSION['user_name'] . '. <a href="index.php">Proceed to the forum overview</a>?.';
					}
				}
			}
		}
	}
}
else
{
	
	echo 'Hello ' . $_SESSION['user_name'] . '. Not you? <a href="signout.php">Sign out</a>.';
{'fraction_non_alphanumeric': 0.19672131147540983, 'fraction_numerical': 0.005646630236794172, 'mean_word_length': 2.9475197699496767, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 88, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, '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': '3977258', 'n_tokens_mistral': 2418, 'n_tokens_neox': 1886, 'n_words': 442}