- Replaced all client-facing $e->getMessage() with generic error messages - Added error_log() with filename prefix to all catch blocks - Covered jsonError(), echo, and json_encode() response patterns - Also fixed 2 remaining display_errors=1 and add_invoice.php leak - Script-assisted fix for 75 files, manual fix for 12 remaining edge cases
25 lines
575 B
PHP
25 lines
575 B
PHP
<?php
|
|
require_once __DIR__ . '/../../connect.php';
|
|
|
|
|
|
// Use prepared statement to prevent SQL injection
|
|
$sql = "
|
|
SELECT * FROM `server_locations`
|
|
";
|
|
|
|
try {
|
|
$stmt = $con->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$car_locations = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
if ($car_locations) {
|
|
jsonSuccess($car_locations);
|
|
} else {
|
|
jsonError("No car locations found");
|
|
}
|
|
} catch (PDOException $e) {
|
|
error_log("[get_location_area_links.php] " . $e->getMessage());
|
|
jsonError("An internal error occurred. Please try again later.");
|
|
} |