<commit_before><?php
/**
 * Legacy User Lib
 *
 * @file
 */
require_once __DIR__."/../db.php";
require_once __DIR__."/internal/core.php";
require_once __DIR__."/../legacy-config.php";

function legacy_GetUserFromCookie() {
	if (isset($_COOKIE['lusha'])) {
		$part = explode(".",$_COOKIE['lusha'],2);
		
		if (count($part) !== 2)
			return 0;
		
		$id = intval($part[0]);
		
		$user = legacy_GetUser($id);
		var_dump($user);
		
		if ( isset($user['hash']) && ($user['hash'] == $hash) ) {
			return $id;
		}
	}
	return 0;	
}


function legacy_GetUser($id) {
	return db_DoFetchSingle(
		"SELECT id,".MYSQL_ISO_FORMAT('timestamp').",hash
		FROM ".CMW_TABLE_LEGACY_USER." WHERE id=? LIMIT 1;",
		$id
	);
}<commit_msg>ah yes, forgot the hash<commit_after><?php
/**
 * Legacy User Lib
 *
 * @file
 */
require_once __DIR__."/../db.php";
require_once __DIR__."/internal/core.php";
require_once __DIR__."/../legacy-config.php";

function legacy_GetUserFromCookie() {
	if (isset($_COOKIE['lusha'])) {
		$part = explode(".",$_COOKIE['lusha'],2);
		
		if (count($part) !== 2)
			return 0;
		
		$id = intval($part[0]);
		$hash = $part[1];
		
		$user = legacy_GetUser($id);
		var_dump($id,$hash,$user);
		
		if ( isset($user['hash']) && ($user['hash'] == $hash) ) {
			return $id;
		}
	}
	return 0;	
}


function legacy_GetUser($id) {
	return db_DoFetchSingle(
		"SELECT id,".MYSQL_ISO_FORMAT('timestamp').",hash
		FROM ".CMW_TABLE_LEGACY_USER." WHERE id=? LIMIT 1;",
		$id
	);
}
{'fraction_non_alphanumeric': 0.2151639344262295, 'fraction_numerical': 0.008879781420765027, 'mean_word_length': 3.9161073825503356, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6095683', 'n_tokens_mistral': 637, 'n_tokens_neox': 576, 'n_words': 102}