Как адаптировать скрипт под NETTE/LATTE

Всем привет, хотелось бы узнать, как адаптировать скрипт ниже под NETE/LATTE. Думаю это поможет вам попрактиковаться, а мне немного помочь)

function renderDefault()
{   
      $request = $this->getHttpRequest();
      if($request->getMethod() !== "POST") return;
      if(empty($request->getPost("pass"))) return;
       
      $id = $this->getUser()->getIdentity()->id;
      $checks = $this->getUser()->getIdentity()->checks;
      $this->users->where("id", $id)->update([
      'checks+=' => 1, // see +=
      ]);   

      if (strlen($hash) == 32) {
        $thash = "MD5";
      }elseif (strlen($hash) == 86) {
        $thash = "SHA256(AuthMe)";
      }else {
        $messages = "Неверный тип хеша. Проверить можно только Sha256(AuthMe) и MD5";
        break;
      }

      $files = 'slovar.txt';
      $success = false;
      $offset = 0;
      $i = 0;
      $old_percent = 0;
      $f = fopen($files, 'r+');

      while (!feof($f) && !$success) {
        $password = $success_pass = str_replace(["\n", "\r"], '', fgets($f));

        if ($thash == "MD5") {
          $md5 = md5($password);
          if ($hash == $md5) $success = true;
        }else {
          $shainfo = explode("$", $hash);
          $pass = hash("sha256", $password) . $shainfo[2];
          if (strcasecmp($shainfo[3], hash('sha256', $pass)) == 0) $success = true;
        }
      }
      fclose($f);
      unset($f);

      if ($success) {
        $messages = "Успешно! Пароль - $success_pass";
      }else {
        $messages = "Пароль не найден.";
      }

      $_SESSION['last_check'] = $messages;
      $_SESSION['isfree'] = "decoder";
      header("Location: ../result");
      } ELSE header("Location: ../decoder.php");
}

Ответы (0 шт):