<?php
// Add to your existing config.php

// Paystack Configuration
$paystack_config = [
    'secret_key' => 'sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // Live key
    'public_key' => 'pk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',  // Live key
    // For testing use:
    // 'secret_key' => 'sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    // 'public_key' => 'pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'callback_url' => 'https://yourdomain.com/paystack_callback.php'
];

// MikroTik Configuration
$mikrotik_config = [
    'host' => '192.168.1.1',
    'user' => 'admin',
    'pass' => 'password',
    'port' => 8728,  // API port
    'address_list' => 'internet_access'
];

// Function to get client IP and MAC
function getClientNetworkInfo() {
    $ip_address = $_SERVER['REMOTE_ADDR'];
    
    // Get MAC address from ARP table (works on local network)
    $mac_address = null;
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
        // Windows
        $arp_output = shell_exec("arp -a $ip_address");
        if (preg_match('/(' . preg_quote($ip_address) . ')\s+([a-fA-F0-9:-]{17})/', $arp_output, $matches)) {
            $mac_address = strtoupper($matches[2]);
        }
    } else {
        // Linux/Unix
        $arp_output = shell_exec("arp -n $ip_address | grep -v 'incomplete'");
        if (preg_match('/' . preg_quote($ip_address) . '.*?(([a-fA-F0-9]{2}[:-]){5}[a-fA-F0-9]{2})/i', $arp_output, $matches)) {
            $mac_address = strtoupper($matches[1]);
        }
    }
    
    // If MAC not found via ARP, try alternative method
    if (!$mac_address) {
        // Get from exec
        $mac = shell_exec("getmac /fo csv /nh | findstr /i " . escapeshellarg($ip_address));
        if ($mac) {
            $mac_address = trim(str_replace('"', '', $mac));
        }
    }
    
    return [
        'ip' => $ip_address,
        'mac' => $mac_address
    ];
}
?>