<?php 
// Credit: https://t.me/akashkinha

function run($path) {
    // Credit: https://t.me/akashkinha
    $php = "/usr/local/bin/php"; // Adjust if needed
    exec("$php $path > /dev/null 2>&1 &");
}

// Credit: https://t.me/akashkinha
// Get current minute
$minute = (int) date('i');

// Always run every-minute scripts
// Credit: https://t.me/akashkinha
run("/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_zehn.php");
sleep(30);
run("/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_zehn.php");
run("/home/lnaiarav/bdgwinvip2.site/niyamitakelasa.php");
run("/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_aidudi.php");
run("/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_kemuru.php");
run("/home/lnaiarav/bdgwinvip2.site/ktrx.php");

// Credit: https://t.me/akashkinha

// Function to runbyakash the PHP scripts in the background
function runbyakash($path) {
    $php = "/usr/local/bin/php"; // Adjust if needed
    exec("$php $path > /dev/null 2>&1 &");
}

// Conditional script runbyakashs based on the current minute
if ($minute % 3 === 0) {
    // Every 3 minutes scripts
    $everyThreeMinutesScripts = [
        "/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_drei.php",
        "/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_aidudi_drei.php",
        "/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_kemuru_drei.php",
        "/home/lnaiarav/bdgwinvip2.site/ktrx3.php"
    ];

    foreach ($everyThreeMinutesScripts as $script) {
        runbyakash($script);
    }
}

if ($minute % 5 === 0) {
    // Every 5 minutes scripts
    $everyFiveMinutesScripts = [
        "/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_funf.php",
        "/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_aidudi_funf.php",
        "/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_kemuru_funf.php",
        "/home/lnaiarav/bdgwinvip2.site/ktrx5.php"
    ];

    foreach ($everyFiveMinutesScripts as $script) {
        runbyakash($script);
    }
}

if ($minute % 10 === 0) {
    // Every 10 minutes scripts
    $everyTenMinutesScripts = [
        "/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_aidudi_zehn.php",
        "/home/lnaiarav/bdgwinvip2.site/niyamitakelasa_kemuru_zehn.php",
        "/home/lnaiarav/bdgwinvip2.site/ktrx10.php"
    ];

    foreach ($everyTenMinutesScripts as $script) {
        runbyakash($script);
    }
}
?>
