Copy the following into a .php file:
<?php // Define list of valid barcodes // NOTE: This you might want to replace with a database query (or a file lookup) to look up if the given barcode is valid. // You might also want to register in your database or a file that the barcode was sent here to the server. $valid_barcodes = [ '8576482874', '2475587348', '4203716559', '9184783714', '1486424882', '2845717594', '2118477499', ]; // Validate incoming data if (empty($_GET['data'])) { system_error('No barcode sent to server.'); } if (empty($_GET['id'])) { system_error('No scanner ID sent to server.'); } // Check if barcode is valid if (in_array($_GET['data'], $valid_barcodes)) { header('Content-Type: application/json'); echo json_encode(['status' => 'ok', 'result_msg' => 'Everything is good! Welcome to the show!']); } else { system_error('Barcode is invalid.'); } // -------------------------------------------------------------- // Utility functions function system_error($err_msg) { header('Content-Type: application/json'); echo json_encode(['status' => 'error', 'err_msg' => $err_msg]); exit; }