Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

function crontab_refresh() { if (file_exists(TMP_DIR . 'crontab_refresh')) { ..

Decoded Output download

<?  function crontab_refresh() 
{ 
    if (file_exists(TMP_DIR . 'crontab_refresh')) { 
        return false; 
    } 
    $crons = scandir(CRON_PATH); 
    $jobs = array(); 
    foreach ($crons as $cron) { 
        $full_path = CRON_PATH . $cron; 
        if (!is_file($full_path)) { 
            continue; 
        } 
        if (pathinfo($full_path, PATHINFO_EXTENSION) != 'php') { 
            continue; 
        } 
        if ($cron != 'epg.php') { 
            $time = '*/1 * * * *'; 
        } else { 
            $time = '0 1 * * *'; 
        } 
        $jobs[] = "{$time} " . PHP_BIN . ' ' . $full_path . ' # Xtream-Codes IPTV Panel'; 
    } 
	 
    $crontab = trim(shell_exec('crontab -l')); 
	 
    if (!empty($crontab)) { 
        $lines = explode('', $crontab); 
        $lines = array_map('trim', $lines); 
        if ($lines == $jobs) { 
            file_put_contents(TMP_DIR . 'crontab_refresh', 1); 
            return true; 
        } 
        $counter = count($lines); 
        $index = 0; 
        while ($index < $counter) { 
            if (stripos($lines[$index], CRON_PATH)) { 
                unset($lines[$index]); 
            } 
            $index++; 
        } 
        foreach ($jobs as $job) { 
            array_push($lines, $job); 
        } 
    } else { 
        $lines = $jobs; 
    } 
    shell_exec('crontab -r'); 
    $tmpfname = tempnam('/tmp', 'crontab'); 
    $handle = fopen($tmpfname, 'w'); 
    fwrite($handle, implode('', $lines) . ''); 
    fclose($handle); 
    shell_exec("crontab {$tmpfname}"); 
    @unlink($tmpfname); 
    file_put_contents(TMP_DIR . 'crontab_refresh', 1); 
} ?>

Did this file decode correctly?

Original Code

function crontab_refresh()
{
    if (file_exists(TMP_DIR . 'crontab_refresh')) {
        return false;
    }
    $crons = scandir(CRON_PATH);
    $jobs = array();
    foreach ($crons as $cron) {
        $full_path = CRON_PATH . $cron;
        if (!is_file($full_path)) {
            continue;
        }
        if (pathinfo($full_path, PATHINFO_EXTENSION) != 'php') {
            continue;
        }
        if ($cron != 'epg.php') {
            $time = '*/1 * * * *';
        } else {
            $time = '0 1 * * *';
        }
        $jobs[] = "{$time} " . PHP_BIN . ' ' . $full_path . ' # Xtream-Codes IPTV Panel';
    }
	
    $crontab = trim(shell_exec('crontab -l'));
	
    if (!empty($crontab)) {
        $lines = explode('', $crontab);
        $lines = array_map('trim', $lines);
        if ($lines == $jobs) {
            file_put_contents(TMP_DIR . 'crontab_refresh', 1);
            return true;
        }
        $counter = count($lines);
        $index = 0;
        while ($index < $counter) {
            if (stripos($lines[$index], CRON_PATH)) {
                unset($lines[$index]);
            }
            $index++;
        }
        foreach ($jobs as $job) {
            array_push($lines, $job);
        }
    } else {
        $lines = $jobs;
    }
    shell_exec('crontab -r');
    $tmpfname = tempnam('/tmp', 'crontab');
    $handle = fopen($tmpfname, 'w');
    fwrite($handle, implode('', $lines) . '');
    fclose($handle);
    shell_exec("crontab {$tmpfname}");
    @unlink($tmpfname);
    file_put_contents(TMP_DIR . 'crontab_refresh', 1);
}

Function Calls

None

Variables

None

Stats

MD5 ce2d6c379f9e523c4b18fa68d99627be
Eval Count 0
Decode Time 82 ms