This repository has been archived on 2024-08-28. You can view files and clone it, but cannot push or open issues or pull requests.
satori-services/public/get-profile-field.php
2022-07-04 00:07:38 +00:00

22 lines
681 B
PHP

<?php
require_once '_flashii.php';
$userId = (int)filter_input(INPUT_GET, 'user', FILTER_SANITIZE_NUMBER_INT);
$fieldId = (int)filter_input(INPUT_GET, 'field', FILTER_SANITIZE_NUMBER_INT);
try {
$fetch = $db->prepare('SELECT `field_value` FROM `msz_profile_fields_values` WHERE `field_id` = :field AND `user_id` = :user');
$fetch->bindValue('user', $userId);
$fetch->bindValue('field', $fieldId);
$fetch->execute();
$data = $fetch->fetchObject();
if($data)
echo json_encode($data);
else {
http_response_code(404);
echo '{"error":105}';
}
} catch(PDOException $ex) {
http_response_code(500);
echo '{"error":104}';
}