summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--schema/aur-schema.sql2
-rw-r--r--upgrading/4.5.0.txt7
-rw-r--r--web/lib/acctfuncs.inc.php2
3 files changed, 9 insertions, 2 deletions
diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql
index b0663eb5..99f90834 100644
--- a/schema/aur-schema.sql
+++ b/schema/aur-schema.sql
@@ -376,7 +376,7 @@ CREATE TABLE IF NOT EXISTS TU_Votes (
-- Malicious user banning
--
CREATE TABLE Bans (
- IPAddress INTEGER UNSIGNED NOT NULL DEFAULT 0,
+ IPAddress VARCHAR(45) NULL DEFAULT NULL,
BanTS TIMESTAMP NOT NULL,
PRIMARY KEY (IPAddress)
) ENGINE = InnoDB;
diff --git a/upgrading/4.5.0.txt b/upgrading/4.5.0.txt
index 5cf0888c..fb0a2993 100644
--- a/upgrading/4.5.0.txt
+++ b/upgrading/4.5.0.txt
@@ -11,3 +11,10 @@ ALTER TABLE Users
ADD COLUMN LastSSHLogin BIGINT UNSIGNED NOT NULL DEFAULT 0,
ADD COLUMN LastSSHLoginIPAddress VARCHAR(45) NULL DEFAULT NULL;
---
+
+3. Convert the IPAddress column of the Bans table to VARCHAR(45). If the table
+ contains any active bans, convert them accordingly:
+
+----
+ALTER TABLE Bans MODIFY IPAddress VARCHAR(45) NULL DEFAULT NULL;
+----
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index 08dbc671..b3cf6122 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -621,7 +621,7 @@ function try_login() {
function is_ipbanned() {
$dbh = DB::connect();
- $q = "SELECT * FROM Bans WHERE IPAddress = " . $dbh->quote(ip2long($_SERVER['REMOTE_ADDR']));
+ $q = "SELECT * FROM Bans WHERE IPAddress = " . $dbh->quote($_SERVER['REMOTE_ADDR']);
$result = $dbh->query($q);
return ($result->fetchColumn() ? true : false);