<commit_before>/*
*	Members online today v3.1
*	By www.swordbeta.com, https://github.com/michaeltricht/Zathyus-MOT
*/
<?php
	// Include necessities.
	include('config/database.php');
	include('lib/MysqliDb.php');

	// Disable error reporting.
	if (!$config['debug']) {
		error_reporting(0);
	}

	// Setup MySQL connection.
	$mysqli = new Mysqlidb($config['database']['host'], $config['database']['username'], $config['database']['password'], $config['datbase']['database']);

	// UNIX time minus 24 hours.
	$limitTime = time() - (60 * 60 * 24);

	// Delete any users that have not been only the past 24 hours.
	$mysqli->where('date < ' . $timestamp);
	$mysqli->delete('users');

	// Lets get started.
	if (isset($_GET['url'])) {

		$url = $_GET['URL'];
		// Strip overhead from the URL.
		if (preg_match("/\?s=/", $url)) {
			$url = explode("?s=", $url);
			$url = $_GET['url'][0]."?act=idx";
		}

		// Setup variables.
		$url = $mysqli->escape(strip_tags(trim(urldecode($url))));
		$user = $mysqli->escape(strip_tags(trim($_GET['user'])));
		$id = $mysqli->escape($_GET['id']);
		$type = $mysqli->escape($_GET['type']);

		if ($user == $_GET['user'] && isset($_GET['id'])) {
			// We're logged into the board.
			if($id && $user){

				$mysqli->where('user', $user);
				$mysqli->where('user_id', $id);
				$mysqli->where('url', $url);
				$currentUser = $mysqli->getOne('users');

				$data = array(
					'user_id' => $id,
					'user' => $user,
					'url' => $url,
					'date' => time()
				);
				// Is the current visitor in the database?
				if($mysqli->count == 0){
					$mysqli->insert('users', $data);
				} else {
					$mysqli->where('id', $currentUser['id']);
					$mysqli->update('users', $data);
				}
			}
		}

		// Get the users for this particular board.
		$mysqli->where('url ', $url);
		$qu = $mysqli->get('users');
		$count = $mysqli->count;

		// Lets start with outputting some javascript.
		// TODO: Put javascript in separate files.
		// TODO: Not have the entire <td> row in a single line.
		?>
if (!img) {
var img = "http://209.85.62.23/style_images/1/user.gif";
}
if (typeof(mot_breakline) == 'undefined') {
	var breakline = "<br />";
} else if(mot_breakline == 0) {
	var breakline = "<br />";
} else {
	var breakline = "";
}
if (typeof(mot_boldnumber) == 'undefined') {
	var open_b = "";
	var close_b = "";
} else if (mot_boldnumber == 0) {
	var open_b = "";
	var close_b = "";
} else {
	var open_b = "<b>";
	var close_b = "</b>";
}
		<?
		// Zetaboard.<commit_msg>Bug fixes brought by the rewrite.<commit_after>/*
*	Members online today v3.1
*	By www.swordbeta.com, https://github.com/michaeltricht/Zathyus-MOT
*/
<?php
	// Include necessities.
	include('config.php');
	include('lib/MysqliDb.php');

	// Disable error reporting.
	if (!$config['debug']) {
		error_reporting(0);
	}

	// Setup MySQL connection.
	$mysqli = new Mysqlidb($config['database']['host'], $config['database']['username'], $config['database']['password'], $config['database']['database']);

	// UNIX time minus 24 hours.
	$limitTime = time() - (60 * 60 * 24);

	// Delete any users that have not been only the past 24 hours.
	$mysqli->where('date', $limitTime, '<');
	$mysqli->delete('users');

	// Are we not visiting the page directly?
	if (isset($_GET['url'])) {

		$url = $_GET['url'];
		// Strip overhead from the URL.
		if (preg_match("/\?s=/", $url)) {
			$url = explode("?s=", $url);
			$url = $url[0] . "?act=idx";
		}

		// Setup variables.
		$url = $mysqli->escape(strip_tags(trim(urldecode($url))));
		$user = $mysqli->escape(strip_tags(trim($_GET['user'])));

		// We're not a guest but a real user.
		if ($user == $_GET['user'] && isset($_GET['id'])) {

			// Setup variables.
			$id = $mysqli->escape($_GET['id']);
			$type = $mysqli->escape($_GET['type']);

			// Are we in the database?
			$mysqli->where('user', $user);
			$mysqli->where('user_id', $id);
			$mysqli->where('url', $url);
			$currentUser = $mysqli->getOne('users');

			// Setup array.
			$data = array(
				'user_id' => $id,
				'user' => $user,
				'url' => $url,
				'date' => time()
			);

			// Is the current visitor in the database?
			if($mysqli->count == 0){
				$mysqli->insert('users', $data);
			} else {
				$mysqli->where('id', $currentUser['id']);
				$mysqli->update('users', $data);
			}
		}

		// Get the users for this particular board.
		$mysqli->where('url ', $url);
		$qu = $mysqli->get('users');
		$count = $mysqli->count;

		// Lets start with outputting some javascript.
		// TODO: Delegate this to a function.
		// TODO: Put javascript in separate files.
		// TODO: Not have the entire <td> row in a single line.
		?>
if (!img) {
var img = "http://192.168.3.11/style_images/1/user.gif";
}
if (typeof(mot_breakline) == 'undefined') {
	var breakline = "<br />";
} else if(mot_breakline == 0) {
	var breakline = "<br />";
} else {
	var breakline = "";
}
if (typeof(mot_boldnumber) == 'undefined') {
	var open_b = "";
	var close_b = "";
} else if (mot_boldnumber == 0) {
	var open_b = "";
	var close_b = "";
} else {
	var open_b = "<b>";
	var close_b = "</b>";
}
		<?
		// Zetaboard.
{'fraction_non_alphanumeric': 0.2225717656311443, 'fraction_numerical': 0.01061738104600865, 'mean_word_length': 3.3929188255613125, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 57, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, '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': '7261950', 'n_tokens_mistral': 2126, 'n_tokens_neox': 1874, 'n_words': 439}