Browse Source

fix domain validator, search with "alive" ("a") option in GET

master
R4SAS 2 years ago
parent
commit
4a7ffab927
  1. 1
      lib/checker.php
  2. 8
      lib/utils.php
  3. 2
      views/search.php

1
lib/checker.php

@ -48,4 +48,3 @@ class Checker implements Task { @@ -48,4 +48,3 @@ class Checker implements Task {
return $ts;
}
}

8
lib/utils.php

@ -168,12 +168,12 @@ class Utils { @@ -168,12 +168,12 @@ class Utils {
return false;
}
if(filter_var($data, FILTER_VALIDATE_DOMAIN) !== false && preg_match('/\.i2p$/', $data)) {
return true;
if(filter_var($data, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) === false || !preg_match('/\.i2p$/', $data)) {
$result = "Domain is not valid. The label must be less than 63 characters long, contain only alphanumerics or hyphens and end with .i2p.";
return false;
}
$result = "Domain is not valid. Check if you domain label is lesser than 63 chars and it ends with .i2p.";
return false;
return true;
}
public static function verifyHostRecord(string $data, &$output): bool {

2
views/search.php

@ -25,7 +25,7 @@ if (isset($query) && strlen($query) > 67 || isset($_POST["q"]) && strlen($_POST[ @@ -25,7 +25,7 @@ if (isset($query) && strlen($query) > 67 || isset($_POST["q"]) && strlen($_POST[
$q = htmlspecialchars($_POST["q"]);
}
if (isset($_POST["a"]))
if (isset($_POST["a"]) || isset($_GET["a"]))
$a = true;
if (isset($_POST["all"]) || isset($_GET["all"]))

Loading…
Cancel
Save