<commit_before><?php
ob_start();
require 'class/Page.class.php';
$p = new Page("Login");
$p->buildHead();


define('__ROOT__',dirname(__FILE__));
require_once __ROOT__."/class/User.class.php";
require_once __ROOT__."/class/UserTools.class.php";
$errors = array();

// Check we aren't already logged in via cookie
if (isset($_COOKIE["username"]) && isset($_COOKIE["token"])) {
	$user = new User($_COOKIE["username"],$_COOKIE["token"]);
	if ($user->isLoggedIn()) {
		header("Location: membersSearch.php");
	}
}

// Did we submit the form? If we did, check if it's correct and generate a new login token
if (isset($_POST["username"]) && isset($_POST["password"])) {
	$user = new User($_POST["username"]);
	$user->login($_POST["password"]);
	if ($user->isLoggedIn()) {
		header("Location: membersSearch.php");
	} else {
		$errors[] = "Incorrect username or password";
	}
}
?>
<?php UserTools::printErrors($errors); ?>
<div class="row">
    <div class="col-sm-12 col-md-12"><commit_msg>fix login<commit_after><?php
ob_start();
require 'class/Page.class.php';
$p = new Page("Login");


define('__ROOT__',dirname(__FILE__));
require_once __ROOT__."/class/User.class.php";
require_once __ROOT__."/class/UserTools.class.php";
$errors = array();

// Check we aren't already logged in via cookie
if (isset($_COOKIE["username"]) && isset($_COOKIE["token"])) {
	$user = new User($_COOKIE["username"],$_COOKIE["token"]);
	if ($user->isLoggedIn()) {
		header("Location: membersSearch.php");
	}
}

// Did we submit the form? If we did, check if it's correct and generate a new login token
if (isset($_POST["username"]) && isset($_POST["password"])) {
	$user = new User($_POST["username"]);
	$user->login($_POST["password"]);
	if ($user->isLoggedIn()) {
		header("Location: membersSearch.php");
	} else {
		$errors[] = "Incorrect username or password";
	}
}
$p->buildHead();
?>
<?php UserTools::printErrors($errors); ?>
<div class="row">
    <div class="col-sm-12 col-md-12">
{'fraction_non_alphanumeric': 0.212461695607763, 'fraction_numerical': 0.0040858018386108275, 'mean_word_length': 5.755172413793104, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '848802', 'n_tokens_mistral': 677, 'n_tokens_neox': 666, 'n_words': 150}