122 lines
6.2 KiB
PHP
122 lines
6.2 KiB
PHP
<?php
|
|
if (!isset($_SESSION["user"]))
|
|
header("Location: /");
|
|
|
|
if (isset($_GET["m"]) && htmlspecialchars($_GET["m"]) != "privacy")
|
|
header("Location: /settings");
|
|
|
|
if (isset($_POST["update"])) {
|
|
$form = (object) [
|
|
"username" => htmlspecialchars($_POST["username"]),
|
|
"bio" => htmlspecialchars($_POST["bio"]),
|
|
"password" => htmlspecialchars($_POST["password"]),
|
|
"password_confirm" => htmlspecialchars($_POST["password_2"]),
|
|
];
|
|
|
|
$settings = new Settings($_SESSION["user"], $conn);
|
|
|
|
$settings->getForm($form->username, $form->bio, $form->password);
|
|
$settings->updateUsername();
|
|
$settings->updateBio();
|
|
$settings->updatePassword($form->password_confirm);
|
|
}
|
|
?>
|
|
<html>
|
|
<head>
|
|
<title><?= $website->title; ?>: <?= $website->slogan; ?></title>
|
|
<link rel="stylesheet" href="styles/main.css">
|
|
</head>
|
|
|
|
<body>
|
|
<table class="container" align="center">
|
|
<tbody>
|
|
<?php require("includes/header.php"); ?>
|
|
|
|
<tr>
|
|
<?php require("includes/left_sidebar.php"); ?>
|
|
|
|
<td valign="top">
|
|
<table class="box-tab">
|
|
<tbody>
|
|
<tr>
|
|
<th align="left">
|
|
<a <?php if (isset($_GET["m"])) echo "id=\"non-selected\""; ?> href="/settings">main settings</a>
|
|
<a <?php if (!isset($_GET["m"]) || htmlspecialchars($_GET["m"]) != "privacy") echo "id=\"non-selected\""; ?> href="/settings?m=privacy">privacy</a>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>
|
|
<?php
|
|
if (!isset($_GET["m"])) {
|
|
?>
|
|
<table align="center" class="open-form">
|
|
<tbody>
|
|
<form action="/settings" method="POST">
|
|
<tr>
|
|
<th class="form-header" align="left">account details</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="label-box" align="right">username: </td>
|
|
<td><input type="text" name="username" value="<?= $account->getDetails("username"); ?>"></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="label-box" valign="top" align="right">bio: </td>
|
|
<td><textarea name="bio" rows="5" cols="30"><?= $account->getDetails("bio"); ?></textarea></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<th class="form-header" align="left">security</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="label-box" align="right">password: </td>
|
|
<td><input type="password" name="password"></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="label-box" align="right">confirm password: </td>
|
|
<td><input type="password" name="password_2"></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td></td>
|
|
<td class="small-text">
|
|
<?php
|
|
if (isset($_POST["update"]) && isset($settings))
|
|
if ($settings->error != NULL) echo "<font style=\"color: #831f1f\">$settings->error</font> <br>";
|
|
?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td class="submit-pad"><input type="submit" name="update" value="update"></td>
|
|
</tr>
|
|
</form>
|
|
</tbody>
|
|
</table>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
if (isset($_GET["m"]) && htmlspecialchars($_GET["m"]) == "privacy") {
|
|
?>
|
|
<p>Page under construction</p>
|
|
<?php
|
|
}
|
|
?>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
|
|
<?php require("includes/footer.php"); ?>
|
|
</tbody>
|
|
</table>
|
|
</body>
|
|
</html>
|