PLTDRJKKFIKACYGFPIYOYJXYXYKSDELNYJGLWHTN
<?php
$flag = trim(file_get_contents(".flag"));
$key = trim(file_get_contents(".key"));
function str_rot($s, $n = 13) {
static $letters = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz';
$n = (int)$n % 26;
if (!$n) return $s;
if ($n < 0) $n += 26;
if ($n == 13) return str_rot13($s);
$rep = substr($letters, $n * 2) . substr($letters, 0, $n * 2);
return strtr($s, $letters, $rep);
}
function rotate_string($string, $key) {
for($i = 0; $i < strlen($string); $i++)
$string[$i] = str_rot($string[$i], ord($key[$i % strlen($key)]) - ord("a"));
return $string;
}
$ciphertext = rotate_string($flag, $key);
if (isset($_GET["encryptme"])){
if (ctype_alpha($_GET["encryptme"])){
$ciphertext = rotate_string(trim($_GET["encryptme"]), $key);
} else {
$ciphertext = "Please Feed Me LETTERS";
}
}
echo "<h6>".$ciphertext."</h6>";
echo highlight_file(__FILE__, true);
?>