[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: index.php
<?php // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); include("../admin/includes/functions/functions.php");?> <?php include("../admin/db/db.php");?> <?php if(!isset($_SESSION['username_Xw211qAAsq4'])) { header('Location: ../auth/'); exit(); } else{ $pageTitle = 'Dashboard'; $shopname = $_SESSION['business_name_Xw211qAAsq4']; $username = $_SESSION['username_Xw211qAAsq4']; $currency = mysqli_query($new,"SELECT currency from barber_admin WHERE business_name = '$shopname'"); $fechC = mysqli_fetch_array($currency); $qurtyCurrency = $fechC['currency']; $stmt = $con->prepare("SELECT forgot_pass_expire_time FROM barber_admin WHERE business_name = :business_name and username = :username"); $stmt->execute(['business_name' => $shopname,'username' =>$username]); $expiry_date = $stmt->fetchColumn(); $current_date = new DateTime(); $expiry_date = new DateTime($expiry_date); if ($current_date > $expiry_date) { $expiry_date = 'yes'; $stmt = $con->prepare("update barber_admin SET expired = ? where business_name = ? "); $stmt->execute(array($expiry_date,$shopname)); } $active = 1; $stmt1 = $con->prepare("SELECT rate FROM comm_rate WHERE business_name = ? and active = ?"); $stmt1->execute(array($shopname,$active)); $rows = $stmt1->fetchAll(); foreach($rows as $row) { $comRate1 = $row['rate']; if($comRate1 == 0){ $comRate = 0; } else { $comRate = $comRate1; } } $seleda = mysqli_query($new,"SELECT * FROM barber_admin WHERE business_name = '$shopname' and account_status = 'Trial'"); $fetch = mysqli_fetch_array($seleda); $expirationDate = $fetch['forgot_pass_expire_time']; // Current date $currentDate = date('Y-m-d'); // Calculate the difference between the current date and the expiration date $diff = strtotime($expirationDate) - strtotime($currentDate); $daysRemaining = floor($diff / (60 * 60 * 24)); // Check if there are exactly two days remaining for account expiration if ($daysRemaining > 0) { // Display the notification //echo" <p style='color:red'>Trial expired in ".$daysRemaining." day(s)</p>"; } elseif ($daysRemaining == 0) { //echo" <p style='color:red'>Trial expired today</p>"; $expiry_date = 'yes'; $stmt = $con->prepare("update barber_admin SET expired = ? where business_name = ? "); $stmt->execute(array($expiry_date,$shopname)); header("location../expired"); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title> <?php echo $pageTitle;?> - <?php echo $shopname;?></title> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script> <link rel="shortcut icon" href="../assets/icon.png" type="image/x-icon"> <link rel="icon" href="../assets/icon.png" type="image/x-icon"> <!-- App favicon --> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/accessibility.js"></script> <!-- App css --> <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/theme.min.css" rel="stylesheet" type="text/css" /> <style> #preloader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; background-color: #fff; } #loader { display: block; position: absolute; top: 50%; left: 50%; border: 16px solid #f3f3f3; border-top: 16px solid #3498db; border-radius: 50%; width: 70px; height: 70px; animation: spin 2s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .highcharts-credits { display: none !important; } </style> </head> <body> <div id="preloader"> <div id="loader"></div> </div> <!-- Begin page --> <div id="layout-wrapper"> <div class="header-border"></div> <?php include("includes/template/head.php");?> <?php include("includes/template/side.php");?> <div class="main-content"> <div class="page-content"> <div class="container-fluid"> <!-- start page title --> <div class="row"> <div class="col-12"> <div class="page-title-box d-flex align-items-center justify-content-between"> <h4 class="mb-0 font-size-18">Dashboard</h4> <div class="page-title-right"> <ol class="breadcrumb m-0"> <li class="breadcrumb-item"><a href="javascript: void(0);"><?= $shopname;?></a></li> <li class="breadcrumb-item active"><?php echo $pageTitle;?></li> </ol> </div> </div> </div> </div> <!-- end page title --> <?php include("dash-statistics.php");?> <div class="row"> <div class="col-lg-9"> <div class="card"> <div class="card-body"> <div class="row"> <div class="col-lg-12"> <h4 class="card-title">Sales Analytics</h4> <p class="card-subtitle mb-4"></p> <!-- <select id="weekSelect" onchange="updateChart()"> <?php $currentYear = date('Y'); $startOfYear = new DateTime("$currentYear-01-01"); $endOfYear = new DateTime("$currentYear-12-31"); $currentWeek = date('W'); $interval = new DateInterval('P1W'); // 1 week interval $period = new DatePeriod($startOfYear, $interval, $endOfYear); foreach ($period as $date) { $weekNum = $date->format('W'); $weekStart = $date->format('Y-m-d'); $weekEnd = (clone $date)->modify('Sunday this week')->format('Y-m-d'); $selected = ($weekNum == $currentWeek) ? 'selected' : ''; echo "<option value='$weekStart|$weekEnd' $selected>Week $weekNum ($weekStart to $weekEnd)</option>"; } ?> </select> --> <div id="container1"></div> </div> </div> </div> <!--end card body--> </div> <!-- end card--> </div> <!-- end col --> <div class="col-md-6 col-xl-3"> <div class="card"> <div class="card-body"> <div class="mb-4"> <div class="text-xs font-weight-bold text-uppercase mb-1"> Expenses - <?php echo date("M Y");?> </div> </div> <div class="row d-flex align-items-center mb-4"> <div class="col-8"> <h2 class="d-flex align-items-center mb-0"> <?php $month = date('F'); $year = date('Y'); $stmt = $con->prepare("SELECT sum(item_amount) as amount FROM expenses WHERE MONTHNAME(date) = '$month' and business_name = ?"); $stmt->execute(array($shopname)); $rows_services = $stmt->fetchAll(); foreach($rows_services as $service) { $v = $service['amount']; if(empty($v)){ echo $gg = 0; } else { echo $gg = $v; } } ?> </h2> </div> </div> <div class="progress shadow-sm" style="height: 5px;"> <div class="progress-bar bg-warning" role="progressbar" style="width: <?php echo $gg;?>%;"></div> </div> </div> <br /><br /> <div class="card-body"> <div class="mb-4"> <div class="text-xs font-weight-bold text-success text-uppercase mb-1"> Total Expenses - <?php echo date('Y');?> </div> </div> <div class="row d-flex align-items-center mb-4"> <div class="col-8"> <h2 class="d-flex align-items-center mb-0"> <?php $year = date('Y'); $stmt = $con->prepare("SELECT sum(item_amount) as amount FROM expenses WHERE year(date) = '$year' and business_name = ? "); $stmt->execute(array($shopname)); $rows_services = $stmt->fetchAll(); foreach($rows_services as $service) { $v = $service['amount']; if(empty($v)){ echo $gg = 0; } else { echo $gg = $v; } $perc = ($gg / 100); } ?> </h2> </div> </div> <div class="progress shadow-sm" style="height: 5px;"> <div class="progress-bar bg-warning" role="progressbar" style="width: <?php echo $perc;?>%;"></div> </div> </div> </div> </div> </div> <div class="row"> <div class="col-lg-7"> <div class="card"> <div class="card-body"> <select id="yearSelect" onchange="updateChart()"> <?php // Generate year options (e.g., from 2020 to current year) $currentYear = date('Y'); for ($y = 2023; $y <= $currentYear; $y++) { echo "<option value='$y'" . ($y == $currentYear ? " selected" : "") . ">$y</option>"; } ?> </select> <div id="container" style="height:400px;"></div> </div> </div> </div> <div class="col-lg-5"> <div class="card"> <div id="containerdon" style="height:440px;"></div> </div> </div> </div> <div class="row"> <div class="col-lg-6"> <div class="card"> <div class="card-body"> <div id="container22" style="height:350px;"></div> </div> </div> </div> <div class="col-lg-6"> <div class="card"> <div id="container50" style="height:350px;"></div> </div> </div> </div> </div> <!-- container-fluid --> </div> <?php include("includes/template/newfooter.php");?> </div> <!-- end main content--> </div> <!-- END layout-wrapper --> <!-- Overlay--> <div class="menu-overlay"></div> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/bootstrap.bundle.min.js"></script> <script src="assets/js/metismenu.min.js"></script> <script src="assets/js/waves.js"></script> <script src="assets/js/simplebar.min.js"></script> <script src="plugins/raphael/raphael.min.js"></script> <script src="assets/pages/dashboard-demo.js"></script> <script src="assets/js/theme.js"></script> <script src="plugins/jquery-sparkline/jquery.sparkline.min.js"></script> <!-- Chart Js--> <script src="plugins/jquery-knob/jquery.knob.min.js"></script> <!-- Chart Custom Js--> <script src="assets/pages/knob-chart-demo.js"></script> <script src="easypiechart-data.js"></script> <script src="bootstrap-datepicker.js"></script> <script type="text/javascript"> document.onreadystatechange = function() { if (document.readyState !== "complete") { document.querySelector("#preloader").style.display = "block"; } else { document.querySelector("#preloader").style.display = "none"; } }; </script> <?php // Get today's date $today = date("Y-m-d"); // Find the start (Monday) and end (Sunday) of **current week** $startOfWeek = date("Y-m-d", strtotime("Monday this week")); $endOfWeek = date("Y-m-d", strtotime("Sunday this week")); // Find the start (Monday) and end (Sunday) of **last week** $startOfLastWeek = date("Y-m-d", strtotime("Monday last week")); $endOfLastWeek = date("Y-m-d", strtotime("Sunday last week")); // Choose whether to fetch current week or last week based on user selection $selectedStart = isset($_GET['week']) && $_GET['week'] == "last" ? $startOfLastWeek : $startOfWeek; $selectedEnd = isset($_GET['week']) && $_GET['week'] == "last" ? $endOfLastWeek : $endOfWeek; // Prepare arrays to store data $salesData = []; $discountData = []; $commissionData = []; $expensesData = []; $categories = []; // Loop through Monday to Sunday for ($i = 0; $i < 7; $i++) { $currentDay = date("l", strtotime("$selectedStart +$i days")); // Get weekday name $currentDate = date("Y-m-d", strtotime("$selectedStart +$i days")); // Get date // Store weekday names for Highcharts X-axis $categories[] = "'$currentDay'"; // Fetch total sales $stmtServices = $con->prepare(" SELECT SUM(price) as amount FROM services s JOIN true_price sb ON s.service_id = sb.service_id JOIN appointments a ON sb.appointment_id = a.appointment_id WHERE a.canceled = '0' AND a.active = 'Yes' AND DAYNAME(a.created) = ? AND date(a.created) BETWEEN ? AND ? AND a.business_name = ? "); $stmtServices->execute([$currentDay, $selectedStart, $selectedEnd, $shopname]); $row = $stmtServices->fetch(); $saleamount = $row['amount'] ?? 0; // Default to 0 if no sales // Fetch discount percentage $disQuery = mysqli_query($new, " SELECT discount FROM appointments WHERE canceled = '0' AND active = 'Yes' AND DAYNAME(created) = '$currentDay' AND date(created) = '$currentDate' AND business_name = '$shopname' "); $discountPercent = 0; while ($do = mysqli_fetch_array($disQuery)) { $discountPercent = $do['discount']; } // Fetch commission rate $comQuery = mysqli_query($new, " SELECT comRate FROM appointments WHERE canceled = '0' AND active = 'Yes' AND DAYNAME(created) = '$currentDay' AND date(created) = '$currentDate' AND business_name = '$shopname' "); $commissionRate = 0; while ($do = mysqli_fetch_array($comQuery)) { $commissionRate = $do['comRate']; } // Fetch expenses $stmtExpenses = $con->prepare(" SELECT SUM(item_amount) as amount FROM expenses WHERE DAYNAME(date) = ? AND date(date) = ? "); $stmtExpenses->execute([$currentDay, $currentDate]); $expenseRow = $stmtExpenses->fetch(); $expenseAmount = $expenseRow['amount'] ?? 0; // Default to 0 if no expenses // Calculate discount amount $discountAmount = ($discountPercent / 100) * $saleamount; // Calculate commission after discount $afterDiscount = $saleamount - $discountAmount; $commissionAmount = ($commissionRate / 100) * $afterDiscount; // Store values for Highcharts $salesData[] = $saleamount; $discountData[] = $discountAmount; $commissionData[] = $commissionAmount; $expensesData[] = $expenseAmount; } // Convert arrays to comma-separated strings for Highcharts $categoriesString = implode(",", $categories); $salesDataString = implode(",", $salesData); $discountDataString = implode(",", $discountData); $commissionDataString = implode(",", $commissionData); $expensesDataString = implode(",", $expensesData); ?> <script> Highcharts.chart('container1', { title: { text: 'Daily Services Sales Report', align: 'left' }, xAxis: { categories: [<?= $categoriesString; ?>] // Load dynamically }, yAxis: { title: { text: 'Cash (<?= $qurtyCurrency; ?>)' } }, tooltip: { headerFormat: '<span style="font-size:10px">{point.key}</span><table>', pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>', footerFormat: '</table>', shared: true, useHTML: true }, plotOptions: { series: { borderWidth: 0, dataLabels: { enabled: true, format: '{point.y:.1f} <?php echo $qurtyCurrency;?>' } } }, series: [{ type: 'column', name: 'Sales', color: '#669999', data: [<?= $salesDataString; ?>] // Load dynamically }, { type: 'column', name: 'Discount', color: '#ff6666', data: [<?= $discountDataString; ?>] // Load dynamically }, { type: 'column', name: 'Commission', color: '#cc7a00', data: [<?= $commissionDataString; ?>] // Load dynamically }, { type: 'column', name: 'Expenses', color: '#990000', data: [<?= $expensesDataString; ?>] // Load dynamically }] }); </script> <?php // Get current year $year = date('Y'); // Initialize arrays $categories = []; $maleData = []; $femaleData = []; // Loop through 12 months for ($m = 1; $m <= 12; $m++) { // Get month name $month = date('F', mktime(0, 0, 0, $m, 1, $year)); $categories[] = "'$month'"; // Fetch Male customers count $stmtMale = $con->prepare(" SELECT COUNT(gender) as male FROM clients WHERE gender = 'male' AND MONTH(date) = ? AND YEAR(date) = ? AND business_name = ? "); $stmtMale->execute([$m, $year, $shopname]); $maleRow = $stmtMale->fetch(); $maleCount = $maleRow['male'] ?? 0; // Default to 0 if no data $maleData[] = $maleCount; // Fetch Female customers count $stmtFemale = $con->prepare(" SELECT COUNT(gender) as female FROM clients WHERE gender = 'female' AND MONTH(date) = ? AND YEAR(date) = ? AND business_name = ? "); $stmtFemale->execute([$m, $year, $shopname]); $femaleRow = $stmtFemale->fetch(); $femaleCount = $femaleRow['female'] ?? 0; // Default to 0 if no data $femaleData[] = $femaleCount; } // Convert arrays to Highcharts format $categoriesString = implode(",", $categories); $maleDataString = implode(",", $maleData); $femaleDataString = implode(",", $femaleData); ?> <!-- Customer base gender --> <script type="text/javascript"> Highcharts.chart('containerdon', { title: { text: 'Customer Base by Gender (Monthly)', align: 'left' }, xAxis: { categories: [<?= $categoriesString; ?>] // Load dynamically }, yAxis: { title: { text: 'Number of Customers' } }, tooltip: { headerFormat: '<span style="font-size:10px">{point.key}</span><table>', pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + '<td style="padding:0"><b>{point.y}</b></td></tr>', footerFormat: '</table>', shared: true, useHTML: true }, plotOptions: { series: { borderWidth: 0, dataLabels: { enabled: true, format: '{point.y}' } } }, series: [{ type: 'column', name: 'Male', color: '#3498db', // Blue data: [<?= $maleDataString; ?>] // Load dynamically }, { type: 'column', name: 'Female', color: '#e74c3c', // Red/Pink data: [<?= $femaleDataString; ?>] // Load dynamically }] }); </script> <!-- Moonthly sales report --> <script type="text/javascript"> function updateChart() { const selectedYear = document.getElementById('yearSelect').value; // AJAX call to fetch data for selected year fetch('getChartData.php?year=' + selectedYear + '&shopname=<?php echo $shopname; ?>') .then(response => response.json()) .then(data => { Highcharts.chart('container', { chart: { type: 'column' }, title: { text: 'Monthly Services Sales - ' + selectedYear }, xAxis: { categories: data.months, crosshair: true }, yAxis: { min: 0, title: { text: 'Cash (<?php echo $qurtyCurrency;?>)' } }, tooltip: { headerFormat: '<span style="font-size:10px">{point.key}</span><table>', pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>', footerFormat: '</table>', shared: true, useHTML: true }, plotOptions: { series: { borderWidth: 0, dataLabels: { enabled: true, format: '{point.y:.1f} <?php echo $qurtyCurrency;?>' } } }, series: [{ name: 'Sales', data: data.sales }, { type: 'column', name: 'Disc', color: '#996666', data: data.discounts }, { name: 'Com', color: '#f6c23e', data: data.commissions }, { type: 'column', name: 'Expenses', data: data.expenses }] }); }); } // Initial chart load updateChart(); </script> <!-- Top Ranked Customers Performance --> <?php // Get current month and year $monthNum = date('n'); // Numeric month (1-12) $year = date('Y'); // Initialize arrays $categories = []; $data = []; // SQL query to get top-ranked customers $query = " SELECT a.client_id, COUNT(*) AS occurrences, c.first_name, c.last_name FROM appointments a JOIN clients c ON a.client_id = c.client_id WHERE a.business_name = ? AND a.active = 'Yes' AND MONTH(a.created) = ? AND YEAR(a.created) = ? GROUP BY a.client_id ORDER BY occurrences DESC LIMIT 5 "; $stmt = $con->prepare($query); $stmt->execute([$shopname, $monthNum, $year]); $rows = $stmt->fetchAll(); foreach ($rows as $row) { $full_name = $row['first_name'] . ' ' . $row['last_name']; $categories[] = "'$full_name'"; $data[] = $row['occurrences'] ?? 0; } // Convert arrays to Highcharts format $categoriesString = implode(",", $categories); $dataString = implode(",", $data); ?> <script type="text/javascript"> Highcharts.chart('container22', { chart: { type: 'column' }, title: { text: 'Top Ranked Customers Performance (<?= date("M-Y"); ?>)' }, xAxis: { categories: [<?= $categoriesString; ?>] // Load dynamically }, yAxis: { min: 0, title: { text: 'Bookings Count' } }, tooltip: { headerFormat: '<span style="font-size:10px">{point.key}</span><table>', pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + '<td style="padding:0"><b>{point.y}</b></td></tr>', footerFormat: '</table>', shared: true, useHTML: true }, plotOptions: { series: { borderWidth: 0, dataLabels: { enabled: true, format: '{point.y}' } } }, series: [{ name: 'Booked', color: '#2ecc71', // Green color data: [<?= $dataString; ?>] // Load dynamically }] }); </script> <?php // Get current month and year $monthNum = date('n'); // Numeric month (1-12) $year = date('Y'); // Initialize arrays $categories = []; $data = []; // SQL query to get top-ranked employees $query = " SELECT a.employee_id, COUNT(*) AS occurrences, e.first_name, e.last_name FROM appointments a JOIN employees e ON a.employee_id = e.employee_id WHERE a.business_name = ? AND a.active = 'Yes' AND MONTH(a.created) = ? AND YEAR(a.created) = ? GROUP BY a.employee_id ORDER BY occurrences DESC LIMIT 5 "; $stmt = $con->prepare($query); $stmt->execute([$shopname, $monthNum, $year]); $rows = $stmt->fetchAll(); foreach ($rows as $row) { $full_name = $row['first_name'] . ' ' . $row['last_name']; $categories[] = "'$full_name'"; $data[] = $row['occurrences'] ?? 0; } // Convert arrays to Highcharts format $categoriesString = implode(",", $categories); $dataString = implode(",", $data); ?> <script type="text/javascript"> Highcharts.chart('container50', { chart: { type: 'column' }, title: { text: 'Top Ranked Employees Performance - <?= date("M-Y"); ?>' }, xAxis: { categories: [<?= $categoriesString; ?>] // Load dynamically }, yAxis: { min: 0, title: { text: 'Work Completed' } }, tooltip: { headerFormat: '<span style="font-size:10px">{point.key}</span><table>', pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + '<td style="padding:0"><b>{point.y}</b></td></tr>', footerFormat: '</table>', shared: true, useHTML: true }, plotOptions: { series: { borderWidth: 0, dataLabels: { enabled: true, format: '{point.y}' } } }, series: [{ name: 'Work Completed', color: '#3498db', // Blue color data: [<?= $dataString; ?>] // Load dynamically }] }); </script> </body> </html>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.69 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002