IP searching in postgres, hackishly (compare text(address) to username, rather than comparing address to inet(username))
This commit is contained in:
parent
f1eaa4f751
commit
34a7a558b3
@ -60,16 +60,20 @@ class LogDatabase extends Extension {
|
|||||||
if(!empty($_GET["user"])) {
|
if(!empty($_GET["user"])) {
|
||||||
if($database->engine->name == "pgsql") {
|
if($database->engine->name == "pgsql") {
|
||||||
if(preg_match("#\d+\.\d+\.\d+\.\d+(/\d+)?#", $_GET["user"])) {
|
if(preg_match("#\d+\.\d+\.\d+\.\d+(/\d+)?#", $_GET["user"])) {
|
||||||
$wheres[] = "(username = :user OR address << :user)";
|
$wheres[] = "(username = :user1 OR text(address) = :user2)";
|
||||||
|
$args["user1"] = $_GET["user"];
|
||||||
|
$args["user2"] = $_GET["user"] . "/32";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$wheres[] = "lower(username) = lower(:user)";
|
$wheres[] = "lower(username) = lower(:user)";
|
||||||
|
$args["user"] = $_GET["user"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$wheres[] = "(username = :user OR address = :user)";
|
$wheres[] = "(username = :user1 OR address = :user2)";
|
||||||
|
$args["user1"] = $_GET["user"];
|
||||||
|
$args["user2"] = $_GET["user"];
|
||||||
}
|
}
|
||||||
$args["user"] = $_GET["user"];
|
|
||||||
}
|
}
|
||||||
if(!empty($_GET["priority"])) {
|
if(!empty($_GET["priority"])) {
|
||||||
$wheres[] = "priority >= :priority";
|
$wheres[] = "priority >= :priority";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user