Moved data variable before use

This commit is contained in:
2025-02-27 22:12:28 -05:00
parent 7228709ff6
commit e52192469a

View File

@ -53,6 +53,10 @@ $createTableSQL = "CREATE TABLE IF NOT EXISTS tickets (
$conn->query($createTableSQL);
// Parse input regardless of content-type header
$rawInput = file_get_contents('php://input');
$data = json_decode($rawInput, true);
// Generate hash from stable components
function generateTicketHash($data) {
$stableComponents = [
@ -91,10 +95,6 @@ if ($result->num_rows > 0) {
// Force JSON content type for all incoming requests
header('Content-Type: application/json');
// Parse input regardless of content-type header
$rawInput = file_get_contents('php://input');
$data = json_decode($rawInput, true);
if (!$data) {
// Try parsing as URL-encoded data
parse_str($rawInput, $data);