2022-07-25 17:28:55 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
2022-08-15 10:56:05 +00:00
|
|
|
|
2022-07-25 17:28:55 +00:00
|
|
|
<head>
|
2022-09-13 16:07:01 +00:00
|
|
|
<?php require_once __DIR__."/ui/header.php"; ?>
|
2022-07-25 17:28:55 +00:00
|
|
|
</head>
|
2022-08-15 10:56:05 +00:00
|
|
|
|
2022-07-25 17:28:55 +00:00
|
|
|
<body>
|
2022-08-15 10:56:05 +00:00
|
|
|
<?php
|
2022-09-13 16:07:01 +00:00
|
|
|
require_once __DIR__."/ui/required.php";
|
|
|
|
require_once __DIR__."/ui/nav.php";
|
2022-09-12 14:15:16 +00:00
|
|
|
|
|
|
|
use App\Account;
|
|
|
|
|
|
|
|
$user_info = new Account();
|
2022-08-15 10:56:05 +00:00
|
|
|
?>
|
2022-07-25 17:28:55 +00:00
|
|
|
|
2022-08-15 10:56:05 +00:00
|
|
|
<?php
|
2022-09-12 14:15:16 +00:00
|
|
|
if ($user_info->is_loggedin()) {
|
2022-08-15 10:56:05 +00:00
|
|
|
?>
|
2022-09-06 18:15:59 +00:00
|
|
|
<div class="account-root">
|
2022-09-08 13:29:45 +00:00
|
|
|
<h2>Settings</h2>
|
|
|
|
<h3 class='space-top'>Account</h3>
|
2022-09-06 18:15:59 +00:00
|
|
|
<p>Resetting your password regularly is a good way of keeping your account safe</p>
|
2022-09-07 09:41:18 +00:00
|
|
|
<a class='btn btn-bad' href='password-reset.php'><img class='svg' src='assets/icons/password.svg'>Reset Password</a>
|
2022-09-06 18:15:59 +00:00
|
|
|
<br>
|
|
|
|
<p>Don't leave! I'm with the science team!</p>
|
2022-09-07 09:41:18 +00:00
|
|
|
<a class='btn btn-bad' href='app/account/logout.php'><img class='svg' src='assets/icons/sign-out.svg'>Logout</a>
|
2022-09-08 13:29:45 +00:00
|
|
|
</div>
|
|
|
|
<?php
|
2022-09-12 14:15:16 +00:00
|
|
|
if ($user_info->is_admin($_SESSION['id'])) {
|
2022-09-14 14:08:50 +00:00
|
|
|
?>
|
2022-09-08 13:29:45 +00:00
|
|
|
<div class="admin-root">
|
|
|
|
<h2>Admin controlls</h2>
|
|
|
|
<h3>Invite Codes</h3>
|
|
|
|
<?php
|
|
|
|
$token_request = mysqli_query($conn, "SELECT * FROM tokens WHERE used = 0");
|
|
|
|
while ($token = mysqli_fetch_array($token_request)) {
|
2022-09-14 14:08:50 +00:00
|
|
|
?>
|
|
|
|
<button onclick='copyCode()' class='btn btn-neutral'><?php echo $token['code']; ?></button>
|
|
|
|
<script>
|
|
|
|
function copyCode() {
|
|
|
|
navigator.clipboard.writeText("<?php echo $token['code']; ?>");
|
|
|
|
sniffleAdd("Info", "Invite code has been copied!", "var(--green)", "assets/icons/clipboard-text.svg");
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<?php
|
|
|
|
}
|
2022-09-08 13:29:45 +00:00
|
|
|
?>
|
2022-09-14 14:08:50 +00:00
|
|
|
<br>
|
|
|
|
<h3>Logs</h3>
|
|
|
|
<div id=logs" class="logs">
|
|
|
|
<?php
|
|
|
|
// Reading images from table
|
|
|
|
$logs_request = mysqli_query($conn, "SELECT * FROM logs ORDER BY id DESC");
|
|
|
|
|
|
|
|
while ($log = mysqli_fetch_array($logs_request)) {
|
|
|
|
?>
|
|
|
|
<div class="log">
|
|
|
|
<p><?php echo $log['id']; ?></p>
|
|
|
|
<p><?php echo $log['ipaddress']; ?></p>
|
|
|
|
<p><?php echo $log['action']; ?></p>
|
|
|
|
<?php
|
|
|
|
$log_time = new DateTime($log['time']);
|
|
|
|
echo "<p>" . $log_time->format('d/m/Y H:i:s T') . "</p>";
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<?php
|
2022-09-08 13:29:45 +00:00
|
|
|
}
|
2022-09-14 14:08:50 +00:00
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
2022-09-08 13:29:45 +00:00
|
|
|
}
|
2022-08-15 10:56:05 +00:00
|
|
|
} else {
|
|
|
|
?>
|
2022-09-06 18:15:59 +00:00
|
|
|
<div class="login-root">
|
|
|
|
<h2>Login</h2>
|
|
|
|
<p>Passwords are important to keep safe. Don't tell anyone your password, not even Fluffy!</p>
|
|
|
|
<br>
|
|
|
|
<form id="loginForm" method="POST" enctype="multipart/form-data">
|
|
|
|
<input id="loginUsername" class="btn btn-neutral" type="text" name="username" placeholder="Username">
|
|
|
|
<input id="loginPassword" class="btn btn-neutral" type="password" name="password" placeholder="Password">
|
|
|
|
<br>
|
2022-09-07 09:41:18 +00:00
|
|
|
<button id="loginSubmit" class="btn btn-good" type="submit" name="login"><img class="svg" src="assets/icons/sign-in.svg">Login</button>
|
2022-09-06 18:15:59 +00:00
|
|
|
</form>
|
2022-09-07 09:41:18 +00:00
|
|
|
<button class='btn btn-neutral' onclick="signupShow()"><img class="svg" src="assets/icons/sign-in.svg">Need an account?</button>
|
2022-09-06 18:15:59 +00:00
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
$("#loginForm").submit(function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
var username = $("#loginUsername").val();
|
|
|
|
var password = $("#loginPassword").val();
|
|
|
|
var submit = $("#loginSubmit").val();
|
2022-09-07 09:41:18 +00:00
|
|
|
$("#sniffle").load("app/account/account.php", {
|
2022-09-06 18:15:59 +00:00
|
|
|
username: username,
|
|
|
|
password: password,
|
|
|
|
submit_login: submit
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="signup-root">
|
|
|
|
<h2>Make account</h2>
|
|
|
|
<p>And amazing things happened here...</p>
|
|
|
|
<br>
|
|
|
|
<form id="signupForm" method="POST" action="signup.php" enctype="multipart/form-data">
|
|
|
|
<input id="signupUsername" class="btn btn-neutral" type="text" name="username" placeholder="Username">
|
|
|
|
<br>
|
|
|
|
<input id="signupPassword" class="btn btn-neutral" type="password" name="password" placeholder="Password">
|
|
|
|
<input id="signupPasswordConfirm" class="btn btn-neutral" type="password" name="confirm_password" placeholder="Re-enter Password">
|
|
|
|
<br>
|
|
|
|
<input id="signupToken" class="btn btn-neutral" type="text" name="token" placeholder="Invite Code">
|
|
|
|
<br>
|
2022-09-07 09:41:18 +00:00
|
|
|
<button id="signupSubmit" class="btn btn-good" type="submit" name="signup"><img class="svg" src="assets/icons/sign-in.svg">Sign Up</button>
|
2022-09-06 18:15:59 +00:00
|
|
|
</form>
|
2022-09-07 09:41:18 +00:00
|
|
|
<button class='btn btn-neutral' onclick="loginShow()"><img class="svg" src="assets/icons/sign-in.svg">I already got an account!</button>
|
2022-09-06 18:15:59 +00:00
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
$("#signupForm").submit(function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
var username = $("#signupUsername").val();
|
|
|
|
var password = $("#signupPassword").val();
|
|
|
|
var confirm_password = $("#signupPasswordConfirm").val();
|
|
|
|
var token = $("#signupToken").val();
|
|
|
|
var submit = $("#signupSubmit").val();
|
2022-09-07 09:41:18 +00:00
|
|
|
$("#sniffle").load("app/account/account.php", {
|
2022-09-06 18:15:59 +00:00
|
|
|
username: username,
|
|
|
|
password: password,
|
|
|
|
confirm_password: confirm_password,
|
|
|
|
token: token,
|
|
|
|
submit_signup: submit
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function loginShow() {
|
|
|
|
document.querySelector(".login-root").style.display = "block";
|
|
|
|
document.querySelector(".signup-root").style.display = "none";
|
|
|
|
};
|
|
|
|
function signupShow() {
|
|
|
|
document.querySelector(".signup-root").style.display = "block";
|
|
|
|
document.querySelector(".login-root").style.display = "none";
|
|
|
|
};
|
|
|
|
</script>
|
2022-08-15 10:56:05 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2022-07-25 17:28:55 +00:00
|
|
|
|
2022-09-13 16:07:01 +00:00
|
|
|
<?php require_once __DIR__."/ui/footer.php"; ?>
|
2022-07-25 17:28:55 +00:00
|
|
|
</body>
|
2022-08-15 10:56:05 +00:00
|
|
|
|
|
|
|
</html>
|