Moved towards smarty templates, support php7, switched to mysqli,

finalized language support and fixed some more bugs
This commit is contained in:
2023-02-13 16:41:38 +01:00
parent 76ccecca7f
commit ee582988e6
192 changed files with 13558 additions and 13476 deletions

View File

@@ -1,16 +1,37 @@
IP Reg Installation
1. Create database
Create a database for IP Reg on your web server, as well as a MySQL user who has all privileges for accessing and modifying it.
1. Install requirements
IP Reg version 0.6 and up depends on smarty template engine.
In Debian install ist with: "apt-get install smarty3".
The GHP-GD module is also required: "apt-get install php-gd".
2. Run import
Import the mysql.sql file into your database, which will create the tables and some sample data.
2. Create database
Create a database for IP Reg on your web server, as well as a MySQL user who
has all privileges for accessing and modifying it.
3. Edit config file
CREATE DATABASE ipreg;
Create database-user for application with minimum necessary rights.
CREATE USER 'ipreg'@'localhost' IDENTIFIED BY '********';
GRANT SELECT, INSERT, UPDATE, DELETE ON ipreg.* TO 'ipreg'@'localhost';
3. Run import
Import the mysql.sql file into your database, which will create the tables
and some sample data.
mysql ipreg < mysql.sql
4. Edit config file
Open config.php in a text editor and fill in your database details.
4. Upload files
Upload all files and directory's (except the install directory) to your webserver.
5. Upload files
Upload all files and directory's (except the install directory) to your
webserver.
5. Start using IP Reg
Start your browser and login to IP Reg with the default username/password: admin/admin
6. Check file access rights for security
Only directory tpl_c should be writeble by webserver
7. Start using IP Reg
Start your browser and login to IP Reg with the default username/password:
admin/admin

View File

