mirror of
https://git.sr.ht/~iwakuralain/text0Nly
synced 2025-07-27 07:30:31 +00:00
updated other pages
This commit is contained in:
parent
f58c1fa2da
commit
253c4a48cb
206
main/admin.php
206
main/admin.php
@ -60,6 +60,8 @@ $users = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'self' 'unsafe-inline';">
|
||||
<title>Text0Nly - Admin Panel</title>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<style>
|
||||
@ -67,36 +69,102 @@ $users = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.admin-table th, .admin-table td {
|
||||
padding: 8px;
|
||||
padding: 12px 8px;
|
||||
border: 1px solid #ddd;
|
||||
text-align: left;
|
||||
}
|
||||
.admin-table th {
|
||||
background: #f5f5f5;
|
||||
font-weight: 600;
|
||||
}
|
||||
.ban-btn {
|
||||
background: #dc3545;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 4px 8px;
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
width: 100%;
|
||||
}
|
||||
.unban-btn {
|
||||
background: #28a745;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 4px 8px;
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
width: 100%;
|
||||
}
|
||||
.status-banned {
|
||||
color: #dc3545;
|
||||
font-weight: 600;
|
||||
}
|
||||
.status-moderator {
|
||||
color: #28a745;
|
||||
font-weight: 600;
|
||||
}
|
||||
.preventive-ban {
|
||||
background: #fff;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
margin: 20px 0;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
.ban-form {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.ban-form input[type="text"] {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
padding: 8px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.ban-form button {
|
||||
padding: 8px 16px;
|
||||
}
|
||||
.error {
|
||||
color: #dc3545;
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
margin: 10px 0;
|
||||
border: 1px solid #dc3545;
|
||||
}
|
||||
.success {
|
||||
color: #28a745;
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
margin: 10px 0;
|
||||
border: 1px solid #28a745;
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.admin-table {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ban-form {
|
||||
flex-direction: column;
|
||||
}
|
||||
.ban-form input[type="text"] {
|
||||
width: 100%;
|
||||
}
|
||||
.ban-form button {
|
||||
width: 100%;
|
||||
}
|
||||
.admin-table th, .admin-table td {
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@ -126,76 +194,80 @@ $users = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
</div>
|
||||
|
||||
<h2>Preventively Banned Usernames</h2>
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<th>Banned At</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$stmt = $db->query('SELECT username, created_at FROM banned_usernames ORDER BY created_at DESC');
|
||||
$banned_usernames = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach ($banned_usernames as $banned): ?>
|
||||
<div style="overflow-x: auto;">
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($banned['username']) ?></td>
|
||||
<td><?= $banned['created_at'] ?></td>
|
||||
<td>
|
||||
<form method="post" style="display:inline">
|
||||
<input type="hidden" name="username" value="<?= htmlspecialchars($banned['username']) ?>">
|
||||
<input type="hidden" name="action" value="preventive_unban">
|
||||
<button type="submit" class="unban-btn">Unban</button>
|
||||
</form>
|
||||
</td>
|
||||
<th>Username</th>
|
||||
<th>Banned At</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$stmt = $db->query('SELECT username, created_at FROM banned_usernames ORDER BY created_at DESC');
|
||||
$banned_usernames = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach ($banned_usernames as $banned): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($banned['username']) ?></td>
|
||||
<td><?= $banned['created_at'] ?></td>
|
||||
<td>
|
||||
<form method="post" style="display:inline">
|
||||
<input type="hidden" name="username" value="<?= htmlspecialchars($banned['username']) ?>">
|
||||
<input type="hidden" name="action" value="preventive_unban">
|
||||
<button type="submit" class="unban-btn">Unban</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h2>Users</h2>
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<th>Status</th>
|
||||
<th>Created</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($users as $user): ?>
|
||||
<div style="overflow-x: auto;">
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($user['username']) ?></td>
|
||||
<td>
|
||||
<?php if ($user['is_blocked']): ?>
|
||||
<span class="status-banned">Banned</span>
|
||||
<?php elseif ($user['is_moderator']): ?>
|
||||
<span class="status-moderator">Moderator</span>
|
||||
<?php else: ?>
|
||||
Active
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?= $user['created_at'] ?></td>
|
||||
<td>
|
||||
<?php if (!$user['is_moderator']): ?>
|
||||
<form method="post" style="display:inline">
|
||||
<input type="hidden" name="username" value="<?= htmlspecialchars($user['username']) ?>">
|
||||
<?php if ($user['is_blocked']): ?>
|
||||
<input type="hidden" name="action" value="unban">
|
||||
<button type="submit" class="unban-btn">Unban</button>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="action" value="ban">
|
||||
<button type="submit" class="ban-btn">Ban</button>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<th>Username</th>
|
||||
<th>Status</th>
|
||||
<th>Created</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($users as $user): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($user['username']) ?></td>
|
||||
<td>
|
||||
<?php if ($user['is_blocked']): ?>
|
||||
<span class="status-banned">Banned</span>
|
||||
<?php elseif ($user['is_moderator']): ?>
|
||||
<span class="status-moderator">Moderator</span>
|
||||
<?php else: ?>
|
||||
Active
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?= $user['created_at'] ?></td>
|
||||
<td>
|
||||
<?php if (!$user['is_moderator']): ?>
|
||||
<form method="post" style="display:inline">
|
||||
<input type="hidden" name="username" value="<?= htmlspecialchars($user['username']) ?>">
|
||||
<?php if ($user['is_blocked']): ?>
|
||||
<input type="hidden" name="action" value="unban">
|
||||
<button type="submit" class="unban-btn">Unban</button>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="action" value="ban">
|
||||
<button type="submit" class="ban-btn">Ban</button>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
134
main/login.php
134
main/login.php
@ -66,35 +66,125 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'self' 'unsafe-inline';">
|
||||
<title>Text0Nly - Login</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; max-width: 400px; margin: 20px auto; padding: 20px; }
|
||||
.form-group { margin: 10px 0; }
|
||||
input { width: 100%; padding: 8px; margin: 5px 0; }
|
||||
button { width: 100%; padding: 10px; background: #2196F3; color: white; border: none; cursor: pointer; }
|
||||
.error { color: red; }
|
||||
.success { color: green; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
margin-top: 20px;
|
||||
}
|
||||
h2 {
|
||||
margin: 0 0 20px 0;
|
||||
text-align: center;
|
||||
color: #222;
|
||||
}
|
||||
.form-group {
|
||||
margin: 15px 0;
|
||||
}
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
margin: 5px 0;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
font-size: 16px;
|
||||
}
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
background: #222;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
button:hover {
|
||||
background: #444;
|
||||
}
|
||||
.error {
|
||||
color: #dc3545;
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid #dc3545;
|
||||
}
|
||||
.success {
|
||||
color: #28a745;
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid #28a745;
|
||||
}
|
||||
.links {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.links a {
|
||||
color: #222;
|
||||
text-decoration: none;
|
||||
margin: 0 10px;
|
||||
}
|
||||
.links a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
@media (max-width: 400px) {
|
||||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
.container {
|
||||
padding: 15px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Login</h2>
|
||||
<?php if ($error): ?>
|
||||
<div class="error"><?= htmlspecialchars($error) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($success): ?>
|
||||
<div class="success"><?= htmlspecialchars($success) ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="container">
|
||||
<h2>Login</h2>
|
||||
<?php if ($error): ?>
|
||||
<div class="error"><?= htmlspecialchars($error) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($success): ?>
|
||||
<div class="success"><?= htmlspecialchars($success) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<input type="text" name="username" placeholder="Username" required>
|
||||
<form method="post" autocomplete="off">
|
||||
<div class="form-group">
|
||||
<input type="text" name="username" placeholder="Username" required autocomplete="username">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="password" name="password" placeholder="Password" required autocomplete="current-password">
|
||||
</div>
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
<div class="links">
|
||||
<a href="register.php">Register</a>
|
||||
<a href="index.php">Back to chat</a>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="password" name="password" placeholder="Password" required>
|
||||
</div>
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
<p><a href="register.php">Register</a> | <a href="index.php">Back to chat</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php ob_end_flush(); ?>
|
@ -68,39 +68,137 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'self' 'unsafe-inline';">
|
||||
<title>Text0Nly - Registration</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; max-width: 400px; margin: 20px auto; padding: 20px; }
|
||||
.form-group { margin: 10px 0; }
|
||||
input, textarea { width: 100%; padding: 8px; margin: 5px 0; }
|
||||
textarea { height: 100px; }
|
||||
button { width: 100%; padding: 10px; background: #2196F3; color: white; border: none; cursor: pointer; }
|
||||
.error { color: red; }
|
||||
.success { color: green; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
margin-top: 20px;
|
||||
}
|
||||
h2 {
|
||||
margin: 0 0 20px 0;
|
||||
text-align: center;
|
||||
color: #222;
|
||||
}
|
||||
.form-group {
|
||||
margin: 15px 0;
|
||||
}
|
||||
input, textarea {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
margin: 5px 0;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
font-size: 16px;
|
||||
}
|
||||
textarea {
|
||||
height: 120px;
|
||||
resize: vertical;
|
||||
}
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
background: #222;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
button:hover {
|
||||
background: #444;
|
||||
}
|
||||
.error {
|
||||
color: #dc3545;
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid #dc3545;
|
||||
}
|
||||
.success {
|
||||
color: #28a745;
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid #28a745;
|
||||
}
|
||||
.links {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.links a {
|
||||
color: #222;
|
||||
text-decoration: none;
|
||||
}
|
||||
.links a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.requirements {
|
||||
font-size: 0.9em;
|
||||
color: #666;
|
||||
margin: 5px 0;
|
||||
}
|
||||
@media (max-width: 400px) {
|
||||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
.container {
|
||||
padding: 15px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Registration</h2>
|
||||
<?php if ($error): ?>
|
||||
<div class="error"><?= htmlspecialchars($error) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($success): ?>
|
||||
<div class="success"><?= htmlspecialchars($success) ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="container">
|
||||
<h2>Registration</h2>
|
||||
<?php if ($error): ?>
|
||||
<div class="error"><?= htmlspecialchars($error) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($success): ?>
|
||||
<div class="success"><?= htmlspecialchars($success) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<input type="text" name="username" placeholder="Username" required maxlength="50">
|
||||
<form method="post" autocomplete="off">
|
||||
<div class="form-group">
|
||||
<input type="text" name="username" placeholder="Username" required maxlength="50" pattern="[a-zA-Z0-9_]+" autocomplete="username">
|
||||
<div class="requirements">Only letters, numbers and underscore allowed</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="password" name="password" placeholder="Password" required minlength="8" autocomplete="new-password">
|
||||
<div class="requirements">Minimum 8 characters</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<textarea name="pgp_key" placeholder="PGP key (optional)" maxlength="4096"></textarea>
|
||||
</div>
|
||||
<button type="submit">Register</button>
|
||||
</form>
|
||||
<div class="links">
|
||||
<a href="index.php">Back to chat</a>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="password" name="password" placeholder="Password (min 8 characters)" required minlength="8">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<textarea name="pgp_key" placeholder="PGP key (optional)"></textarea>
|
||||
</div>
|
||||
<button type="submit">Register</button>
|
||||
</form>
|
||||
<p><a href="index.php">Back to chat</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php ob_end_flush(); ?>
|
Loading…
x
Reference in New Issue
Block a user