<?php

session_start();

if (isset($_SESSION['userid'])) {
    require_once('../../db.php');
    require_once('../../shared/functionsinc.php');
    $userId = $_SESSION['userid'];
    $userLayer = $_SESSION['layer'];
    $property_id = $_SESSION['property'];

    if (isset($_POST["get_referral_code"])) {
        $data = get_my_referral_code($pdo, $userId, $userLayer, $property_id);
        echo json_encode($data);
    }

    if(isset($_POST['getReferralsRequest'])){
        $data = get_my_referrals($pdo, $userId, $userLayer, $property_id);
        echo json_encode($data);
    }
} else {
    header("location: ../../login.php");
    exit();
}

