File "piso_wifi_homepage.php"

Full Path: /home/leadltht/fastlinkinternet.com/administrator/data-provider/admin/piso_wifi_homepage.php
File size: 4.11 KB
MIME-type: text/x-php
Charset: utf-8

<?php
// Database connection
$conn = new mysqli("server329", "leadltht_prazey1982", "prazey1982123456", "leadltht_fastlinkinternet");
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Fetch total areas
$total_areas_query = "SELECT COUNT(*) as total_areas FROM piso_wifi_areas";
$total_areas_result = $conn->query($total_areas_query);
$total_areas = $total_areas_result->fetch_assoc()['total_areas'];

// Fetch total clients
$total_clients_query = "SELECT COUNT(*) as total_clients FROM clients";
$total_clients_result = $conn->query($total_clients_query);
$total_clients = $total_clients_result->fetch_assoc()['total_clients'];

// Fetch number of harvested clients this month
$current_month = date('m');
$current_year = date('Y');
$harvested_clients_query = "SELECT COUNT(DISTINCT client_id) as harvested_clients FROM harvest_collection WHERE MONTH(harvested_date) = ? AND YEAR(harvested_date) = ?";
$stmt = $conn->prepare($harvested_clients_query);
$stmt->bind_param("ii", $current_month, $current_year);
$stmt->execute();
$harvested_clients_result = $stmt->get_result();
$harvested_clients = $harvested_clients_result->fetch_assoc()['harvested_clients'];

// Fetch total collection this month
$collection_query = "SELECT SUM(owner_share) as total_collection FROM harvest_collection WHERE MONTH(harvested_date) = ? AND YEAR(harvested_date) = ?";
$stmt = $conn->prepare($collection_query);
$stmt->bind_param("ii", $current_month, $current_year);
$stmt->execute();
$collection_result = $stmt->get_result();
$total_collection = $collection_result->fetch_assoc()['total_collection'];

$stmt->close();
$conn->close();
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Piso WiFi Dashboard</title>
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .dashboard-container {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-around;
        }
        .dashboard-card {
            flex: 1 0 21%; /* 4 cards per row */
            margin: 10px;
            padding: 20px;
            text-align: center;
            color: black; /* Change the font color to black */
            border: 1px solid #ddd;
            border-radius: 5px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        .dashboard-card h2 {
            font-size: 1.5rem;
            margin-bottom: 10px;
            color: black; /* Change the font color to black */
        }
        .dashboard-card p {
            font-size: 2rem;
            margin: 0;
            color: black; /* Change the font color to black */
        }
        .total-areas { background-color: #ff6f61; }
        .total-clients { background-color: #6f9bff; }
        .harvested-clients { background-color: #6fff93; }
        .total-collection { background-color: #ffe96f; }
    </style>
</head>
<body>
    <div class="container mt-5">
        <div style="text-align: center;">
<img src="https://fastlinkinternet.com/administrator/data-provider/uploads/fastlink.png" alt="Logo" style="max-width: 120px;">
        </div>
        <h1 class="mb-4" style="text-align: center;">FASTLINK INTERNET</h1>
        <h1 class="text-center mb-4">Piso WiFi Dashboard</h1>
        <div class="dashboard-container">
            <div class="dashboard-card total-areas">
                <h2>Total Areas</h2>
                <p><?php echo $total_areas; ?></p>
            </div>
            <div class="dashboard-card total-clients">
                <h2>List of Clients</h2>
                <p><?php echo $total_clients; ?></p>
            </div>
            <div class="dashboard-card harvested-clients">
                <h2>Harvested Clients This Month</h2>
                <p><?php echo $harvested_clients; ?></p>
            </div>
            <div class="dashboard-card total-collection">
                <h2>Collection This Month</h2>
                <p>₱<?php echo number_format($total_collection, 2); ?></p>
            </div>
        </div>
    </div>
</body>
</html>