

CREATE TABLE IF NOT EXISTS `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nick` varchar(32) NOT NULL,
  `pass` varchar(32) NOT NULL,
  `pass_time` int(11) DEFAULT '0',
  `sess` varchar(32) DEFAULT NULL,
  `activation` varchar(32) DEFAULT NULL,
  `ban` int(11) NOT NULL DEFAULT '0',
  `ban_pr` varchar(64) DEFAULT NULL,
  `ip` bigint(20) NOT NULL DEFAULT '0',
  `ip_cl` bigint(20) NOT NULL DEFAULT '0',
  `ip_xff` bigint(20) NOT NULL DEFAULT '0',
  `ua` varchar(32) DEFAULT NULL,
  `browser` varchar(3) DEFAULT 'wap',
  `region` varchar(32) NOT NULL,
  `add_konts` enum('0','1','2') NOT NULL default '1',
  `date_reg` int(11) NOT NULL DEFAULT '0',
  `date_aut` int(11) NOT NULL DEFAULT '0',
  `date_last` int(11) NOT NULL DEFAULT '0',
  `sort` int(1) DEFAULT '0',
  `forum_url` varchar(100) not null,
  `diary_desc` text,
  `diary_time` int(11) DEFAULT NULL,
  `diary_text` varchar(10024) DEFAULT NULL,
  `ncolor` varchar(10) NOT NULL,
  `ncolor2` varchar(10) NOT NULL,
  `adm_set` enum('1','2') DEFAULT '1',
  `do_cmpl` enum('1','0') DEFAULT '1',
  `do_cmpl_diary` enum('1','0') DEFAULT '1',
  `online` varchar(7) DEFAULT 'online',
  `write_diary` enum('1','0') DEFAULT '1',
  `money` int(11) NOT NULL DEFAULT '0',
  `activity` int(11) NOT NULL DEFAULT '0',
  `rating` int(11) NOT NULL DEFAULT '0',
  `panel` int(2) DEFAULT '11',
  `viewing` int(11) NOT NULL DEFAULT '0',
  `wall_password` mediumtext,
  `wall_access` enum('all','only_me','friends','pass','auth') DEFAULT 'all',
  `wall_komm` enum('all','only_me','friends') DEFAULT 'all',
  `wall_nokomm` enum('0','1') NOT NULL DEFAULT '1',
  `profile_access` enum('all','only_me','friends','pass') DEFAULT 'all',
  `profile_password` varchar(128) DEFAULT NULL,
  `anketa_password` varchar(128) DEFAULT NULL,
  `anketa_access` enum('all','only_me','friends','pass') DEFAULT 'all',
  `friends_access` enum('all','only_me','friends','pass') DEFAULT 'all',
  `friends_password` varchar(128) DEFAULT NULL,
  `friendship` enum('0','1') NOT NULL DEFAULT '0',
  `level` enum('0','1','2','3','4') NOT NULL DEFAULT '0',
  `group_access` int(10) unsigned NOT NULL DEFAULT '0',
  `sex` enum('0','1') NOT NULL DEFAULT '1',
  `url` varchar(64) NOT NULL DEFAULT '/',
  `show_foot` enum('on','off') DEFAULT 'on',
  `ank_iq` int(11) NOT NULL,
  `ank_g_r` int(4) DEFAULT NULL,
  `ank_m_r` int(2) DEFAULT NULL,
  `ank_d_r` int(2) DEFAULT NULL,
  `ank_city` varchar(32) DEFAULT NULL,
  `ank_about_me` varchar(512) DEFAULT NULL,
  `ank_icq` int(9) DEFAULT NULL,
  `ank_mail` varchar(32) DEFAULT NULL,
  `ank_n_tel` varchar(12) DEFAULT NULL,
  `ank_n_tel_home` varchar(12) DEFAULT NULL,
  `welcome` varchar(150) NOT NULL DEFAULT '',
  `user_url` varchar(20) NOT NULL DEFAULT 'u-s-er12_453_00-4',
  `ank_name` varchar(32) default NULL,
  `ank_surname` varchar(50) DEFAULT NULL,
  `ank_patronymic` varchar(50) DEFAULT NULL,
  `ank_goal_dating` enum('0','1') NOT NULL DEFAULT '0',
  `ank_goal_dating2` enum('0','1') NOT NULL DEFAULT '0',
  `ank_goal_dating3` enum('0','1') NOT NULL DEFAULT '0',
  `ank_goal_dating4` enum('0','1') NOT NULL DEFAULT '0',
  `ank_goal_dating5` enum('0','1') NOT NULL DEFAULT '0',
  `ank_goal_dating6` enum('0','1') NOT NULL DEFAULT '0',
  `ank_goal_dating7` enum('0','1') NOT NULL DEFAULT '0',
  `ank_goal_dating8` enum('0','1') NOT NULL DEFAULT '0',
  `ank_political` enum('0','1','2','3','4','5','6','7','8','9') NOT NULL DEFAULT '0',
  `ank_world_view` enum('0','1','2','3','4','5','6','7','8','9') NOT NULL DEFAULT '0',
  `ank_important_life` enum('0','1','2','3','4','5','6','7','8') NOT NULL DEFAULT '0',
  `ank_important_people` enum('0','1','2','3','4','5','6') NOT NULL DEFAULT '0',
  `ank_smoking` enum('0','1','2','3','4','5') NOT NULL DEFAULT '0',
  `ank_alcohol` enum('0','1','2','3','4','5') NOT NULL DEFAULT '0',
  `ank_inspiration` varchar(512) NOT NULL,
  `ank_marriage` enum('0','1','2','3','4','5','6','7','8','9','10','11','12') NOT NULL DEFAULT '0',
  `ank_orientation` enum('0','1','2','3') NOT NULL DEFAULT '0',
  `ank_hair` varchar(512) NOT NULL,
  `ank_eye` varchar(512) NOT NULL,
  `ank_height` varchar(512) NOT NULL,
  `ank_weight` varchar(512) NOT NULL,
  `ank_physique` enum('0','1','2','3','4','5','6') NOT NULL DEFAULT '0',
  `ank_activities` varchar(32) NOT NULL,
  `ank_music` varchar(512) NOT NULL,
  `ank_teleshow` varchar(512) NOT NULL,
  `ank_games` varchar(512) NOT NULL,
  `ank_citates` varchar(512) NOT NULL,
  `ank_films` varchar(512) NOT NULL,
  `ank_books` varchar(512) NOT NULL,
  `ank_course` varchar(512) NOT NULL,
  `ank_passion` varchar(512) NOT NULL,
  `ank_profession` varchar(512) NOT NULL,
  `colorbp` varchar(16) NOT NULL DEFAULT 'fff',
  `colorbs` varchar(16) NOT NULL DEFAULT '282b36',
  `colornp` varchar(16) NOT NULL,
  `colorfp` varchar(16) NOT NULL DEFAULT '282b36',
  `colorlp` varchar(16) NOT NULL DEFAULT 'ffffff',
  `color_count` varchar(16) NOT NULL DEFAULT 'd1d9e0',
  `color_counts` varchar(16) NOT NULL DEFAULT '5b6e85',
  `color_blok` varchar(16) NOT NULL DEFAULT 'fff',
  `color_blok_border` varchar(16) NOT NULL DEFAULT 'ddd',
  `country` varchar(32) NOT NULL,
  `profileCover` int(11) DEFAULT '0',
  `time_on` int(11) NOT NULL,
  `icon_size` enum('0','1','2') DEFAULT '0',
  `set_time_chat` int(11) DEFAULT '30',
  `set_news_comments` enum('0','1') DEFAULT '1',
  `set_forum` enum('0','1') DEFAULT '1',
  `set_diary` enum('0','1') DEFAULT '1',
  `set_online` enum('0','1','2','3','4','5') DEFAULT '1',
  `set_online_view` enum('1','2','3','4','5') DEFAULT '1',
  `set_online_size` int(11) DEFAULT '36',
  `set_mail` enum('1','2') DEFAULT '1',
  `set_p_str` int(11) DEFAULT '7',
  `set_chat_str` int(11) DEFAULT '7',
  `set_them_forum_num` int(11) DEFAULT '3',
  `set_them_diary_num` int(11) DEFAULT '3',
  `set_times` enum('1','0') NOT NULL DEFAULT '1',
  `set_files` enum('0','1') NOT NULL DEFAULT '0',
  `set_files_include` enum('0','1') NOT NULL DEFAULT '0',
  `set_timesdvig` int(11) NOT NULL DEFAULT '0',
  `set_news_to_mail` enum('0','1') NOT NULL DEFAULT '0',
  `set_show_mail` enum('0','1') NOT NULL DEFAULT '0',
  `set_menu` enum('1','0') DEFAULT '1',
  `set_search` enum('1','0') DEFAULT '1',
  `set_profile` enum('1','0') DEFAULT '1',
  `set_news` enum('1','2') DEFAULT '1',
  `set_chat` enum('1','0') DEFAULT '1',
  `meteo_country` int(11) NOT NULL DEFAULT '0',
  `autorization` enum('0','1') NOT NULL DEFAULT '0',
  `time` int(11) NOT NULL,
  `perehodu` int(11) NOT NULL,
  `lang` varchar(32) DEFAULT 'ru',
  `hash` varchar(99) DEFAULT NULL,
  `hash_set` text,
  PRIMARY KEY (`id`),
  UNIQUE KEY `nick` (`nick`),
  KEY `url` (`url`)
) ENGINE=MYISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `user_set` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_user` int(11) NOT NULL,
  `privat_mail` int(11) DEFAULT '1',
  `email_on` int(1) DEFAULT '1',
  `email_spam` int(1) DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE `user_collision` (
  `id_user` int(11) NOT NULL,
  `id_user2` int(11) NOT NULL,
  `type` set('sess','ip_ua_time') NOT NULL default 'sess',
  KEY `id_user` (`id_user`,`id_user2`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `user_group` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(32) NOT NULL,
  `level` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

INSERT INTO `user_group` (`id`, `name`, `level`) VALUES
(1, 'Пользователь', 0),
(2, 'Администратор', 9),
(15, 'Создатель', 10);


CREATE TABLE IF NOT EXISTS `user_group_access` (
  `id_group` int(10) unsigned NOT NULL,
  `id_access` varchar(32) NOT NULL,
  KEY `id_group` (`id_group`,`id_access`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `user_group_access` (`id_group`, `id_access`) VALUES
(15, 'adm_games'),
(15, 'adm_accesses'),
(15, 'adm_banlist'),
(15, 'adm_ban_ip'),
(15, 'adm_changelog'),
(15, 'adm_chmod'),
(15, 'adm_conf_server'),
(15, 'adm_forum_sinc'),
(15, 'adm_info'),
(15, 'adm_ip_edit'),
(15, 'adm_log_delete'),
(15, 'adm_log_read'),
(15, 'adm_menu'),
(15, 'adm_mysql'),
(15, 'adm_news'),
(15, 'adm_news_add'),
(15, 'adm_news_delete'),
(15, 'adm_news_delete_comments'),
(15, 'adm_news_edit'),
(15, 'adm_panel_show'),
(15, 'adm_profile'),
(15, 'adm_ref'),
(15, 'adm_rekl'),
(15, 'adm_rekl_black_list'),
(15, 'adm_send_mess'),
(15, 'adm_send_money'),
(15, 'adm_send_not'),
(15, 'adm_set_foto'),
(15, 'adm_set_loads'),
(15, 'adm_set_sys'),
(15, 'adm_set_user'),
(15, 'adm_show_adm'),
(15, 'adm_statistic'),
(15, 'adm_themes'),
(15, 'adm_umenu'),
(15, 'adm_cron'),
(15, 'mini_chat_clear'),
(15, 'forum_for_create'),
(15, 'forum_for_delete'),
(15, 'forum_for_edit'),
(15, 'forum_post_close'),
(15, 'forum_post_ed'),
(15, 'forum_razd_create'),
(15, 'forum_razd_edit'),
(15, 'forum_them_del'),
(15, 'forum_them_edit'),
(15, 'foto_alb_del'),
(15, 'foto_foto_edit'),
(15, 'foto_foto_komm_del'),
(15, 'guest_show_ip'),
(15, 'obmen_dir_create'),
(15, 'obmen_dir_delete'),
(15, 'obmen_dir_edit'),
(15, 'obmen_file_delete'),
(15, 'obmen_komm_del'),
(15, 'loads'),
(15, 'loads_file'),
(15, 'loads_dir_create'),
(15, 'loads_dir_delete'),
(15, 'loads_dir_mesto'),
(15, 'loads_dir_rename'),
(15, 'loads_file_delete'),
(15, 'loads_file_edit'),
(15, 'loads_file_scr'),
(15, 'loads_file_scrr'),
(15, 'loads_file_scrg'),
(15, 'loads_file_scrj'),
(15, 'loads_file_scrp'),
(15, 'loads_file_import'),
(15, 'loads_file_upload'),
(15, 'loads_unzip'),
(15, 'user_group'),
(15, 'user_ban_set'),
(15, 'user_ban_set_h'),
(15, 'user_ban_unset'),
(15, 'user_change_group'),
(15, 'user_change_nick'),
(15, 'user_collisions'),
(15, 'user_delete'),
(15, 'user_mass_delete'),
(15, 'user_prof_edit'),
(15, 'user_show_add_info'),
(15, 'user_show_ip'),
(15, 'user_show_ua');


CREATE TABLE IF NOT EXISTS `user_ref` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `time` int(10) unsigned NOT NULL,
  `id_user` int(10) unsigned NOT NULL,
  `url` varchar(1024) DEFAULT NULL,
  `type_input` varchar(12) DEFAULT 'cookie',
  PRIMARY KEY (`id`),
  KEY `time` (`time`,`id_user`),
  KEY `type_input` (`type_input`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `user_referals` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `id_ref` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `user_log` (
  `id` int(11) NOT NULL auto_increment,
  `id_user` int(11) NOT NULL ,
  `method` set('1','0') NOT NULL default '0',
  `time` int(11) NOT NULL ,
  `ip` bigint(20) NOT NULL default '0',
  `ua` varchar(32) default NULL,
  PRIMARY KEY  (`id`),
  KEY `id_user` (`id_user`),
  KEY `time` (`time`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `user_icon` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_user` int(11) NOT NULL,
  `id_icon` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `user_voice2` (
  `id_user` int(11) NOT NULL,
  `id_kont` int(11) NOT NULL,
  `rating` int(11) NOT NULL default '0',
  KEY `id_user` (`id_user`,`id_kont`),
  KEY `rating` (`rating`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `user_blacklist` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_user` int(11) NOT NULL,
  `id_ank` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  `time_to` int(11) NOT NULL,
  `msg` varchar(1024) NOT NULL,
  `forever` set('0','1') NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

