<?php
function leet($key) {
  $known = array('A', 'B', 'C', 'D', 'E', 'F', 'H', 'I', 'K', 'L', 'M', 'N', 'O', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Z');
  $leet = array('4', '|3', '(', '|)', '3', '|=', '|-|', '/', '/&#060;', '/_', '/&#092;/&#092;', '/&#092;/', '0', '|2', 'Z', '7', '|_|', '&#092;/', '&#092;/&#092;/', '&#062;&#060;', 'S');
  if(rand(0, 1) == 1) {
    $key = strtoupper($key);
  } else {
    $key = strtolower($key);
  }
  $key = str_replace($known, $leet, $key);
  return stripslashes($key);
}

if (!$_POST['url']) {
  echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <title>1337-alizer</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <meta name="generator" content="Quanta post-3.3.2, Debian GNU/Linux testing/unstable">
        <meta name="keywords" content="">
        <meta name="description" content="The one and only JRRZZ.net 1337-alizer">
        </head>
        <body>
        <table align="center" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="400" valign="top" align="center">
          <h1>1337-A7/z3r</h1>
          <form action="'.$_SERVER['PHP_SELF'].'" method="post">
          <input type="text" name="url"><input type="submit" value="1337 Th1z SiT3!">
          </form>
          <small>3x4mP7e(http://foo.bar/)</small>
          </td>
        </tr>
        </table>
        </body>
        </html>';
} else {
  if (substr($_POST['url'], 0, 7) == 'http://') {
    $rootex = substr($_POST['url'], 7, (strlen($_POST['url'])-7));
    $rootarray = explode('/', $rootex);
    $i = 0;
    while($i < (count($rootarray)-1)) {
      $root .= $rootarray[$i].'/';
      $i++;
    }
    $root = 'http://'.$root;
    $cont = file($_POST['url']);
    if ($cont) {
      foreach($cont as $line) {
        $line = strtolower($line);
        $line = str_replace('src="/', 'src="', $line);
        $line = str_replace('href="/', 'href="', $line);
        $line = str_replace('background="/', 'background="', $line);
        $line = preg_replace('/src="(?!http:\/\/|ftp:\/\/)(.+?)"/', 'src="'.$root.'\\1"', $line); //phphulp.nl(legolas)
        $line = preg_replace('/href="(?!http:\/\/|ftp:\/\/|mailto:)(.+?)"/', 'href="'.$root.'\\1"', $line);
        $line = preg_replace('/background="(?!http:\/\/)(.+?)"/', 'background="'.$root.'\\1"', $line);
        $bytes = preg_split('//', str_replace('&nbsp;', ' ', $line));
        foreach ($bytes as $byte) {
        if ($byte == '<') {
          $tagopen = 'yes';
        }
        if ($tagopen == 'yes' && $byte == '>') {
          $tagopen = 'no';
        }
        if ($tagopen == 'no' && $byte != '<' && $byte != '>') {
          echo leet($byte);
        }
        if ($byte == '<' || $byte == '>' || $tagopen == 'yes') {
          echo $byte;
        }
      }
      echo "\r\n";
      }
    } else {
      echo 'U n00b!';
    }
  } else {
    echo 'U n00b!';
  }
}
?>