Moved data variable before use
This commit is contained in:
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user