Initial commit
This commit is contained in:
101
application/view/dbuser/index.php
Normal file
101
application/view/dbuser/index.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<div class="dbm-content-header">
|
||||
<div class="dbm-breadcrumb">
|
||||
<span>Users</span>
|
||||
</div>
|
||||
<div class="dbm-title">
|
||||
<h1>MySQL Users</h1>
|
||||
<span class="badge"><?php echo count($this->users); ?> users</span>
|
||||
</div>
|
||||
<div class="dbm-actions">
|
||||
<button type="button" class="dbm-btn dbm-btn-success" onclick="document.getElementById('create-user-modal').style.display='flex'">
|
||||
<i data-lucide="plus"></i>
|
||||
Create User
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dbm-content-body">
|
||||
<div class="dbm-card" style="margin-bottom: 16px;">
|
||||
<div class="dbm-card-body" style="padding: 12px 16px;">
|
||||
<span style="color: var(--dbm-text-muted); font-size: 12px;">Connected as:</span>
|
||||
<strong style="margin-left: 6px; color: var(--dbm-text);"><?php echo htmlspecialchars($this->current_user); ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dbm-table-wrapper">
|
||||
<table class="dbm-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<th>Host</th>
|
||||
<th style="width: 200px;">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (!empty($this->users)): ?>
|
||||
<?php foreach ($this->users as $user): ?>
|
||||
<tr>
|
||||
<td style="font-weight: 500; color: var(--dbm-text);">
|
||||
<i data-lucide="user" style="width: 12px; height: 12px; margin-right: 6px; color: var(--dbm-text-muted);"></i>
|
||||
<?php echo htmlspecialchars($user->User); ?>
|
||||
<?php if ($user->User === $this->current_user): ?>
|
||||
<span class="badge" style="margin-left: 6px; font-size: 9px;">current</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><span class="type-column"><?php echo htmlspecialchars($user->Host); ?></span></td>
|
||||
<td>
|
||||
<a href="<?php echo Config::get('URL'); ?>dbuser/edit/<?php echo urlencode($user->User); ?>/<?php echo urlencode($user->Host); ?>" class="dbm-btn dbm-btn-sm dbm-btn-secondary">
|
||||
<i data-lucide="pencil" style="width: 11px; height: 11px;"></i>
|
||||
Edit
|
||||
</a>
|
||||
<?php if ($user->User !== $this->current_user): ?>
|
||||
<a href="<?php echo Config::get('URL'); ?>dbuser/delete/<?php echo urlencode($user->User); ?>/<?php echo urlencode($user->Host); ?>"
|
||||
class="dbm-btn dbm-btn-sm dbm-btn-danger"
|
||||
data-confirm="Delete user '<?php echo htmlspecialchars($user->User); ?>'@'<?php echo htmlspecialchars($user->Host); ?>'? This cannot be undone!">
|
||||
<i data-lucide="trash-2" style="width: 11px; height: 11px;"></i>
|
||||
Delete
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align: center; padding: 40px; color: var(--dbm-text-muted);">
|
||||
No users found
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="create-user-modal" class="dbm-modal" style="display: none;">
|
||||
<div class="dbm-modal-content">
|
||||
<div class="dbm-modal-header">
|
||||
<h3>Create New User</h3>
|
||||
<button type="button" class="dbm-modal-close" onclick="this.closest('.dbm-modal').style.display='none'">×</button>
|
||||
</div>
|
||||
<form method="post" action="<?php echo Config::get('URL'); ?>dbuser/create">
|
||||
<div class="dbm-modal-body">
|
||||
<div class="dbm-form-group">
|
||||
<label class="dbm-form-label">Username</label>
|
||||
<input type="text" name="username" class="dbm-form-input" required pattern="[a-zA-Z0-9_]+" placeholder="username">
|
||||
</div>
|
||||
<div class="dbm-form-group">
|
||||
<label class="dbm-form-label">Password</label>
|
||||
<input type="password" name="password" class="dbm-form-input" required placeholder="password">
|
||||
</div>
|
||||
<div class="dbm-form-group">
|
||||
<label class="dbm-form-label">Host</label>
|
||||
<input type="text" name="host" class="dbm-form-input" required value="localhost" placeholder="localhost or %">
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbm-modal-footer">
|
||||
<button type="button" class="dbm-btn dbm-btn-secondary" onclick="this.closest('.dbm-modal').style.display='none'">Cancel</button>
|
||||
<button type="submit" name="submit_create_user" class="dbm-btn dbm-btn-success">Create User</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user