59 lines
1.6 KiB
PHP
59 lines
1.6 KiB
PHP
<?php
|
|
defined($security_key) or exit;
|
|
ini_set('display_errors', '1');
|
|
ini_set('display_startup_errors', '1');
|
|
error_reporting(E_ALL);
|
|
//------------------------------------------
|
|
// dealers
|
|
//------------------------------------------
|
|
|
|
//Connect to DB
|
|
$pdo = dbConnect($dbname);
|
|
|
|
//NEW ARRAY
|
|
$criterias = [];
|
|
$messages = '';
|
|
|
|
//Check for $_GET variables and build up clause
|
|
if(isset($get_content) && $get_content!=''){
|
|
//GET VARIABLES FROM URL
|
|
$requests = explode("&", $get_content);
|
|
//Check for keys and values
|
|
foreach ($requests as $y){
|
|
$v = explode("=", $y);
|
|
//INCLUDE VARIABLES IN ARRAY
|
|
$criterias[$v[0]] = $v[1];
|
|
}
|
|
}
|
|
|
|
//IDENTITY REQUEST - override SQL
|
|
if(isset($criterias['identity_id'])){
|
|
$sql = 'SELECT d.*, m.full_path FROM identity_dealers id JOIN dealers d ON id.dealer_ID = d.rowID LEFT JOIN media m ON d.dealer_media = m.rowID WHERE identity_id='.$criterias['identity_id'].'';
|
|
|
|
|
|
$stmt = $pdo->prepare($sql);
|
|
//Excute Query
|
|
$stmt->execute();
|
|
//Get results
|
|
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
//------------------------------------------
|
|
//CHANGE ROWID INTO UUID
|
|
//------------------------------------------
|
|
function updateRowID($row) {
|
|
$row['rowID'] = encodeUuid($row['rowID']);
|
|
return $row;
|
|
}
|
|
|
|
$updatedData = array_map('updateRowID', $messages);
|
|
|
|
//------------------------------------------
|
|
//JSON_ENCODE
|
|
//------------------------------------------
|
|
$messages = json_encode($updatedData, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|
|
//Send results
|
|
echo $messages;
|
|
|
|
?>
|