Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
<?php
if (session_status() == PHP_SESSION_NONE) session_start();
include "includes/head.php";
include "includes/autoloader.php";
include "includes/block.php";
include "includes/filter.php";
$userClass = new user;
if (empty($_GET["username"]))
{
if (isset($_SESSION["user"])) header("Location: account.php?username={$_SESSION["user"]["username"]}");
else header("Location: /");
}
$userNotFound = false;
if ($user = $userClass->getUserByUsername($_GET["username"])) $ownAccount = ($user["id"] == $_SESSION["user"]["id"]);
else $userNotFound = true;
?>
<body>
<?php
include "includes/header.php";
if ($userNotFound)
{?>
<div class="error notFound">Could not find user <?=$_GET["username"]?>.</div>
<?php }
else
{
?>
<div class="account">
<h1><?=$user["username"] . $userClass->styleRank($user["rank"])?></h1>
<p>Member since: <?=$userClass->formatDate($user["registrationDate"])?></p>
<p>Total posts: <?=$userClass->totalPosts($user["id"])?></p>
<?php if ($ownAccount) {?>
<div class="change">
<form action="includes/submit.php" method="POST">
<?php if (isset($_SESSION["changeUsernameError"]))
{
if ($_SESSION["changeUsernameError"] == "none")
{
echo "<div class='success'>Changed username to {$_SESSION["user"]["username"]}</div>";
}
else
{
echo "<div class='error'>{$_SESSION["changeUsernameError"]}</div>";
}
unset($_SESSION["changeUsernameError"]);
}?>
<input type="text" name="username" placeholder="Enter new username" value="<?=$user["username"]?>">
<input type="submit" name="changeUsername" value="Change Username">
</form>
<form action="includes/submit.php" method="POST">
<?php if (isset($_SESSION["changePasswordError"]))
{
if ($_SESSION["changePasswordError"] == "none")
{
echo "<div class='success'>Changed password successfully.</div>";
}
else
{
echo "<div class='error'>{$_SESSION["changePasswordError"]}</div>";
}
unset($_SESSION["changePasswordError"]);
}?>
<input type="password" name="oldPassword" placeholder="Enter old password">
<input type="password" name="newPassword" placeholder="Enter new password">
<input type="submit" name="changePassword" value="Change Password">
</form>
</div>
<?php }?>
</div>
<?php
if ($userClass->totalPosts($user["id"]) > 0)
{
$home = false;
include "includes/posts.php";
}
}?>
</body>