Browse Source

IPv6 support

pull/40/head
Savetheinternet 13 years ago
parent
commit
384996b58a
  1. 7
      inc/functions.php
  2. 8
      install.sql

7
inc/functions.php

@ -668,7 +668,14 @@
return false; return false;
} }
function isIPv6() {
return strstr($_SERVER['RETMOTE_ADDR'], ':') !== false;
}
function isTor() { function isTor() {
if(isIPv6())
return false; // Tor does not support IPv6
return gethostbyname( return gethostbyname(
ReverseIPOctets($_SERVER['REMOTE_ADDR']) . '.' . $_SERVER['SERVER_PORT'] . '.' . ReverseIPOctets($_SERVER['SERVER_ADDR']) . '.ip-port.exitlist.torproject.org' ReverseIPOctets($_SERVER['REMOTE_ADDR']) . '.' . $_SERVER['SERVER_PORT'] . '.' . ReverseIPOctets($_SERVER['SERVER_ADDR']) . '.ip-port.exitlist.torproject.org'
) == '127.0.0.2'; ) == '127.0.0.2';

8
install.sql

@ -20,7 +20,7 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-- --
CREATE TABLE IF NOT EXISTS `bans` ( CREATE TABLE IF NOT EXISTS `bans` (
`ip` varchar(15) NOT NULL, `45` varchar(15) NOT NULL,
`mod` int(11) NOT NULL COMMENT 'which mod made the ban', `mod` int(11) NOT NULL COMMENT 'which mod made the ban',
`set` int(11) NOT NULL, `set` int(11) NOT NULL,
`expires` int(11) DEFAULT NULL, `expires` int(11) DEFAULT NULL,
@ -63,7 +63,7 @@ INSERT INTO `boards` (`id`, `uri`, `title`, `subtitle`) VALUES
CREATE TABLE IF NOT EXISTS `modlogs` ( CREATE TABLE IF NOT EXISTS `modlogs` (
`mod` int(11) NOT NULL, `mod` int(11) NOT NULL,
`ip` varchar(15) NOT NULL, `ip` varchar(45) NOT NULL,
`time` int(11) NOT NULL, `time` int(11) NOT NULL,
`text` text NOT NULL `text` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -102,7 +102,7 @@ INSERT INTO `mods` (`id`, `username`, `password`, `type`) VALUES
-- --
CREATE TABLE IF NOT EXISTS `mutes` ( CREATE TABLE IF NOT EXISTS `mutes` (
`ip` varchar(15) NOT NULL, `ip` varchar(45) NOT NULL,
`time` int(11) NOT NULL `time` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@ -137,7 +137,7 @@ CREATE TABLE IF NOT EXISTS `posts_b` (
`filename` varchar(30) DEFAULT NULL, `filename` varchar(30) DEFAULT NULL,
`filehash` varchar(32) DEFAULT NULL, `filehash` varchar(32) DEFAULT NULL,
`password` varchar(20) DEFAULT NULL, `password` varchar(20) DEFAULT NULL,
`ip` varchar(15) NOT NULL, `ip` varchar(45) NOT NULL,
`sticky` int(1) NOT NULL, `sticky` int(1) NOT NULL,
`locked` int(1) NOT NULL, `locked` int(1) NOT NULL,
UNIQUE KEY `id` (`id`) UNIQUE KEY `id` (`id`)

Loading…
Cancel
Save