<?php
/*
 ########################################################################
#                                                                        #
#           Version 4       /                        /   /               #
#          -----------__---/__---__------__----__---/---/-               #
#           | /| /  /___) /   ) (_ `   /   ) /___) /   /                 #
#          _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___               #
#                       Free Content / Management System                 #
#                                   /                                    #
#                                                                        #
#                                                                        #
#   Copyright 2005-2006 by webspell.org                                  #
#                                                                        #
#   visit webSPELL.org, webspell.info to get webSPELL for free           #
#   - Script runs under the GNU GENERAL PUBLIC LICENSE                   #
#   - It's NOT allowed to remove this copyright-tag                      #
#   -- http://www.fsf.org/licensing/licenses/gpl.html                    #
#                                                                        #
#   Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at),   #
#   Far Development by Development Team - webspell.org                   #
#                                                                        #
#   visit webspell.org                                                   #
#                                                                        #
 ########################################################################
*/

function fullinstall() {

global $adminname;
global $adminpassword;
global $adminmail;
global $url;

mysql_query("DROP TABLE IF EXISTS `".PREFIX."about`");
mysql_query("CREATE TABLE `".PREFIX."about` (
  `about` longtext NOT NULL
)");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."articles`");
mysql_query("CREATE TABLE `".PREFIX."articles` (
  `articlesID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `title` varchar(255) NOT NULL default '',
  `content` text NOT NULL,
  `screens` text NOT NULL,
  `poster` int(11) NOT NULL default '0',
  `link1` varchar(255) NOT NULL default '',
  `url1` varchar(255) NOT NULL default '',
  `window1` int(1) NOT NULL default '0',
  `link2` varchar(255) NOT NULL default '',
  `url2` varchar(255) NOT NULL default '',
  `window2` int(1) NOT NULL default '0',
  `link3` varchar(255) NOT NULL default '',
  `url3` varchar(255) NOT NULL default '',
  `window3` int(1) NOT NULL default '0',
  `link4` varchar(255) NOT NULL default '',
  `url4` varchar(255) NOT NULL default '',
  `window4` int(1) NOT NULL default '0',
  `votes` int(11) NOT NULL default '0',
  `points` int(11) NOT NULL default '0',
  `rating` int(11) NOT NULL default '0',
  `saved` int(1) NOT NULL default '0',
  `viewed` int(11) NOT NULL default '0',
  `comments` int(1) NOT NULL default '0',
  PRIMARY KEY  (`articlesID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."awards`");
mysql_query("CREATE TABLE `".PREFIX."awards` (
  `awardID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `squadID` int(11) NOT NULL default '0',
  `award` varchar(255) NOT NULL default '',
  `homepage` varchar(255) NOT NULL default '',
  `rang` int(11) NOT NULL default '0',
  `info` text NOT NULL,
  PRIMARY KEY  (`awardID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."banner`");
mysql_query("CREATE TABLE `".PREFIX."banner` (
  `bannerID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL default '',
  `url` varchar(255) NOT NULL default '',
  `banner` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`bannerID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."buddys`");
mysql_query("CREATE TABLE `".PREFIX."buddys` (
  `buddyID` int(11) NOT NULL AUTO_INCREMENT,
  `userID` int(11) NOT NULL default '0',
  `buddy` int(11) NOT NULL default '0',
  `banned` int(1) NOT NULL default '0',
  PRIMARY KEY  (`buddyID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."cash_box`");
mysql_query("CREATE TABLE `".PREFIX."cash_box` (
  `cashID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `paydate` int(14) NOT NULL default '0',
  `usedfor` text NOT NULL,
  `info` text NOT NULL,
  `totalcosts` double(8,2) NOT NULL default '0.00',
  `usercosts` double(8,2) NOT NULL default '0.00',
  `squad` int(11) NOT NULL default '0',
  `konto` text NOT NULL,
  PRIMARY KEY  (`cashID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."cash_box_payed`");
mysql_query("CREATE TABLE `".PREFIX."cash_box_payed` (
  `payedID` int(11) NOT NULL AUTO_INCREMENT,
  `cashID` int(11) NOT NULL default '0',
  `userID` int(11) NOT NULL default '0',
  `costs` double(8,2) NOT NULL default '0.00',
  `date` int(14) NOT NULL default '0',
  `payed` int(1) NOT NULL default '0',
  PRIMARY KEY  (`payedID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."challenge`");
mysql_query("CREATE TABLE `".PREFIX."challenge` (
  `chID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `cwdate` int(14) NOT NULL default '0',
  `squadID` varchar(255) NOT NULL default '',
  `opponent` varchar(255) NOT NULL default '',
  `opphp` varchar(255) NOT NULL default '',
  `oppcountry` char(2) NOT NULL default '',
  `league` varchar(255) NOT NULL default '',
  `map` varchar(255) NOT NULL default '',
  `server` varchar(255) NOT NULL default '',
  `email` varchar(255) NOT NULL default '',
  `info` text NOT NULL,
  PRIMARY KEY  (`chID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."clanwars`");
mysql_query("CREATE TABLE `".PREFIX."clanwars` (
  `cwID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `squad` int(11) NOT NULL default '0',
  `game` varchar(5) NOT NULL default '',
  `league` varchar(255) NOT NULL default '',
  `leaguehp` varchar(255) NOT NULL default '',
  `opponent` varchar(255) NOT NULL default '',
  `opptag` varchar(255) NOT NULL default '',
  `oppcountry` char(2) NOT NULL default '',
  `opphp` varchar(255) NOT NULL default '',
  `maps` varchar(255) NOT NULL default '',
  `hometeam` varchar(255) NOT NULL default '',
  `oppteam` varchar(255) NOT NULL default '',
  `server` varchar(255) NOT NULL default '',
  `homescr1` int(11) NOT NULL default '0',
  `oppscr1` int(11) NOT NULL default '0',
  `homescr2` int(11) NOT NULL default '0',
  `oppscr2` int(11) NOT NULL default '0',
  `screens` text NOT NULL,
  `report` text NOT NULL,
  `comments` int(1) NOT NULL default '0',
  `linkpage` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`cwID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."comments`");
mysql_query("CREATE TABLE `".PREFIX."comments` (
  `commentID` int(11) NOT NULL AUTO_INCREMENT,
  `parentID` int(11) NOT NULL default '0',
  `type` char(2) NOT NULL default '',
  `userID` int(11) NOT NULL default '0',
  `nickname` varchar(255) NOT NULL default '',
  `date` int(14) NOT NULL default '0',
  `comment` text NOT NULL,
  `url` varchar(255) NOT NULL default '',
  `email` varchar(255) NOT NULL default '',
  `ip` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`commentID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."counter`");
mysql_query("CREATE TABLE `".PREFIX."counter` (
  `hits` int(20) NOT NULL default '0',
  `online` int(14) NOT NULL default '0'
) TYPE=MyISAM");

mysql_query("INSERT IGNORE INTO `".PREFIX."counter` (`hits`, `online`) VALUES (1, '".time()."')");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."counter_iplist`");
mysql_query("CREATE TABLE `".PREFIX."counter_iplist` (
  `dates` varchar(255) NOT NULL default '',
  `del` int(20) NOT NULL default '0',
  `ip` varchar(255) NOT NULL default ''
) TYPE=MyISAM");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."counter_stats`");
mysql_query("CREATE TABLE `".PREFIX."counter_stats` (
  `dates` varchar(255) NOT NULL default '',
  `count` int(20) NOT NULL default '0'
) TYPE=MyISAM");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."demos`");
mysql_query("CREATE TABLE `".PREFIX."demos` (
  `demoID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `game` varchar(255) NOT NULL default '',
  `clan1` varchar(255) NOT NULL default '',
  `clan2` varchar(255) NOT NULL default '',
  `clantag1` varchar(255) NOT NULL default '',
  `clantag2` varchar(255) NOT NULL default '',
  `url1` varchar(255) NOT NULL default '',
  `url2` varchar(255) NOT NULL default '',
  `country1` char(2) NOT NULL default '',
  `country2` char(2) NOT NULL default '',
  `league` varchar(255) NOT NULL default '',
  `leaguehp` varchar(255) NOT NULL default '',
  `maps` varchar(255) NOT NULL default '',
  `player` varchar(255) NOT NULL default '',
  `file` varchar(255) NOT NULL default '',
  `downloads` int(11) NOT NULL default '0',
  `votes` int(11) NOT NULL default '0',
  `points` int(11) NOT NULL default '0',
  `rating` int(11) NOT NULL default '0',
  `comments` int(1) NOT NULL default '0',
  `accesslevel` int(1) NOT NULL default '0',
  PRIMARY KEY  (`demoID`)
) AUTO_INCREMENT=1 ");


mysql_query("DROP TABLE IF EXISTS `".PREFIX."files`");
mysql_query("CREATE TABLE `".PREFIX."files` (
  `fileID` int(11) NOT NULL AUTO_INCREMENT,
  `filecatID` int(11) NOT NULL default '0',
  `date` int(14) NOT NULL default '0',
  `filename` varchar(255) NOT NULL default '',
  `filesize` varchar(255) NOT NULL default '',
  `info` varchar(255) NOT NULL default '',
  `file` varchar(255) NOT NULL default '',
  `downloads` int(11) NOT NULL default '0',
  `accesslevel` int(1) NOT NULL default '0',
  PRIMARY KEY  (`fileID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."files_categorys`");
mysql_query("CREATE TABLE `".PREFIX."files_categorys` (
  `filecatID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`filecatID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."forum_announcements`");
mysql_query("CREATE TABLE `".PREFIX."forum_announcements` (
  `announceID` int(11) NOT NULL AUTO_INCREMENT,
  `boardID` int(11) NOT NULL default '0',
  `intern` int(1) NOT NULL default '0',
  `userID` int(11) NOT NULL default '0',
  `date` int(14) NOT NULL default '0',
  `topic` varchar(255) NOT NULL default '',
  `announcement` text NOT NULL,
  PRIMARY KEY  (`announceID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."forum_boards`");
mysql_query("CREATE TABLE `".PREFIX."forum_boards` (
  `boardID` int(11) NOT NULL AUTO_INCREMENT,
  `category` int(11) NOT NULL default '0',
  `name` varchar(255) NOT NULL default '',
  `info` varchar(255) NOT NULL default '',
  `intern` int(1) NOT NULL default '0',
  `sort` int(2) NOT NULL default '0',
  PRIMARY KEY  (`boardID`)
) AUTO_INCREMENT=3 ");

mysql_query("INSERT IGNORE INTO `".PREFIX."forum_boards` (`boardID`, `category`, `name`, `info`, `intern`, `sort`) VALUES (1, 1, 'Main Board', 'The general public board', 0, 1)");
mysql_query("INSERT IGNORE INTO `".PREFIX."forum_boards` (`boardID`, `category`, `name`, `info`, `intern`, `sort`) VALUES (2, 2, 'Main Board', 'The general intern board', 1, 1)");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."forum_categories`");
mysql_query("CREATE TABLE `".PREFIX."forum_categories` (
  `catID` int(11) NOT NULL AUTO_INCREMENT,
  `intern` int(1) NOT NULL default '0',
  `name` varchar(255) NOT NULL default '',
  `info` varchar(255) NOT NULL default '',
  `sort` int(11) NOT NULL default '0',
  PRIMARY KEY  (`catID`)
) AUTO_INCREMENT=3 ");

mysql_query("INSERT IGNORE INTO `".PREFIX."forum_categories` (`catID`, `intern`, `name`, `info`, `sort`) VALUES (1, 0, 'Public Boards', '', 2)");
mysql_query("INSERT IGNORE INTO `".PREFIX."forum_categories` (`catID`, `intern`, `name`, `info`, `sort`) VALUES (2, 1, 'Intern Boards', '', 3)");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."forum_moderators`");
mysql_query("CREATE TABLE `".PREFIX."forum_moderators` (
  `modID` int(11) NOT NULL AUTO_INCREMENT,
  `boardID` int(11) NOT NULL default '0',
  `userID` int(11) NOT NULL default '0',
  PRIMARY KEY  (`modID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."forum_notify`");
mysql_query("CREATE TABLE `".PREFIX."forum_notify` (
  `notifyID` int(11) NOT NULL AUTO_INCREMENT,
  `topicID` int(11) NOT NULL default '0',
  `userID` int(11) NOT NULL default '0',
  PRIMARY KEY  (`notifyID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."forum_posts`");
mysql_query("CREATE TABLE `".PREFIX."forum_posts` (
  `postID` int(11) NOT NULL AUTO_INCREMENT,
  `boardID` int(11) NOT NULL default '0',
  `topicID` int(11) NOT NULL default '0',
  `date` int(14) NOT NULL default '0',
  `poster` int(11) NOT NULL default '0',
  `message` text NOT NULL,
  PRIMARY KEY  (`postID`)
) AUTO_INCREMENT=1 ");


mysql_query("DROP TABLE IF EXISTS `".PREFIX."forum_ranks`");
mysql_query("CREATE TABLE `".PREFIX."forum_ranks` (
  `rankID` int(11) NOT NULL AUTO_INCREMENT,
  `rank` varchar(255) NOT NULL default '',
  `pic` varchar(255) NOT NULL default '',
  `postmin` int(11) NOT NULL default '0',
  `postmax` int(11) NOT NULL default '0',
  PRIMARY KEY  (`rankID`)
) AUTO_INCREMENT=9 ");

mysql_query("INSERT IGNORE INTO `".PREFIX."forum_ranks` (`rankID`, `rank`, `pic`, `postmin`, `postmax`) VALUES (1, 'Rank 1', 'rank1.gif', 0, 9)");
mysql_query("INSERT IGNORE INTO `".PREFIX."forum_ranks` (`rankID`, `rank`, `pic`, `postmin`, `postmax`) VALUES (2, 'Rank 2', 'rank2.gif', 10, 24)");
mysql_query("INSERT IGNORE INTO `".PREFIX."forum_ranks` (`rankID`, `rank`, `pic`, `postmin`, `postmax`) VALUES (3, 'Rank 3', 'rank3.gif', 25, 49)");
mysql_query("INSERT IGNORE INTO `".PREFIX."forum_ranks` (`rankID`, `rank`, `pic`, `postmin`, `postmax`) VALUES (4, 'Rank 4', 'rank4.gif', 50, 199)");
mysql_query("INSERT IGNORE INTO `".PREFIX."forum_ranks` (`rankID`, `rank`, `pic`, `postmin`, `postmax`) VALUES (5, 'Rank 5', 'rank5.gif', 200, 399)");
mysql_query("INSERT IGNORE INTO `".PREFIX."forum_ranks` (`rankID`, `rank`, `pic`, `postmin`, `postmax`) VALUES (6, 'Rank 6', 'rank6.gif', 400, 2147483647)");
mysql_query("INSERT IGNORE INTO `".PREFIX."forum_ranks` (`rankID`, `rank`, `pic`, `postmin`, `postmax`) VALUES (7, 'Administrator', 'admin.gif', 0, 0)");
mysql_query("INSERT IGNORE INTO `".PREFIX."forum_ranks` (`rankID`, `rank`, `pic`, `postmin`, `postmax`) VALUES (8, 'Moderator', 'moderator.gif', 0, 0)");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."forum_topics`");
mysql_query("CREATE TABLE `".PREFIX."forum_topics` (
  `topicID` int(11) NOT NULL AUTO_INCREMENT,
  `boardID` int(11) NOT NULL default '0',
  `icon` varchar(255) NOT NULL default '',
  `intern` int(1) NOT NULL default '0',
  `userID` int(11) NOT NULL default '0',
  `date` int(14) NOT NULL default '0',
  `topic` varchar(255) NOT NULL default '',
  `lastdate` int(14) NOT NULL default '0',
  `lastposter` int(11) NOT NULL default '0',
  `replys` int(11) NOT NULL default '0',
  `views` int(11) NOT NULL default '0',
  `closed` int(1) NOT NULL default '0',
  `moveID` int(11) NOT NULL default '0',
  PRIMARY KEY  (`topicID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."games`");
mysql_query("CREATE TABLE `".PREFIX."games` (
  `gameID` int(3) NOT NULL AUTO_INCREMENT,
  `tag` varchar(5) NOT NULL default '',
  `name` varchar(20) NOT NULL default '',
  PRIMARY KEY  (`gameID`)
) PACK_KEYS=0 AUTO_INCREMENT=8 ");

mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (1, 'cs', 'Counter-Strike')");
mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (2, 'ut', 'Unreal Tournament')");
mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (3, 'to', 'Tactical Ops')");
mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (4, 'hl2', 'Halflife 2')");
mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (5, 'wc3', 'Warcraft 3')");
mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (6, 'hl', 'Halflife')");
mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (7, 'bf', 'Battlefield')");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."guestbook`");
mysql_query("CREATE TABLE `".PREFIX."guestbook` (
  `gbID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `name` varchar(255) NOT NULL default '',
  `email` varchar(255) NOT NULL default '',
  `hp` varchar(255) NOT NULL default '',
  `icq` varchar(255) NOT NULL default '',
  `ip` varchar(255) NOT NULL default '',
  `comment` text NOT NULL,
  PRIMARY KEY  (`gbID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."history`");
mysql_query("CREATE TABLE `".PREFIX."history` (
  `history` text NOT NULL
) TYPE=MyISAM");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."links`");
mysql_query("CREATE TABLE `".PREFIX."links` (
  `linkID` int(11) NOT NULL AUTO_INCREMENT,
  `linkcatID` int(11) NOT NULL default '0',
  `name` varchar(255) NOT NULL default '',
  `url` varchar(255) NOT NULL default '',
  `info` varchar(255) NOT NULL default '',
  `banner` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`linkID`)
) AUTO_INCREMENT=2 ");

mysql_query("INSERT IGNORE INTO `".PREFIX."links` (`linkID`, `linkcatID`, `name`, `url`, `info`, `banner`) VALUES (1, 1, 'webSPELL.org', 'http://www.webspell.org', 'webspell.org: Webdesign und Webdevelopment', '1.gif')");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."links_categorys`");
mysql_query("CREATE TABLE `".PREFIX."links_categorys` (
  `linkcatID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`linkcatID`)
) AUTO_INCREMENT=2 ");

mysql_query("INSERT IGNORE INTO `".PREFIX."links_categorys` (`linkcatID`, `name`) VALUES (1, 'Webdesign')");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."linkus`");
mysql_query("CREATE TABLE `".PREFIX."linkus` (
  `bannerID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL default '',
  `file` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`bannerID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."messenger`");
mysql_query("CREATE TABLE `".PREFIX."messenger` (
  `messageID` int(11) NOT NULL AUTO_INCREMENT,
  `userID` int(11) NOT NULL default '0',
  `date` int(14) NOT NULL default '0',
  `fromuser` int(11) NOT NULL default '0',
  `touser` int(11) NOT NULL default '0',
  `title` varchar(255) NOT NULL default '',
  `message` text NOT NULL,
  `viewed` int(11) NOT NULL default '0',
  PRIMARY KEY  (`messageID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."news`");
mysql_query("CREATE TABLE `".PREFIX."news` (
  `newsID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `rubric` int(11) NOT NULL default '0',
  `lang1` char(2) NOT NULL default '',
  `headline1` varchar(255) NOT NULL default '',
  `content1` text NOT NULL,
  `lang2` char(2) NOT NULL default '',
  `headline2` varchar(255) NOT NULL default '',
  `content2` text NOT NULL,
  `screens` text NOT NULL,
  `poster` int(11) NOT NULL default '0',
  `link1` varchar(255) NOT NULL default '',
  `url1` varchar(255) NOT NULL default '',
  `window1` int(11) NOT NULL default '0',
  `link2` varchar(255) NOT NULL default '',
  `url2` varchar(255) NOT NULL default '',
  `window2` int(11) NOT NULL default '0',
  `link3` varchar(255) NOT NULL default '',
  `url3` varchar(255) NOT NULL default '',
  `window3` int(11) NOT NULL default '0',
  `link4` varchar(255) NOT NULL default '',
  `url4` varchar(255) NOT NULL default '',
  `window4` int(11) NOT NULL default '0',
  `saved` int(1) NOT NULL default '1',
  `published` int(11) NOT NULL default '0',
  `comments` int(1) NOT NULL default '0',
  `cwID` int(11) NOT NULL default '0',
  PRIMARY KEY  (`newsID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."news_languages`");
mysql_query("CREATE TABLE `".PREFIX."news_languages` (
  `langID` int(11) NOT NULL AUTO_INCREMENT,
  `language` varchar(255) NOT NULL default '',
  `lang` char(2) NOT NULL default '',
  `alt` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`langID`)
) AUTO_INCREMENT=12 ");

mysql_query("INSERT IGNORE INTO `".PREFIX."news_languages` (`langID`, `language`, `lang`, `alt`) VALUES (1, 'danish', 'dk', 'danish')");
mysql_query("INSERT IGNORE INTO `".PREFIX."news_languages` (`langID`, `language`, `lang`, `alt`) VALUES (2, 'dutch', 'nl', 'dutch')");
mysql_query("INSERT IGNORE INTO `".PREFIX."news_languages` (`langID`, `language`, `lang`, `alt`) VALUES (3, 'english', 'uk', 'english')");
mysql_query("INSERT IGNORE INTO `".PREFIX."news_languages` (`langID`, `language`, `lang`, `alt`) VALUES (4, 'finnish', 'fi', 'finnish')");
mysql_query("INSERT IGNORE INTO `".PREFIX."news_languages` (`langID`, `language`, `lang`, `alt`) VALUES (5, 'french', 'fr', 'french')");
mysql_query("INSERT IGNORE INTO `".PREFIX."news_languages` (`langID`, `language`, `lang`, `alt`) VALUES (6, 'german', 'de', 'german')");
mysql_query("INSERT IGNORE INTO `".PREFIX."news_languages` (`langID`, `language`, `lang`, `alt`) VALUES (7, 'hungarian', 'hu', 'hungarian')");
mysql_query("INSERT IGNORE INTO `".PREFIX."news_languages` (`langID`, `language`, `lang`, `alt`) VALUES (8, 'italian', 'it', 'italian')");
mysql_query("INSERT IGNORE INTO `".PREFIX."news_languages` (`langID`, `language`, `lang`, `alt`) VALUES (9, 'norwegian', 'no', 'norwegian')");
mysql_query("INSERT IGNORE INTO `".PREFIX."news_languages` (`langID`, `language`, `lang`, `alt`) VALUES (10, 'spanish', 'es', 'spanish')");
mysql_query("INSERT IGNORE INTO `".PREFIX."news_languages` (`langID`, `language`, `lang`, `alt`) VALUES (11, 'swedish', 'se', 'swedish')");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."news_rubrics`");
mysql_query("CREATE TABLE `".PREFIX."news_rubrics` (
  `rubricID` int(11) NOT NULL AUTO_INCREMENT,
  `rubric` varchar(255) NOT NULL default '',
  `pic` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`rubricID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."newsletter`");
mysql_query("CREATE TABLE `".PREFIX."newsletter` (
  `email` varchar(255) NOT NULL default '',
  `pass` varchar(255) NOT NULL default ''
) TYPE=MyISAM");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."partners`");
mysql_query("CREATE TABLE `".PREFIX."partners` (
  `partnerID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL default '',
  `url` varchar(255) NOT NULL default '',
  `banner` varchar(255) NOT NULL default '',
  `sort` int(11) NOT NULL default '0',
  PRIMARY KEY  (`partnerID`)
) PACK_KEYS=0 AUTO_INCREMENT=2 ");

mysql_query("INSERT IGNORE INTO `".PREFIX."partners` (`partnerID`, `name`, `url`, `banner`, `sort`) VALUES (1, 'webSPELL 4', 'http://www.webspell.org', '1.gif', 1)");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."poll`");
mysql_query("CREATE TABLE `".PREFIX."poll` (
  `pollID` int(10) NOT NULL AUTO_INCREMENT,
  `aktiv` int(1) NOT NULL default '0',
  `laufzeit` bigint(20) NOT NULL default '0',
  `titel` varchar(255) NOT NULL default '',
  `o1` varchar(255) NOT NULL default '',
  `o2` varchar(255) NOT NULL default '',
  `o3` varchar(255) NOT NULL default '',
  `o4` varchar(255) NOT NULL default '',
  `o5` varchar(255) NOT NULL default '',
  `o6` varchar(255) NOT NULL default '',
  `o7` varchar(255) NOT NULL default '',
  `o8` varchar(255) NOT NULL default '',
  `o9` varchar(255) NOT NULL default '',
  `o10` varchar(255) NOT NULL default '',
  `comments` int(1) NOT NULL default '0',
  PRIMARY KEY  (`pollID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."poll_votes`");
mysql_query("CREATE TABLE `".PREFIX."poll_votes` (
  `pollID` int(10) NOT NULL default '0',
  `o1` int(11) NOT NULL default '0',
  `o2` int(11) NOT NULL default '0',
  `o3` int(11) NOT NULL default '0',
  `o4` int(11) NOT NULL default '0',
  `o5` int(11) NOT NULL default '0',
  `o6` int(11) NOT NULL default '0',
  `o7` int(11) NOT NULL default '0',
  `o8` int(11) NOT NULL default '0',
  `o9` int(11) NOT NULL default '0',
  `o10` int(11) NOT NULL default '0',
  PRIMARY KEY  (`pollID`)
) TYPE=MyISAM");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."servers`");
mysql_query("CREATE TABLE `".PREFIX."servers` (
  `serverID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL default '',
  `ip` varchar(255) NOT NULL default '',
  `game` char(3) NOT NULL default '',
  `info` text NOT NULL,
  PRIMARY KEY  (`serverID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."settings`");
mysql_query("CREATE TABLE `".PREFIX."settings` (
  `settingID` int(11) NOT NULL AUTO_INCREMENT,
  `hpurl` varchar(255) NOT NULL default '',
  `clanname` varchar(255) NOT NULL default '',
  `clantag` varchar(255) NOT NULL default '',
  `adminname` varchar(255) NOT NULL default '',
  `adminemail` varchar(255) NOT NULL default '',
  `news` int(11) NOT NULL default '0',
  `newsarchiv` int(11) NOT NULL default '0',
  `headlines` int(11) NOT NULL default '0',
  `headlineschars` int(11) NOT NULL default '0',
  `articles` int(11) NOT NULL default '0',
  `latestarticles` int(11) NOT NULL default '0',
  `articleschars` int(11) NOT NULL default '0',
  `clanwars` int(11) NOT NULL default '0',
  `results` int(11) NOT NULL default '0',
  `upcoming` int(11) NOT NULL default '0',
  `shoutbox` int(11) NOT NULL default '0',
  `sball` int(11) NOT NULL default '0',
  `sbrefresh` int(11) NOT NULL default '0',
  `topics` int(11) NOT NULL default '0',
  `posts` int(11) NOT NULL default '0',
  `latesttopics` int(11) NOT NULL default '0',
  `hideboards` int(1) NOT NULL default '0',
  `awards` int(11) NOT NULL default '0',
  `demos` int(11) NOT NULL default '0',
  `guestbook` int(11) NOT NULL default '0',
  `feedback` int(11) NOT NULL default '0',
  `messages` int(11) NOT NULL default '0',
  `users` int(11) NOT NULL default '0',
  `profilelast` int(11) NOT NULL default '0',
  `topnewsID` int(11) NOT NULL default '0',
  `sessionduration` int(3) NOT NULL default '0',
  PRIMARY KEY  (`settingID`)
) AUTO_INCREMENT=2 ");

mysql_query("INSERT IGNORE INTO `".PREFIX."settings` (`settingID`, `hpurl`, `clanname`, `clantag`, `adminname`, `adminemail`, `news`, `newsarchiv`, `headlines`, `headlineschars`, `articles`, `latestarticles`, `articleschars`, `clanwars`, `results`, `upcoming`, `shoutbox`, `sball`, `sbrefresh`, `topics`, `posts`, `latesttopics`, `hideboards`, `awards`, `demos`, `guestbook`, `feedback`, `messages`, `users`, `profilelast`, `topnewsID`) VALUES (1, '".$url."', 'Clanname', 'MyClan', 'Admin-Name', '".$adminmail."', 10, 20, 10, 22, 20, 5, 20, 20, 5, 5, 5, 30, 60, 20, 10, 10, 1, 20, 20, 20, 20, 20, 60, 10, 27)");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."shoutbox`");
mysql_query("CREATE TABLE `".PREFIX."shoutbox` (
  `shoutID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `name` varchar(255) NOT NULL default '',
  `message` varchar(255) NOT NULL default '',
  `ip` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`shoutID`)
) AUTO_INCREMENT=1 ");


mysql_query("DROP TABLE IF EXISTS `".PREFIX."sponsors`");
mysql_query("CREATE TABLE `".PREFIX."sponsors` (
  `sponsorID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL default '',
  `url` varchar(255) NOT NULL default '',
  `info` text NOT NULL,
  `banner` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`sponsorID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."squads`");
mysql_query("CREATE TABLE `".PREFIX."squads` (
  `squadID` int(11) NOT NULL AUTO_INCREMENT,
  `gamesquad` int(11) NOT NULL default '1',
  `name` varchar(255) NOT NULL default '',
  `icon` varchar(255) NOT NULL default '',
  `info` varchar(255) NOT NULL default '',
  `sort` int(11) NOT NULL default '0',
  PRIMARY KEY  (`squadID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."squads_members`");
mysql_query("CREATE TABLE `".PREFIX."squads_members` (
  `sqmID` int(11) NOT NULL AUTO_INCREMENT,
  `squadID` int(11) NOT NULL default '0',
  `userID` int(11) NOT NULL default '0',
  `position` varchar(255) NOT NULL default '',
  `activity` int(1) NOT NULL default '0',
  `sort` int(11) NOT NULL default '0',
  `joinmember` int(1) NOT NULL default '0',
  `warmember` int(1) NOT NULL default '0',
  PRIMARY KEY  (`sqmID`)
) AUTO_INCREMENT=1 ");


mysql_query("DROP TABLE IF EXISTS `".PREFIX."styles`");
mysql_query("CREATE TABLE `".PREFIX."styles` (
  `styleID` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL default '',
  `bgpage` varchar(255) NOT NULL default '',
  `border` varchar(255) NOT NULL default '',
  `bghead` varchar(255) NOT NULL default '',
  `bgcat` varchar(255) NOT NULL default '',
  `bg1` varchar(255) NOT NULL default '',
  `bg2` varchar(255) NOT NULL default '',
  `bg3` varchar(255) NOT NULL default '',
  `bg4` varchar(255) NOT NULL default '',
  `win` varchar(255) NOT NULL default '',
  `loose` varchar(255) NOT NULL default '',
  `draw` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`styleID`)
) AUTO_INCREMENT=2 ");

mysql_query("INSERT IGNORE INTO `".PREFIX."styles` (`styleID`, `title`, `bgpage`, `border`, `bghead`, `bgcat`, `bg1`, `bg2`, `bg3`, `bg4`, `win`, `loose`, `draw`) VALUES (1, 'webSPELL v4.0', '#E6E6E6', '#666666', '#333333', '#FFFFFF', '#FFFFFF', '#F2F2F2', '#F2F2F2', '#D9D9D9', '#00CC00', '#DD0000', '#FF6600')");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."upcoming`");
mysql_query("CREATE TABLE `".PREFIX."upcoming` (
  `upID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `type` char(1) NOT NULL default '',
  `squad` int(11) NOT NULL default '0',
  `opponent` varchar(255) NOT NULL default '',
  `opptag` varchar(255) NOT NULL default '',
  `opphp` varchar(255) NOT NULL default '',
  `oppcountry` char(2) NOT NULL default '',
  `maps` varchar(255) NOT NULL default '',
  `server` varchar(255) NOT NULL default '',
  `league` varchar(255) NOT NULL default '',
  `leaguehp` varchar(255) NOT NULL default '',
  `warinfo` text NOT NULL,
  `short` varchar(255) NOT NULL default '',
  `title` varchar(255) NOT NULL default '',
  `enddate` int(14) NOT NULL default '0',
  `country` char(2) NOT NULL default '',
  `location` varchar(255) NOT NULL default '',
  `locationhp` varchar(255) NOT NULL default '',
  `dateinfo` text NOT NULL,
  PRIMARY KEY  (`upID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."upcoming_announce`");
mysql_query("CREATE TABLE `".PREFIX."upcoming_announce` (
  `annID` int(11) NOT NULL AUTO_INCREMENT,
  `upID` int(11) NOT NULL default '0',
  `userID` int(11) NOT NULL default '0',
  `status` char(1) NOT NULL default '',
  PRIMARY KEY  (`annID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."user`");
mysql_query("CREATE TABLE `".PREFIX."user` (
  `userID` int(11) NOT NULL AUTO_INCREMENT,
  `registerdate` int(14) NOT NULL default '0',
  `lastlogin` int(14) NOT NULL default '0',
  `username` varchar(255) NOT NULL default '',
  `password` varchar(255) NOT NULL default '',
  `nickname` varchar(255) NOT NULL default '',
  `email` varchar(255) NOT NULL default '',
  `firstname` varchar(255) NOT NULL default '',
  `lastname` varchar(255) NOT NULL default '',
  `sex` char(1) NOT NULL default '',
  `country` varchar(255) NOT NULL default '',
  `town` varchar(255) NOT NULL default '',
  `birthday` int(14) NOT NULL default '0',
  `icq` varchar(255) NOT NULL default '',
  `avatar` varchar(255) NOT NULL default '',
  `usertext` varchar(255) NOT NULL default '',
  `userpic` varchar(255) NOT NULL default '',
  `clantag` varchar(255) NOT NULL default 'n/a',
  `clanname` varchar(255) NOT NULL default 'n/a',
  `clanhp` varchar(255) NOT NULL default '',
  `clanirc` varchar(255) NOT NULL default 'n/a',
  `clanhistory` varchar(255) NOT NULL default 'n/a',
  `cpu` varchar(255) NOT NULL default 'n/a',
  `mainboard` varchar(255) NOT NULL default 'n/a',
  `ram` varchar(255) NOT NULL default 'n/a',
  `monitor` varchar(255) NOT NULL default 'n/a',
  `graphiccard` varchar(255) NOT NULL default 'n/a',
  `soundcard` varchar(255) NOT NULL default 'n/a',
  `connection` varchar(255) NOT NULL default 'n/a',
  `keyboard` varchar(255) NOT NULL default 'n/a',
  `mouse` varchar(255) NOT NULL default 'n/a',
  `mousepad` varchar(255) NOT NULL default 'n/a',
  `newsletter` int(1) NOT NULL default '1',
  `about` text NOT NULL,
  `pmgot` int(11) NOT NULL default '0',
  `pmsent` int(11) NOT NULL default '0',
  `visits` int(11) NOT NULL default '0',
  `banned` int(1) NOT NULL default '0',
  `ip` varchar(255) NOT NULL default '',
  `topics` text NOT NULL,
  `articles` text NOT NULL,
  `demos` text NOT NULL,
  PRIMARY KEY  (`userID`)
) AUTO_INCREMENT=2 ");


mysql_query("INSERT IGNORE INTO `".PREFIX."user` (`userID`, `registerdate`, `lastlogin`, `username`, `password`, `nickname`, `email`, `firstname`, `lastname`, `sex`, `country`, `town`, `birthday`, `icq`, `avatar`, `usertext`, `userpic`, `clantag`, `clanname`, `clanhp`, `clanirc`, `clanhistory`, `cpu`, `mainboard`, `ram`, `monitor`, `graphiccard`, `soundcard`, `connection`, `keyboard`, `mouse`, `mousepad`, `newsletter`, `about`, `pmgot`, `pmsent`, `visits`, `banned`, `ip`, `topics`, `articles`, `demos`) VALUES (1, '".time()."', '".time()."', '".$adminname."', '".$adminpassword."', '".$adminname."', '".$adminmail."', '', '', '', '', '', 0, '', '', '', '', 'n/a', 'n/a', '', 'n/a', 'n/a', 'n/a', 'n/a', 'n/a', 'n/a', 'n/a', 'n/a', 'n/a', 'n/a', 'n/a', 'n/a', 1, '', 0, 0, 0, 0, '', '', '', '')");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."user_gbook`");
mysql_query("CREATE TABLE `".PREFIX."user_gbook` (
  `userID` int(11) NOT NULL default '0',
  `gbID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `name` varchar(255) NOT NULL default '',
  `email` varchar(255) NOT NULL default '',
  `hp` varchar(255) NOT NULL default '',
  `icq` varchar(255) NOT NULL default '',
  `ip` varchar(255) NOT NULL default '',
  `comment` text NOT NULL,
  PRIMARY KEY  (`gbID`)
) AUTO_INCREMENT=1 ");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."user_groups`");
mysql_query("CREATE TABLE `".PREFIX."user_groups` (
  `usgID` int(11) NOT NULL AUTO_INCREMENT,
  `userID` int(11) NOT NULL default '0',
  `news` int(1) NOT NULL default '0',
  `newsletter` int(1) NOT NULL default '0',
  `polls` int(1) NOT NULL default '0',
  `forum` int(1) NOT NULL default '0',
  `moderator` int(1) NOT NULL default '0',
  `internboards` int(1) NOT NULL default '0',
  `clanwars` int(1) NOT NULL default '0',
  `feedback` int(1) NOT NULL default '0',
  `user` int(1) NOT NULL default '0',
  `page` int(1) NOT NULL default '0',
  `files` int(1) NOT NULL default '0',
  `cash` int(1) NOT NULL default '0',
  PRIMARY KEY  (`usgID`)
) AUTO_INCREMENT=2 ");

mysql_query("INSERT INTO ".PREFIX."user_groups (usgID, userID, news, newsletter, polls, forum, moderator, internboards, clanwars, feedback, user, page, files)
VALUES (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)");

mysql_query("DROP TABLE IF EXISTS `".PREFIX."user_visitors`");
mysql_query("CREATE TABLE `".PREFIX."user_visitors` (
  `visitID` int(11) NOT NULL AUTO_INCREMENT,
  `userID` int(11) NOT NULL default '0',
  `visitor` int(11) NOT NULL default '0',
  `date` int(14) NOT NULL default '0',
  PRIMARY KEY  (`visitID`)
) AUTO_INCREMENT=1 ");


mysql_query("DROP TABLE IF EXISTS `".PREFIX."whoisonline`");
mysql_query("CREATE TABLE `".PREFIX."whoisonline` (
  `time` int(14) NOT NULL default '0',
  `ip` varchar(20) NOT NULL default '',
  `userID` int(11) NOT NULL default '0',
  `nickname` varchar(255) NOT NULL default '',
  `site` varchar(255) NOT NULL default ''
) TYPE=MyISAM");


mysql_query("DROP TABLE IF EXISTS `".PREFIX."whowasonline`");
mysql_query("CREATE TABLE `".PREFIX."whowasonline` (
  `time` int(14) NOT NULL default '0',
  `ip` varchar(20) NOT NULL default '',
  `userID` int(11) NOT NULL default '0',
  `nickname` varchar(255) NOT NULL default '',
  `site` varchar(255) NOT NULL default ''
) TYPE=MyISAM");

sleep(1);

}

function update31_4beta4() {

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."about`"); 
 mysql_query("CREATE TABLE `".PREFIX."about` (
  `about` longtext NOT NULL
 ) TYPE=MyISAM");

 mysql_query("ALTER TABLE `".PREFIX."awards` ADD `homepage` VARCHAR( 255 ) NOT NULL ,
 ADD `rang` INT DEFAULT '0' NOT NULL ,
 ADD `info` TEXT NOT NULL");

 mysql_query("ALTER TABLE `".PREFIX."cash_box` ADD `squad` INT NOT NULL ,
 ADD `konto` TEXT NOT NULL");

 mysql_query("ALTER TABLE `".PREFIX."clanwars` ADD `linkpage` VARCHAR( 255 ) NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."clanwars` CHANGE `game` `game` VARCHAR( 5 ) NOT NULL");

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."counter_stats`");
 mysql_query("CREATE TABLE `".PREFIX."counter_stats` (
  `dates` varchar(255) NOT NULL default '',
  `count` int(20) NOT NULL default '0'
 ) TYPE=MyISAM");

 mysql_query("ALTER TABLE `".PREFIX."demos` ADD `accesslevel` INT( 1 ) DEFAULT '0' NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."files` ADD `accesslevel` INT( 1 ) DEFAULT '0' NOT NULL");

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."games`");
 mysql_query("CREATE TABLE `".PREFIX."games` (
  `gameID` int(3) NOT NULL AUTO_INCREMENT,
  `tag` varchar(5) NOT NULL default '',
  `name` varchar(20) NOT NULL default '',
  PRIMARY KEY  (`gameID`)
 ) PACK_KEYS=0 AUTO_INCREMENT=8 ");

 mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (1, 'cs', 'Counter-Strike')");
 mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (2, 'ut', 'Unreal Tournament')");
 mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (3, 'to', 'Tactical Ops')");
 mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (4, 'hl2', 'Halflife 2')");
 mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (7, 'bf', 'Battlefield')");
 mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (5, 'wc3', 'Warcraft 3')");
 mysql_query("INSERT IGNORE INTO `".PREFIX."games` (`gameID`, `tag`, `name`) VALUES (6, 'hl', 'Halflife')");

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."linkus`"); 
 mysql_query("CREATE TABLE `".PREFIX."linkus` (
  `bannerID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL default '',
  `file` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`bannerID`)
 ) AUTO_INCREMENT=1 ");

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."newsletter`");
 mysql_query("CREATE TABLE `".PREFIX."newsletter` (
  `email` varchar(255) NOT NULL default '',
  `pass` varchar(255) NOT NULL default ''
 ) TYPE=MyISAM");

 mysql_query("ALTER TABLE `".PREFIX."poll` ADD `laufzeit` BIGINT(20) NOT NULL after `aktiv`");

 mysql_query("ALTER TABLE `".PREFIX."servers` DROP `showed`");

 mysql_query("ALTER TABLE `".PREFIX."settings` CHANGE `bannerrot` `profilelast` INT( 11 ) DEFAULT '0' NOT NULL");

 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `topnewsID` INT NOT NULL");

 mysql_query("ALTER TABLE `".PREFIX."squads_members` ADD `joinmember` INT(1) DEFAULT '0' NOT NULL ,
 ADD `warmember` INT(1) DEFAULT '0' NOT NULL");

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."user_gbook`");
 mysql_query("CREATE TABLE `".PREFIX."user_gbook` (
  `userID` int(11) NOT NULL default '0',
  `gbID` int(11) NOT NULL AUTO_INCREMENT,
  `date` int(14) NOT NULL default '0',
  `name` varchar(255) NOT NULL default '',
  `email` varchar(255) NOT NULL default '',
  `hp` varchar(255) NOT NULL default '',
  `icq` varchar(255) NOT NULL default '',
  `ip` varchar(255) NOT NULL default '',
  `comment` text NOT NULL,
  PRIMARY KEY  (`gbID`)
 ) AUTO_INCREMENT=1 ");

 mysql_query("ALTER TABLE `".PREFIX."servers` CHANGE `game` `game` CHAR( 3 ) NOT NULL");

}

function update4beta4_4beta5() {

 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `sessionduration` INT( 3 ) NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `closed` INT( 1 ) DEFAULT '0' NOT NULL");

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."lock`"); 
 mysql_query("CREATE TABLE `".PREFIX."lock` (
  `time` INT NOT NULL ,
  `reason` TEXT NOT NULL
 )");

 mysql_query("ALTER TABLE `".PREFIX."news` ADD `intern` INT( 1 ) DEFAULT '0' NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."guestbook` ADD `admincomment` TEXT NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `gb_info` INT( 1 ) DEFAULT '1' NOT NULL");

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."static`");
 mysql_query("CREATE TABLE `".PREFIX."static` (
  `staticID` INT NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR( 255 ) NOT NULL ,
  `accesslevel` INT( 1 ) NOT NULL ,
  PRIMARY KEY ( `staticID` )
  );");
  
}

function update4beta5_4beta6() {

 mysql_query("ALTER TABLE `".PREFIX."user` ADD `mailonpm` INT( 1 ) DEFAULT '0' NOT NULL");
 
 mysql_query("DROP TABLE IF EXISTS `".PREFIX."imprint`");
 mysql_query("CREATE TABLE `".PREFIX."imprint` (
`imprintID` INT NOT NULL AUTO_INCREMENT ,
`imprint` TEXT NOT NULL ,
PRIMARY KEY ( `imprintID` )
)");

 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `imprint` INT( 1 ) DEFAULT '0' NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."poll` ADD `hosts` TEXT NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."files` CHANGE `info` `info` TEXT NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."user` ADD `homepage` VARCHAR( 255 ) NOT NULL AFTER `newsletter`");
}

function update4beta6_4final() {
	
	
 //files

 mysql_query("ALTER TABLE `".PREFIX."files` ADD `votes` INT NOT NULL ,
ADD `points` INT NOT NULL ,
ADD `rating` INT NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."files` ADD `mirrors` TEXT NOT NULL AFTER `file`");

 mysql_query("ALTER TABLE `".PREFIX."user` ADD `files` TEXT NOT NULL AFTER `demos`");
 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `picsize_l` INT DEFAULT '450' NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `picsize_h` INT DEFAULT '500' NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."files` ADD `poster` INT NOT NULL");
 
 //gallery
 
 mysql_query("DROP TABLE IF EXISTS `".PREFIX."gallery`");
 mysql_query("CREATE TABLE `".PREFIX."gallery` (
`galleryID` INT NOT NULL AUTO_INCREMENT ,
`userID` INT NOT NULL ,
`name` VARCHAR( 255 ) NOT NULL ,
`date` INT( 14 ) NOT NULL ,
`groupID` INT NOT NULL ,
PRIMARY KEY ( `galleryID` )
)");

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."gallery_groups`");
 mysql_query("CREATE TABLE `".PREFIX."gallery_groups` (
`groupID` INT NOT NULL AUTO_INCREMENT ,
`name` VARCHAR( 255 ) NOT NULL ,
`sort` INT NOT NULL ,
PRIMARY KEY ( `groupID` )
)");

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."gallery_pictures`");
 mysql_query("CREATE TABLE `".PREFIX."gallery_pictures` (
`picID` INT NOT NULL AUTO_INCREMENT ,
`galleryID` INT NOT NULL ,
`name` VARCHAR( 255 ) NOT NULL ,
`comment` TEXT NOT NULL ,
`views` INT DEFAULT '0' NOT NULL ,
`comments` INT( 1 ) DEFAULT '1' NOT NULL ,
PRIMARY KEY ( `picID` )
)");

 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `pictures` INT DEFAULT '12' NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `publicadmin` INT( 1 ) DEFAULT '1' NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."user_groups` ADD `gallery` INT( 1 ) NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `thumbwidth` INT DEFAULT '130' NOT NULL");
 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `usergalleries` INT( 1 ) DEFAULT '1' NOT NULL");
 
 mysql_query("ALTER TABLE `".PREFIX."user` ADD `gallery_pictures` TEXT NOT NULL AFTER `files`");
 
 mysql_query("ALTER TABLE `".PREFIX."gallery_pictures` ADD `votes` INT NOT NULL ,
ADD `points` INT NOT NULL ,
ADD `rating` INT NOT NULL");

 mysql_query("ALTER TABLE `".PREFIX."settings` ADD `maxusergalleries` INT DEFAULT '1048576' NOT NULL");


 //country-list

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."countries`");
 mysql_query("CREATE TABLE `".PREFIX."countries` (
`countryID` INT NOT NULL AUTO_INCREMENT ,
`country` VARCHAR( 255 ) NOT NULL ,
`short` VARCHAR( 3 ) NOT NULL ,
PRIMARY KEY ( `countryID` )
)");

 mysql_query("INSERT INTO `".PREFIX."countries` ( `countryID` , `country` , `short` )
VALUES
('', 'Argentina', 'ar'),
('', 'Australia', 'au'),
('', 'Austria', 'at'),
('', 'Belgium', 'be'),
('', 'Bosnia Herzegowina', 'ba'),
('', 'Brazil', 'br'),
('', 'Bulgaria', 'bg'),
('', 'Canada', 'ca'),
('', 'Chile', 'cl'),
('', 'China', 'cn'),
('', 'Colombia', 'co'),
('', 'Czech Republic', 'cz'),
('', 'Croatia', 'hr'),
('', 'Cyprus', 'cy'),
('', 'Denmark', 'dk'),
('', 'Estonia', 'ee'),
('', 'Finland', 'fi'),
('', 'Faroe Islands', 'fo'),
('', 'France', 'fr'),
('', 'Germany', 'de'),
('', 'Greece', 'gr'),
('', 'Hungary', 'hu'),
('', 'Iceland', 'is'),
('', 'Ireland', 'ie'),
('', 'Israel', 'il'),
('', 'Italy', 'it'),
('', 'Japan', 'jp'),
('', 'Korea', 'kr'),
('', 'Latvia', 'lv'),
('', 'Lithuania', 'lt'),
('', 'Luxemburg', 'lu'),
('', 'Malaysia', 'my'),
('', 'Malta', 'mt'),
('', 'Netherlands', 'nl'),
('', 'Mexico', 'mx'),
('', 'Mongolia', 'mn'),
('', 'New Zealand', 'nz'),
('', 'Norway', 'no'),
('', 'Poland', 'pl'),
('', 'Portugal', 'pt'),
('', 'Romania', 'ro'),
('', 'Russian Federation', 'ru'),
('', 'Singapore', 'sg'),
('', 'Slovak Republic', 'sk'),
('', 'Slovenia', 'si'),
('', 'Taiwan', 'tw'),
('', 'South Africa', 'za'),
('', 'Spain', 'es'),
('', 'Sweden', 'se'),
('', 'Syria', 'sy'),
('', 'Switzerland', 'ch'),
('', 'Tibet', 'ti'),
('', 'Tunisia', 'tn'),
('', 'Turkey', 'tr'),
('', 'Ukraine', 'ua'),
('', 'United Kingdom', 'uk'),
('', 'USA', 'us'),
('', 'Venezuela', 've'),
('', 'Yugoslavia', 'yu'),
('', 'European Union', 'eu')");

//smileys

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."smileys`");
 mysql_query("CREATE TABLE `".PREFIX."smileys` (
  `smileyID` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL default '',
  `alt` varchar(255) NOT NULL default '',
  `pattern` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`smileyID`),
  UNIQUE KEY `name` (`name`)
) AUTO_INCREMENT=16");

 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (1, 'biggrin.gif', 'amüsiert', ':D')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (2, 'confused.gif', 'verwirrt', '?(')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (3, 'crying.gif', 'traurig', ';(')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (4, 'pleased.gif', 'erfreut', ':]')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (5, 'happy.gif', 'fröhlich', ':))')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (6, 'smile.gif', 'lächeln', ':)')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (7, 'wink.gif', 'zwinkern', ';)')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (8, 'frown.gif', 'unglücklich', ':(')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (9, 'tongue.gif', 'zunge raus', ':P')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (10, 'tongue2.gif', 'zunge raus', ';P')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (11, 'redface.gif', 'müde', ':O')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (12, 'cool.gif', 'cool', '8)')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (13, 'eek.gif', 'geschockt', '8o')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (14, 'evil.gif', 'teuflisch', ':evil:')");
 mysql_query("INSERT INTO `".PREFIX."smileys` VALUES (15, 'mad.gif', 'sauer', 'X(')");

//clanwars

 mysql_query("ALTER TABLE `".PREFIX."clanwars` ADD `hltv` VARCHAR( 255 ) NOT NULL AFTER `server`");

//polls

 mysql_query("ALTER TABLE `".PREFIX."poll` ADD `intern` INT( 1 ) DEFAULT '0' NOT NULL");
 
//games

 mysql_query("ALTER TABLE `".PREFIX."games` CHANGE `name` `name` VARCHAR( 255 ) NOT NULL");
 
//servers

 mysql_query("ALTER TABLE `".PREFIX."servers` ADD `sort` INT DEFAULT '1' NOT NULL");
 
//scrolltext

 mysql_query("DROP TABLE IF EXISTS `".PREFIX."scrolltext`");
 mysql_query("CREATE TABLE `".PREFIX."scrolltext` (
  `text` longtext NOT NULL,
  `delay` int(11) NOT NULL default '100',
  `direction` varchar(255) NOT NULL default ''
) TYPE=MyISAM");

//superuser

 mysql_query("ALTER TABLE `".PREFIX."user_groups` ADD `super` INT( 1 ) DEFAULT '0' NOT NULL");
 mysql_query("UPDATE `".PREFIX."user_groups` SET super='1' WHERE userID='1' "); 

//bannerrotation

 mysql_query("CREATE TABLE `".PREFIX."bannerrotation` (
  `bannerID` int(11) NOT NULL AUTO_INCREMENT,
  `banner` varchar(255) NOT NULL default '',
  `bannername` varchar(255) NOT NULL default '',
  `bannerurl` varchar(255) NOT NULL default '',
  `displayed` varchar(255) NOT NULL default '',
  `hits` int(11) default '0',
  `date` int(11) NOT NULL default '0',
  PRIMARY KEY  (`bannerID`),
  UNIQUE KEY `banner` (`banner`))");

 mysql_query("ALTER TABLE `".PREFIX."user` CHANGE `connection` `verbindung` VARCHAR( 255 ) NOT NULL DEFAULT 'n/a'");

//converting clanwars-TABLE

 $clanwarQry = mysql_query("SELECT * FROM ".PREFIX."clanwars");
 $total = mysql_num_rows($clanwarQry);
 if($total) {
		while($olddata = mysql_fetch_array($clanwarQry)) {
			$id = $olddata[cwID];
			$maps = $olddata[maps];
			$scoreHome1 = $olddata[homescr1];
			$scoreHome2 = $olddata[homescr2];
			$scoreOpp1 = $olddata[oppscr1];
			$scoreOpp2 = $olddata[oppscr2];
			
			// do the convertation
			if(!empty($scoreHome2))	$scoreHome = $scoreHome1.'||'.$scoreHome2;
			else $scoreHome = $scoreHome1;
			
			if(!empty($scoreOpp2)) $scoreOpp = $scoreOpp1.'||'.$scoreOpp2;
			else $scoreOpp = $scoreOpp1;
			
			// update database, set new structure
			if(mysql_query("ALTER TABLE `".PREFIX."clanwars` CHANGE `homescr1` `homescore` TEXT NOT NULL")) {
  			mysql_query("ALTER TABLE `".PREFIX."clanwars` CHANGE `oppscr1` `oppscore` TEXT NOT NULL");
				if(mysql_query("ALTER TABLE `".PREFIX."clanwars` DROP `homescr2`")) {
					mysql_query("ALTER TABLE `".PREFIX."clanwars` DROP `oppscr2`");
					// save converted data into the database
				  mysql_query("UPDATE ".PREFIX."clanwars SET homescore='".$scoreHome."', oppscore='".$scoreOpp."', maps='".$maps."' WHERE cwID='".$id."'");
					
				}
			}
			$run++;
		}
 } else {
		mysql_query("ALTER TABLE `".PREFIX."clanwars` CHANGE `homescr1` `homescore` TEXT");
		mysql_query("ALTER TABLE `".PREFIX."clanwars` CHANGE `oppscr1` `oppscore` TEXT");
		mysql_query("ALTER TABLE `".PREFIX."clanwars` DROP `homescr2`");
  	mysql_query("ALTER TABLE `".PREFIX."clanwars` DROP `oppscr2`");
 }
}
 
function update40000_40100() {
	
	// FAQ
	mysql_query("DROP TABLE IF EXISTS `".PREFIX."faq`");
	mysql_query("CREATE TABLE `".PREFIX."faq` (
  `faqID` int(11) NOT NULL AUTO_INCREMENT,
  `faqcatID` int(11) NOT NULL default '0',
  `question` varchar(255) NOT NULL default '',
  `answer` varchar(255) NOT NULL default '',
  `sort` int(11) NOT NULL default '0',
  PRIMARY KEY  (`faqID`)
	) AUTO_INCREMENT=1 ");

	mysql_query("DROP TABLE IF EXISTS `".PREFIX."faq_categories`");
	mysql_query("CREATE TABLE `".PREFIX."faq_categories` (
  `faqcatID` int(11) NOT NULL AUTO_INCREMENT,
  `faqcatname` varchar(255) NOT NULL default '',
  `description` TEXT NOT NULL,
  `sort` int(11) NOT NULL default '0',
  PRIMARY KEY  (`faqcatID`)
	) AUTO_INCREMENT=1 ");

	// Admin Member Beschreibung
	mysql_query("ALTER TABLE `".PREFIX."user` ADD `userdescription` TEXT NOT NULL");

	// Forum Sticky Function
	mysql_query("ALTER TABLE `".PREFIX."forum_topics` ADD `sticky` INT(1) NOT NULL DEFAULT '0'");
	
	// birthday converter
	
	mysql_query("ALTER TABLE `".PREFIX."user` ADD `birthday2` DATETIME NOT NULL AFTER `birthday`");
	$q=mysql_query("SELECT userID, birthday FROM `".PREFIX."user`");
	while($ds=mysql_fetch_array($q)) {
		mysql_query("UPDATE `".PREFIX."user` SET birthday2='".date("Y",$ds['birthday'])."-".date("m",$ds['birthday'])."-".date("d",$ds['birthday'])."' WHERE userID='".$ds['userID']."'");
	}
	mysql_query("ALTER TABLE `".PREFIX."user` DROP `birthday`");
	mysql_query("ALTER TABLE `".PREFIX."user` CHANGE `birthday2` `birthday` DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL");
	
}
function update40100_40101() {
	
	//forum speedfix
	mysql_query("ALTER TABLE `".PREFIX."forum_boards` ADD `topics` INT DEFAULT '0' NOT NULL");
	mysql_query("ALTER TABLE `".PREFIX."forum_boards` ADD `posts` INT DEFAULT '0' NOT NULL");

	$q=mysql_query("SELECT boardID FROM `".PREFIX."forum_boards`");
	while($ds=mysql_fetch_array($q)) {
		$topics=mysql_num_rows(mysql_query("SELECT topicID FROM `".PREFIX."forum_topics` WHERE boardID='".$ds[boardID]."' AND moveID='0'"));
		$posts=mysql_num_rows(mysql_query("SELECT postID FROM `".PREFIX."forum_posts` WHERE boardID='".$ds[boardID]."'"));
		if(($posts-$topics) < 0) $posts=0;
		else $posts=$posts-$topics;
		mysql_query("UPDATE `".PREFIX."forum_boards` SET topics='".$topics."' , posts='".$posts."' WHERE boardID='".$ds[boardID]."'");
	}
	
	//add captcha
	
	mysql_query("CREATE TABLE `".PREFIX."captcha` (
  `hash` varchar(255) NOT NULL default '',
  `captcha` int(11) NOT NULL default '0',
  `deltime` int(11) NOT NULL default '0',
  PRIMARY KEY  (`hash`)
	) TYPE=MyISAM;");
	
	//useractivation
	
	mysql_query("ALTER TABLE `".PREFIX."user` ADD `activated` varchar(255) NOT NULL default '1'");
	
	//counter: max. online	
	mysql_query("ALTER TABLE `".PREFIX."counter` ADD `maxonline` INT NOT NULL");
	
	//faq
	
	mysql_query("ALTER TABLE `".PREFIX."faq` CHANGE `answer` `answer` TEXT NOT NULL");
}
?>