help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
telegram-bot
RSK World
telegram-bot
Telegram Bot - Python + Telegram Bot API + SQLite + PHP Dashboard + Bot Commands + Automation
telegram-bot
  • __pycache__
  • assets
  • .env1.5 KB
  • .gitignore845 B
  • CHANGELOG.md3.8 KB
  • LICENSE1.3 KB
  • LICENSE.txt1.3 KB
  • PROJECT_STATUS.md3.2 KB
  • README.md6.7 KB
  • RELEASE_NOTES.md5.5 KB
  • SETUP.md1.5 KB
  • bot.db0 B
  • bot.py3.9 KB
  • config.py773 B
  • dashboard.php8.1 KB
  • database.py7.5 KB
  • handlers.py19.5 KB
  • index.html6.6 KB
  • project_info.php1.5 KB
  • requirements.txt564 B
  • setup.py3.1 KB
  • utils.py8.9 KB
dashboard.php
dashboard.php
Raw Download
Find: Go to:

<?php
/*
 * Project: Telegram Bot - Admin Dashboard
 * Author: Molla Samser
 * Designer & Tester: Rima Khatun
 * Website: https://rskworld.in
 * Contact: hello@rskworld.in | +91 93305 39277
 * Address: Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India, 713147
 * Copyright: © 2026 RSK World. All rights reserved.
 */

