<?php
include 'db_connect.php';

$number = $_POST['number'] ?? '';

    $con = dbConnect();

    $url = 'https://app.bpluspro.xyz/social/';
    $stmt = $con->prepare("SELECT name, image FROM signup WHERE number = ? LIMIT 1");
    $stmt->bind_param("s", $number);
    $stmt->execute();
    $recRes = $stmt->get_result();

    if ($recRes->num_rows === 0) {
        echo json_encode([
            'status'  => 'error',
            'message' => 'Receiver number not found in database!'
        ]);
        exit();
    }

    $recRow = $recRes->fetch_assoc();

    echo json_encode([
        'status'          => 'success',
        'message'         => 'Successfully',
        'receiver_name'   => $recRow['name'],
        'receiver_profile' => $url.$recRow['image']
    ]);
    


?>
