<commit_before><?php require_once("config.php"); ?>
<?php include_once("login.php"); ?>

<!DOCTYPE html>
<html>
    <head>
        <title>Movienet Users</title>

        <?php include_once("bootstrap.php"); ?>  
  
    </head>
    <body>

        <?php include_once("header.php"); ?>

	<div class='container'>
<?php

    //connect to the db
    $db = new mysqli($mnconfig["host"], $mnconfig["user"], $mnconfig["password"], $mnconfig["db"]);
    if ($db->connect_errno) {
        echo "Failed to connect to db: $db->connect_errno $db->connect_error";
        exit(1);
    }

    if (isset($_GET["u"])) {

	$friender = false;
	$friended = false;

	if (isset($_COOKIE["uid"]) && $_COOKIE["uid"] != $_GET["u"]) {
		

		if (isset($_GET["friend"]) && $_GET["friend"]) {
			$datetime = date('Y-m-d H:i:s');
			$statement = "insert ignore into friends (uidFriender, uidFriended, requestTime) values (" . $_COOKIE["uid"] . ", " . $_GET["u"]
. ", '" . $datetime . "');";
			$response = $db->query($statement);
		}

		if (isset($_GET["unfriend"]) && $_GET["unfriend"]) {
			$statement = "delete from friends where (uidFriender=" . $_COOKIE["uid"] . " and uidFriended=" . $_GET["u"] . ") or
(uidFriender=" . $_GET["u"] . " and uidFriended=" . $_COOKIE["uid"] . ");";
			$response = $db->query($statement);
		}

		$statement = "select * from friends where (uidFriender=" . $_GET["u"] . " and uidFriended=" . $_COOKIE["uid"] . ") or (uidFriender=" .
$_COOKIE["uid"] . " and uidFriended=" . $_GET["u"] . ");";
		$response = $db->query($statement);

		if ($response && $response->num_rows > 0) {
			$response->data_seek(0);
			while($row = $response->fetch_assoc()) {
				if ($row["uidFriender"] == $_COOKIE["uid"]) {
					$friender = true;
				}
				if ($row["uidFriended"] == $_COOKIE["uid"]) {
					$friended = true;
				}
			}
		}

	}

	$statement = "select * from users where uid=" . $_GET["u"] . ";";
	$response = $db->query($statement);
	if ($response && $response->num_rows > 0) {
		$response->data_seek(0);
		$row = $response->fetch_assoc();
		?>

		<h2><?php echo $row["name"]; <commit_msg>add a link to the general user search page<commit_after><?php require_once("config.php"); ?>
<?php include_once("login.php"); ?>

<!DOCTYPE html>
<html>
    <head>
        <title>Movienet Users</title>

        <?php include_once("bootstrap.php"); ?>  
  
    </head>
    <body>

        <?php include_once("header.php"); ?>

	<div class='container'>
<?php

    //connect to the db
    $db = new mysqli($mnconfig["host"], $mnconfig["user"], $mnconfig["password"], $mnconfig["db"]);
    if ($db->connect_errno) {
        echo "Failed to connect to db: $db->connect_errno $db->connect_error";
        exit(1);
    }

    if (isset($_GET["u"])) {

	$friender = false;
	$friended = false;

	if (isset($_COOKIE["uid"]) && $_COOKIE["uid"] != $_GET["u"]) {
		

		if (isset($_GET["friend"]) && $_GET["friend"]) {
			$datetime = date('Y-m-d H:i:s');
			$statement = "insert ignore into friends (uidFriender, uidFriended, requestTime) values (" . $_COOKIE["uid"] . ", " . $_GET["u"]
. ", '" . $datetime . "');";
			$response = $db->query($statement);
		}

		if (isset($_GET["unfriend"]) && $_GET["unfriend"]) {
			$statement = "delete from friends where (uidFriender=" . $_COOKIE["uid"] . " and uidFriended=" . $_GET["u"] . ") or
(uidFriender=" . $_GET["u"] . " and uidFriended=" . $_COOKIE["uid"] . ");";
			$response = $db->query($statement);
		}

		$statement = "select * from friends where (uidFriender=" . $_GET["u"] . " and uidFriended=" . $_COOKIE["uid"] . ") or (uidFriender=" .
$_COOKIE["uid"] . " and uidFriended=" . $_GET["u"] . ");";
		$response = $db->query($statement);

		if ($response && $response->num_rows > 0) {
			$response->data_seek(0);
			while($row = $response->fetch_assoc()) {
				if ($row["uidFriender"] == $_COOKIE["uid"]) {
					$friender = true;
				}
				if ($row["uidFriended"] == $_COOKIE["uid"]) {
					$friended = true;
				}
			}
		}

	}

	$statement = "select * from users where uid=" . $_GET["u"] . ";";
	$response = $db->query($statement);
	if ($response && $response->num_rows > 0) {
		$response->data_seek(0);
		$row = $response->fetch_assoc();
		?>
		<div class='text-center'>
			<strong><a href='user.php'>Search for other friends on Movienet</a></strong>
		</div>
		<h2><?php echo $row["name"]; 
{'fraction_non_alphanumeric': 0.2371898910271273, 'fraction_numerical': 0.0027822861117551586, 'mean_word_length': 3.550632911392405, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 67, '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': '1474401', 'n_tokens_mistral': 1663, 'n_tokens_neox': 1529, 'n_words': 308}