Moved data variable before use
This commit is contained in:
@ -53,6 +53,10 @@ $createTableSQL = "CREATE TABLE IF NOT EXISTS tickets (
|
|||||||
|
|
||||||
$conn->query($createTableSQL);
|
$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
|
// Generate hash from stable components
|
||||||
function generateTicketHash($data) {
|
function generateTicketHash($data) {
|
||||||
$stableComponents = [
|
$stableComponents = [
|
||||||
@ -91,10 +95,6 @@ if ($result->num_rows > 0) {
|
|||||||
// Force JSON content type for all incoming requests
|
// Force JSON content type for all incoming requests
|
||||||
header('Content-Type: application/json');
|
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) {
|
if (!$data) {
|
||||||
// Try parsing as URL-encoded data
|
// Try parsing as URL-encoded data
|
||||||
parse_str($rawInput, $data);
|
parse_str($rawInput, $data);
|
||||||
|
|||||||
Reference in New Issue
Block a user