// Simple database connection to bot.db
try {
    $db = new PDO('sqlite:bot.db');
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    // Fetch stats
    $userCount = $db->query("SELECT COUNT(*) FROM users")->fetchColumn();
    $feedbackCount = $db->query("SELECT COUNT(*) FROM feedback")->fetchColumn();
    $reminderCount = $db->query("SELECT COUNT(*) FROM reminders")->fetchColumn();
    
    // Fetch recent users
    $users = $db->query("SELECT * FROM users ORDER BY joined_date DESC LIMIT 5")->fetchAll(PDO::FETCH_ASSOC);
    
    // Fetch recent feedback
    $feedbacks = $db->query("SELECT f.*, u.first_name FROM feedback f JOIN users u ON f.user_id = u.user_id ORDER BY timestamp DESC LIMIT 5")->fetchAll(PDO::FETCH_ASSOC);
    
    // Get additional stats
    $totalMessages = $db->query("SELECT SUM(msg_count) FROM users")->fetchColumn() ?: 0;
    $totalXP = $db->query("SELECT SUM(xp) FROM users")->fetchColumn() ?: 0;
    $avgXP = $userCount > 0 ? round($totalXP / $userCount, 2) : 0;
    
    // Get top 5 users by XP
    $topUsers = $db->query("SELECT first_name, xp, msg_count FROM users ORDER BY xp DESC LIMIT 5")->fetchAll(PDO::FETCH_ASSOC);
    
} catch (PDOException $e) {
    die("Database Connection Error: " . $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bot Admin Dashboard - RSK World</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        :root {
            --primary: #229ED9;
            --dark: #1a1a1a;
            --light: #f4f7f6;
            --success: #28a745;
            --warning: #ffc107;
        }
        body { font-family: 'Segoe UI', sans-serif; background: var(--light); margin: 0; display: flex; }
        .sidebar { width: 250px; background: var(--dark); color: #fff; height: 100vh; padding: 20px; box-sizing: border-box; }
        .sidebar h2 { color: var(--primary); border-bottom: 1px solid #333; padding-bottom: 10px; }
        .sidebar ul { list-style: none; padding: 0; }
        .sidebar li { padding: 15px 0; border-bottom: 1px solid #222; cursor: pointer; transition: 0.3s; }
        .sidebar li:hover { color: var(--primary); }
        .main-content { flex: 1; padding: 30px; overflow-y: auto; }
        .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
        .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
        .stat-card { background: #fff; padding: 25px; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); text-align: center; }
        .stat-card i { font-size: 2.5rem; color: var(--primary); margin-bottom: 10px; }
        .stat-card h3 { margin: 10px 0; font-size: 2rem; }
        .data-table { width: 100%; background: #fff; border-collapse: collapse; border-radius: 10px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.05); margin-bottom: 30px; }
        .data-table th, .data-table td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; }
        .data-table th { background: #f8f9fa; color: var(--dark); font-weight: 600; }
        .badge { padding: 5px 10px; border-radius: 20px; font-size: 0.8rem; background: var(--primary); color: #fff; }
    </style>
</head>
<body>
    <div class="sidebar">
        <h2>RSK World</h2>
        <ul>
            <li><i class="fas fa-tachometer-alt"></i> Dashboard</li>
            <li><i class="fas fa-users"></i> Users</li>
            <li><i class="fas fa-comments"></i> Feedback</li>
            <li><i class="fas fa-bell"></i> Reminders</li>
            <li><i class="fas fa-cog"></i> Settings</li>
        </ul>
    </div>
    
    <div class="main-content">
        <div class="header">
            <h1>Telegram Bot Admin</h1>
            <div class="user-info">Welcome, Admin</div>
        </div>
        
        <div class="stats-grid">
            <div class="stat-card">
                <i class="fas fa-users"></i>
                <p>Total Users</p>
                <h3><?php echo $userCount; ?></h3>
            </div>
            <div class="stat-card">
                <i class="fas fa-comment-dots"></i>
                <p>Feedbacks</p>
                <h3><?php echo $feedbackCount; ?></h3>
            </div>
            <div class="stat-card">
                <i class="fas fa-clock"></i>
                <p>Reminders Set</p>
                <h3><?php echo $reminderCount; ?></h3>
            </div>
            <div class="stat-card">
                <i class="fas fa-comments"></i>
                <p>Total Messages</p>
                <h3><?php echo number_format($totalMessages); ?></h3>
            </div>
            <div class="stat-card">
                <i class="fas fa-star"></i>
                <p>Total XP</p>
                <h3><?php echo number_format($totalXP); ?></h3>
            </div>
            <div class="stat-card">
                <i class="fas fa-chart-line"></i>
                <p>Avg XP/User</p>
                <h3><?php echo $avgXP; ?></h3>
            </div>
        </div>
        
        <h2>Top 5 Users by XP</h2>
        <table class="data-table">
            <thead>
                <tr>
                    <th>Rank</th>
                    <th>Name</th>
                    <th>XP</th>
                    <th>Messages</th>
                    <th>Level</th>
                </tr>
            </thead>
            <tbody>
                <?php 
                $rank = 1;
                foreach ($topUsers as $user): 
                    $level = floor($user['xp'] / 100) + 1;
                ?>
                <tr>
                    <td><?php echo $rank++; ?></td>
                    <td><?php echo htmlspecialchars($user['first_name']); ?></td>
                    <td><span class="badge"><?php echo $user['xp']; ?> XP</span></td>
                    <td><?php echo $user['msg_count']; ?></td>
                    <td>Level <?php echo $level; ?></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        
        <h2>Recent Users</h2>
        <table class="data-table">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>Name</th>
                    <th>Username</th>
                    <th>XP</th>
                    <th>Joined</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($users as $u): ?>
                <tr>
                    <td><?php echo $u['user_id']; ?></td>
                    <td><?php echo htmlspecialchars($u['first_name']); ?></td>
                    <td>@<?php echo htmlspecialchars($u['username'] ?? 'N/A'); ?></td>
                    <td><span class="badge"><?php echo $u['xp']; ?> XP</span></td>
                    <td><?php echo $u['joined_date']; ?></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        
        <h2>Latest Feedback</h2>
        <table class="data-table">
            <thead>
                <tr>
                    <th>User</th>
                    <th>Message</th>
                    <th>Time</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($feedbacks as $f): ?>
                <tr>
                    <td><?php echo htmlspecialchars($f['first_name']); ?></td>
                    <td><?php echo htmlspecialchars($f['message']); ?></td>
                    <td><?php echo $f['timestamp']; ?></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</body>
</html>
199 lines•8.1 KB
php
🚀 Support RSK World

Subscribe to our YouTube channel for latest tutorials & updates!



Click subscribe & support our work ❤️

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer