<commit_before><?php
header('Content-type: text/plain');

$DB_FILE = 'ipupdate.sqlite';

$db = new SQLite3($DB_FILE);
$results = $db->query('SELECT max(id) as id, ip, timestamp FROM log;');
$row = $results->fetchArray();

echo $row['ip'] . "\n";

$date = new DateTime();
#$date->setTimeZone(new DateTimeZone('Europe/Lisbon'));
$date->setTimestamp($row['timestamp']);
echo $date->format('Y-m-d H:i:s') . "\n";

?><commit_msg>Add support for IPv4 and IPv6 in getip.php<commit_after><?php
header('Content-type: text/plain');

require('../config.php');

function print_table_last_ip($table) {
	global $DB_FILE;

	$db = new SQLite3($DB_FILE);
	$results = $db->query('SELECT max(id) as id, ip, timestamp FROM '.$table.';');
	$row = $results->fetchArray();

	$date = new DateTime();
	$date->setTimeZone(new DateTimeZone('Europe/Lisbon'));
	$date->setTimestamp($row['timestamp']);
	$date_string = $date->format('Y-m-d H:i:s');

	echo $date_string . ' - ' . $row['ip'] . "\n";

}

print_table_last_ip('log_ipv4');
print_table_last_ip('log_ipv6');

?>
{'fraction_non_alphanumeric': 0.2276657060518732, 'fraction_numerical': 0.005763688760806916, 'mean_word_length': 5.67948717948718, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '1288422', 'n_tokens_mistral': 397, 'n_tokens_neox': 395, 'n_words': 76}