@@ -1,143 +1,177 @@
CREATE TABLE asset (
asset_id int(10) NOT NULL auto_increment,
asset_name varchar(100) NOT NULL,
asset_hostname varchar(100) NOT NULL,
assetclass_id int(10) NOT NULL,
asset_info text NOT NULL,
PRIMARY KEY (asset_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
INSERT INTO asset (asset_name, assetclass_id) VALUES
('My Computer', 1),
('My Server', 2);
CREATE TABLE assetclass (
assetclass_id int(10) NOT NULL auto_increment,
assetclassgroup_id int(10) NOT NULL,
assetclass_name varchar(100) NOT NULL,
PRIMARY KEY (assetclass_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
INSERT INTO assetclass (assetclassgroup_id, assetclass_name) VALUES
(1, 'PC'),
(2, 'Server');
CREATE TABLE assetclassgroup (
assetclassgroup_id int(10) NOT NULL auto_increment,
assetclassgroup_name varchar(100) NOT NULL,
assetclassgroup_color varchar(6) NOT NULL,
PRIMARY KEY (assetclassgroup_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
INSERT INTO assetclassgroup (assetclassgroup_name, assetclassgroup_color) VALUES
('Workstations', 000000);
CREATE TABLE location (
location_id int(10) NOT NULL auto_increment,
location_name varchar(100) NOT NULL,
location_parent int(1) NOT NULL default 0,
location_info text NOT NULL,
PRIMARY KEY (location_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
INSERT INTO location (location_name, location_parent) VALUES
('Main Office', 0);
CREATE TABLE nat (
nat_id int(10) NOT NULL auto_increment,
nat_type int(1) NOT NULL,
nat_ext int(10) NOT NULL,
nat_int int(10) NOT NULL,
PRIMARY KEY (nat_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
CREATE TABLE node (
node_id int(10) NOT NULL auto_increment,
node_ip varchar(15) NOT NULL,
node_mac varchar(12) NOT NULL,
node_dns1 varchar(100) NOT NULL,
node_dns2 varchar(100) NOT NULL,
subnet_id int(10) NOT NULL,
asset_id int(10) NOT NULL,
node_info text NOT NULL,
PRIMARY KEY (node_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
INSERT INTO node (node_ip, node_mac, subnet_id, asset_id) VALUES
('192.168.1.2', '001122334455', 1, 1),
('192.168.1.1', 'aabbccddeeff', 1, 2);
CREATE TABLE subnet (
subnet_id int(10) NOT NULL auto_increment,
subnet_address varchar(15) NOT NULL,
subnet_mask int(2) NOT NULL,
subnet_info text NOT NULL,
PRIMARY KEY (subnet_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
INSERT INTO subnet (subnet_address, subnet_mask) VALUES
('192.168.0.0', 24);
CREATE TABLE subnetlocation (
subnetlocation_id int(10) NOT NULL auto_increment,
subnet_id int(10) NOT NULL,
location_id int(10) NOT NULL,
PRIMARY KEY (subnetlocation_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
INSERT INTO subnetlocation (subnet_id, location_id) VALUES
(1, 1);
CREATE TABLE subnetvlan (
subnetvlan_id int(10) NOT NULL auto_increment,
subnet_id int(10) NOT NULL,
vlan_id int(10) NOT NULL,
PRIMARY KEY (subnetvlan_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
CREATE TABLE user (
user_id int(10) NOT NULL auto_increment,
user_name varchar(100) NOT NULL,
user_pass varchar(32) NOT NULL,
user_displayname varchar(100) NOT NULL,
user_imagesize int(3) NOT NULL default 6,
user_imagecount int(3) NOT NULL default 64,
user_mac varchar(25) NOT NULL default 'xxxxxxxxxxxx',
user_dateformat varchar(10) NOT NULL default 'd M Y H:i',
user_dns1suffix varchar(100) NOT NULL,
user_dns2suffix varchar(100) NOT NULL,
user_menu_assets varchar(2) NOT NULL default 'on',
user_menu_assetclasses varchar(2) NOT NULL default 'on',
user_menu_assetclassgroups varchar(2) NOT NULL default 'on',
user_menu_locations varchar(2) NOT NULL default 'on',
user_menu_nodes varchar(2) NOT NULL default 'on',
user_menu_subnets varchar(2) NOT NULL default 'on',
user_menu_users varchar(2) NOT NULL default 'on',
user_menu_vlans varchar(2) NOT NULL default 'on',
PRIMARY KEY (user_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
INSERT INTO user (user_name, user_pass, user_displayname, user_imagesize, user_imagecount, user_mac, user_dateformat, user_menu_assets, user_menu_assetclasses, user_menu_assetclassgroups, user_menu_locations, user_menu_nodes, user_menu_subnets, user_menu_users, user_menu_vlans) VALUES
('admin', '21232f297a57a5a743894a0e4a801fc3', 'administrator', 6, 64, 'xxxxxxxxxxxx', 'd M Y H:i', 'on', 'on', 'on', 'on', 'on', 'on', 'on', 'on');
CREATE TABLE vlan (
vlan_id int(10) NOT NULL auto_increment,
vlan_number int(3) NOT NULL,
vlan_name varchar(100) NOT NULL,
vlan_info text NOT NULL,
PRIMARY KEY (vlan_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
INSERT INTO vlan (vlan_number, vlan_name) VALUES
(1, 'DEFAULT_VLAN');
CREATE TABLE asset (
asset_id int(10) NOT NULL AUTO_INCREMENT,
asset_name varchar(100) NOT NULL,
asset_hostname varchar(100) DEFAULT NULL,
assetclass_id int(10) NOT NULL,
asset_info text DEFAULT NULL,
PRIMARY KEY (asset_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO asset (asset_name, assetclass_id) VALUES
('My Computer', 1),
('My Server', 2);
CREATE TABLE assetclass (
assetclass_id int(10) NOT NULL AUTO_INCREMENT,
assetclassgroup_id int(10) NOT NULL,
assetclass_name varchar(100) NOT NULL,
PRIMARY KEY (assetclass_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO assetclass (assetclassgroup_id, assetclass_name) VALUES
(1, 'PC'),
(2, 'Server');
CREATE TABLE assetclassgroup (
assetclassgroup_id int(10) NOT NULL AUTO_INCREMENT,
assetclassgroup_name varchar(100) NOT NULL,
assetclassgroup_color varchar(6) NOT NULL DEFAULT '000000',
PRIMARY KEY (assetclassgroup_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO assetclassgroup (assetclassgroup_name, assetclassgroup_color) VALUES
('Workstations', '000000'),
('Servers', '0000CC');
CREATE TABLE location (
location_id int(10) NOT NULL AUTO_INCREMENT,
location_name varchar(100) NOT NULL,
location_parent int(10) NOT NULL DEFAULT 0,
location_info text DEFAULT NULL,
location_sort int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (location_id),
KEY location_sort (location_sort)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO location (location_name, location_parent) VALUES
('Main Office', 0);
CREATE TABLE nat (
nat_id int(10) NOT NULL AUTO_INCREMENT,
nat_type int(1) NOT NULL,
nat_ext int(10) NOT NULL,
nat_int int(10) NOT NULL,
PRIMARY KEY (nat_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE node (
node_id int(10) NOT NULL AUTO_INCREMENT,
node_ip varchar(45) NOT NULL,
node_mac varchar(12) NOT NULL,
node_dns1 varchar(100) DEFAULT NULL,
node_dns2 varchar(100) DEFAULT NULL,
subnet_id int(10) NOT NULL,
asset_id int(10) NOT NULL,
zone_id int(10) DEFAULT NULL,
node_info text DEFAULT NULL,
node_type enum('v4','v6') NOT NULL DEFAULT 'v4',
PRIMARY KEY (node_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO node (node_ip, node_mac, subnet_id, asset_id) VALUES
('192.168.1.2', '001122334455', 1, 1),
('192.168.1.1', 'aabbccddeeff', 1, 2);
CREATE TABLE subnet (
subnet_id int(10) NOT NULL AUTO_INCREMENT,
subnet_address varchar(45) NOT NULL,
subnet_mask int(2) NOT NULL,
subnet_dhcp_start varchar(15) DEFAULT NULL,
subnet_dhcp_end varchar(15) DEFAULT NULL,
subnet_info text DEFAULT NULL,
protocol_version tinyint(1) NOT NULL DEFAULT 4,
ntp_server varchar(45) DEFAULT NULL,
PRIMARY KEY (subnet_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO subnet (subnet_address, subnet_mask) VALUES
('192.168.0.0', 24);
CREATE TABLE subnetlocation (
subnetlocation_id int(10) NOT NULL AUTO_INCREMENT,
subnet_id int(10) NOT NULL,
location_id int(10) NOT NULL,
PRIMARY KEY (subnetlocation_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE subnetvlan (
subnetvlan_id int(10) NOT NULL AUTO_INCREMENT,
subnet_id int(10) NOT NULL,
vlan_id int(10) NOT NULL,
PRIMARY KEY (subnetvlan_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO subnetvlan (subnet_id, vlan_id) VALUES
(1, 1);
CREATE TABLE user (
user_id int(10) NOT NULL AUTO_INCREMENT,
user_name varchar(100) NOT NULL,
user_pass varchar(32) NOT NULL,
user_displayname varchar(100) NOT NULL,
user_language char(2) NOT NULL DEFAULT 'en',
user_imagesize int(3) NOT NULL DEFAULT 6,
user_imagecount int(3) NOT NULL DEFAULT 64,
user_mac varchar(25) NOT NULL DEFAULT 'xx:xx:xx:xx:xx:xx',
user_dateformat varchar(10) NOT NULL DEFAULT 'd M Y H:i',
user_dns1suffix varchar(100) DEFAULT NULL,
user_dns2suffix varchar(100) DEFAULT NULL,
user_menu_assets varchar(2) NOT NULL DEFAULT 'on',
user_menu_assetclasses varchar(2) NOT NULL DEFAULT 'on',
user_menu_assetclassgroups varchar(2) NOT NULL DEFAULT 'on',
user_menu_locations varchar(2) NOT NULL DEFAULT 'on',
user_menu_nodes varchar(2) NOT NULL DEFAULT 'on',
user_menu_subnets varchar(2) NOT NULL DEFAULT 'on',
user_menu_users varchar(2) NOT NULL DEFAULT 'on',
user_menu_vlans varchar(2) NOT NULL DEFAULT 'on',
user_menu_zones varchar(2) NOT NULL DEFAULT 'on',
user_tooltips varchar(2) NOT NULL DEFAULT 'on',
PRIMARY KEY (user_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO user (user_name, user_pass, user_displayname, user_imagesize, user_imagecount, user_mac, user_dateformat, user_menu_assets, user_menu_assetclasses, user_menu_assetclassgroups, user_menu_locations, user_menu_nodes, user_menu_subnets, user_menu_users, user_menu_vlans) VALUES
('admin', '21232f297a57a5a743894a0e4a801fc3', 'administrator', 6, 64, 'xxxxxxxxxxxx', 'd M Y H:i', 'on', 'on', 'on', 'on', 'on', 'on', 'on', 'on');
CREATE TABLE vlan (
vlan_id int(10) NOT NULL AUTO_INCREMENT,
vlan_number int(3) NOT NULL,
vlan_name varchar(100) NOT NULL,
vlan_info text DEFAULT NULL,
PRIMARY KEY (vlan_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO vlan (vlan_number, vlan_name) VALUES
(1, 'DEFAULT_VLAN');
CREATE TABLE zone (
zone_id int(10) NOT NULL AUTO_INCREMENT,
zone_soa varchar(40) CHARACTER SET utf8 NOT NULL,
zone_hostmaster varchar(40) CHARACTER SET utf8 NOT NULL,
zone_origin varchar(40) CHARACTER SET utf8 NOT NULL,
zone_ttl_default varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '3D',
zone_refresh varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '8H',
zone_retry varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '2H',
zone_expire varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '4W',
zone_ttl varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '1D',
zone_serial int(10) unsigned NOT NULL,
zone_ns1 varchar(20) CHARACTER SET utf8 NOT NULL,
zone_ns2 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
zone_ns3 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
zone_mx1 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
zone_mx2 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
zone_info text CHARACTER SET utf8 DEFAULT NULL,
PRIMARY KEY (zone_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO zone (zone_soa, zone_origin, zone_hostmaster, zone_serial, zone_ns1) VALUES
('ns1.example.com.', 'example.com.', 'hostmaster@example.com', '2023021301', 'ns1.example.com');