Files
crm_php/.hta_slug/users/_home.php
dev sp ca6af2f5e2 init
2024-04-29 12:55:11 +00:00

54 lines
2.4 KiB
PHP

<?php
require_once('/var/www/html/.hta_config/crm_config.php');
require_once('/var/www/html/.htac_header.php');
require_once('/var/www/html/.htac_nav.php');
?>
<div>
<a href="/users/add-user" class="" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 10px 20px 10px 20px; color: #fff; border-radius: 6px; float: right; margin-top: 30px;">Add User</a>
</div>
<table class="bg-[#fff] text-[#3F4254] rounded-lg font-bold">
<thead>
<tr>
<th class="text-center border-b-2 p-3">Name</th>
<th class="text-center border-b-2 p-3">Email</th>
<th class="text-center border-b-2 p-3">Mobile</th>
<th class="text-center border-b-2 p-3">Time</th>
<th class="text-center border-b-2 p-3">Access</th>
<th class="text-center border-b-2 p-3">Access by State</th>
<th class="text-center border-b-2 p-3">Action</th>
</tr>
</thead>
<tbody>
<?php
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM users");
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($rows as $row){
?>
<tr>
<td class="border-y-2 p-2"><?php echo $row['name']; ?></td>
<td class="border-y-2 p-2"><?php echo $row['email']; ?></td>
<td class="border-y-2 p-2"><?php echo $row['mobile']; ?></td>
<td class="border-y-2 p-2"><?php echo $row['time']; ?></td>
<td class="border-y-2 p-2"><?php echo $row['access']; ?></td>
<td class="border-y-2 p-2"><?php echo $row['access']; ?></td>
<td class="border-y-2 p-2">
<div class="flex flex-row justify-center">
<a href="/admin/edit-user/?id=<?php echo $row['id']; ?>">Edit</a> &nbsp; | &nbsp;
<a href="/admin/delete-user/?id=<?php echo $row['id']; ?>">Delete</a>
</div>
</td>
</tr>
<?php }
$num_rows = $stmt->rowCount();
} catch (PDOException $e) {
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
}
?>
</tbody>
</table>