|
Server IP : 217.21.85.138 / Your IP : 216.73.216.103 Web Server : LiteSpeed System : Linux in-mum-web906.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64 User : u915722082 ( 915722082) PHP Version : 7.4.33 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u915722082/public_html/gemore/../invoice/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
error_reporting(0); // Disable in production
ini_set('display_errors', 0); // Disable in production
header('Cache-Control: public, max-age=3600'); // Cache for 1 hour
header('ETag: ' . md5($variation));
header('Content-Type: application/json');
try {
require "db.php"; // Ensure this returns a mysqli connection
// Validate input
if (!isset($_POST['variation']) || empty($_POST['variation'])) {
throw new Exception('Variation parameter is required');
}
$variation = trim($_POST['variation']);
// Prepare statement using mysqli
$stmt = $con->prepare("SELECT * FROM attributes WHERE VARIATION = ? LIMIT 1");
if (!$stmt) {
throw new Exception('Failed to prepare statement: ' . $con->error);
}
// Bind parameter
$stmt->bind_param("s", $variation);
// Execute statement (no parameters here - they were bound above)
if (!$stmt->execute()) {
throw new Exception('Failed to execute query: ' . $stmt->error);
}
// Get result
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if ($row && !empty($row['VARIATION_VAL'])) {
echo json_encode([
'success' => true,
'variation_values' => $row['VARIATION_VAL'] // The code will handle splitting this
]);
} else {
echo json_encode([
'success' => false,
'message' => 'No values found for this variation'
]);
}
// Clean up
$stmt->close();
} catch (Exception $e) {
error_log('Error in fetch_attributes.php: ' . $e->getMessage());
http_response_code(500);
echo json_encode([
'success' => false,
'message' => 'An error occurred while fetching variation values'
]);
}