diff --git a/database/backported/1.5/registerAccount.php b/database/backported/1.5/registerAccount.php new file mode 100644 index 0000000..4aaaa2b --- /dev/null +++ b/database/backported/1.5/registerAccount.php @@ -0,0 +1,42 @@ +prepare("SELECT id FROM users WHERE username = ? OR email = ?"); +$stmt->bind_param("ss", $username, $email); +$stmt->execute(); +$res = $stmt->get_result(); + +if ($res->num_rows > 0) { + exitWithMessage("-4"); +} + +$hashed = password_hash($password, PASSWORD_DEFAULT); +$token = bin2hex(random_bytes(256)); +$ip = getIPAddress(); +$time = time(); + +$stmt = $conn->prepare("INSERT INTO users (token, username, password, email, register_time, latest_ip) VALUES (?, ?, ?, ?, ?, ?)"); +$stmt->bind_param("ssssis", $token, $username, $hashed, $email, $time, $ip); +$stmt->execute(); + +$stmt->close(); +$conn->close(); + +echo encrypt("1"); diff --git a/database/registerAccount.php b/database/registerAccount.php index 81817af..0ffd330 100644 --- a/database/registerAccount.php +++ b/database/registerAccount.php @@ -14,6 +14,10 @@ if (isAllowedDatabaseVersion(getClientVersion())) { require __DIR__ . '/backported/1.21/registerAccount.php'; exit; } + if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") { + require __DIR__ . '/backported/1.5/registerAccount.php'; + exit; + } } checkClientDatabaseVersion(); $conn = newConnection();