70 lines
3.0 KiB
PHP
Executable File
70 lines
3.0 KiB
PHP
Executable File
<?php include("includes/header.php"); ?>
|
|
<?php include("db.php"); ?>
|
|
|
|
<div class="container p-4">
|
|
<div class="row">
|
|
<!-- Listar tablas existentes -->
|
|
<div class="col-md-8">
|
|
<h5 class="text-center">Tablas Existentes</h5>
|
|
<table id="tables-list" class="table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>Nombre de la Tabla</th>
|
|
<th>Acciones</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
// Obtener todas las tablas de la base de datos
|
|
$query = "SHOW TABLES";
|
|
$result = mysqli_query($conn, $query);
|
|
|
|
while ($row = mysqli_fetch_array($result)) {
|
|
$table_name = $row[0];
|
|
?>
|
|
<tr>
|
|
<td><?php echo $table_name; ?></td>
|
|
<td>
|
|
<!-- Enlace para editar datasets en la tabla -->
|
|
<a href="server_side/index.php?table=<?php echo $table_name; ?>" class="btn btn-primary">
|
|
Editar Contenido
|
|
</a>
|
|
<a href="rename_table.php?table=<?php echo $table_name; ?>" class="btn btn-warning">Renombrar</a>
|
|
<!-- Enlace para eliminar la tabla -->
|
|
<a href="delete_table.php?table=<?php echo $table_name; ?>" class="btn btn-danger" onclick="return confirm('¿Estás seguro de que deseas eliminar esta tabla?');">
|
|
Eliminar
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
<?php } ?>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#tables-list').DataTable({
|
|
"language": {
|
|
"url": "https://cdn.datatables.net/plug-ins/2.3.0/i18n/es-ES.json"
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Formulario para crear una nueva tabla -->
|
|
<div class="col-md-4">
|
|
<div class="card card-body">
|
|
<h5 class="text-center">Crear Tabla</h5>
|
|
<form action="create_table.php" method="POST">
|
|
<div class="form-group mb-3">
|
|
<input type="text" name="table_name" class="form-control" placeholder="Nombre de la Tabla" required>
|
|
</div>
|
|
<div class="d-grid">
|
|
<input type="submit" name="create_table" class="btn btn-primary" value="Crear Tabla">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include("includes/footer.php"); ?>
|