35274-vm/index.php
Flatlogic Bot 74e14f325c wtf
2025-10-27 12:24:10 +00:00

47 lines
1.7 KiB
PHP

<?php
require_once __DIR__ . '/db/config.php';
// Simple migration runner
try {
$pdo = db();
$pdo->exec("CREATE TABLE IF NOT EXISTS channels (id INT AUTO_INCREMENT PRIMARY KEY, telegram_id VARCHAR(255) NOT NULL UNIQUE, name VARCHAR(255), avatar_url VARCHAR(255), description TEXT, subscribers INT, added_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP);");
} catch (PDOException $e) {
// In a real app, log this error. For now, we die.
die("Database migration failed: " . $e->getMessage());
}
// Fetch channel count
$stmt = $pdo->query("SELECT COUNT(*) FROM channels");
$channel_count = $stmt->fetchColumn();
require_once __DIR__ . '/layout_header.php';
?>
<div class="container-fluid">
<h1 class="h2 mb-4">Dashboard</h1>
<div class="row">
<div class="col-md-4">
<div class="card text-white">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div>
<h5 class="card-title">Total Channels</h5>
<p class="card-text fs-2 fw-bold"><?php echo $channel_count; ?></p>
</div>
<div class="fs-1 text-primary">
<i data-feather="tv"></i>
</div>
</div>
<a href="add_channel.php" class="btn btn-primary mt-3">
<i data-feather="plus" class="me-1" style="width:16px; height:16px;"></i>
Add Channel
</a>
</div>
</div>
</div>
</div>
</div>
<?php
require_once __DIR__ . '/layout_footer.php';
?>