<?
/*
//||||||||||||||||||||||||||||||||||||||||||||||||\\
\\*             SUPER HERO MOD WEB STATS          //
//                                                \\
\\     Written By ShadowLeader (Tim Hansen)       //
//                                                \\
\\              http://SH-MOD.TK                  //
//          Email: shadowleader@jubii.dk          \\
\\          MSN: shadowleader11@hotmail.com       //
//                                                \\
\\   You are allowed to edit anything in these    //
//     files, as long as these lines remain.      \\
\\                                                //
//   If you have any trouble with the system,     \\
\\       go to www.SH-MOD.TK to get help.         //
//                                                \\
\\   Thanks to:                                   //
//   AlleyKat - Help with Template system         \\
\\   MajesticM00se - A little code                //
//   Vittu - Finding bugs                         \\
\\||||||||||||||||||||||||||||||||||||||||||||||||//
*/
$steps = "5";
?><html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>SHStats Installation</title>
</head>

<body>
<div align="center">   
	<table border="1" cellspacing="0" style="border-collapse: collapse; border-right: 1px solid; border-left: 1px solid; border-top: 0px; border-bottom: 0px" width="735" cellpadding="2">
          <tr>
            <td valign="top" style="border-top: 1px solid; border-bottom: 1px solid">
			<? if(!$_POST["step"]){?>	
			<table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse; border: 1px solid #000000" width="735">
          <tr>
            <td width="100%">Step 1/<?=$steps;?> - MySQL information.</td>
          </tr>
      </table>
			<? if(!$_POST['test']){?>
              <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
                <table width=100%>
                  <tr>
                    <td colspan="2" align=left><strong>Connection Informations: </strong></td>
                  </tr>
				  <tr>
                    <td width="20%" align=left>Database Host:</td>
                    <td width=80% align=left valign=top><input name="dbhost" type="text" class="input" id="dbhost" value="localhost" size="30">
                    </td>
                  </tr>
                  <tr>
                    <td width="20%" align=left>Database Username:</td>
                    <td align=left valign=top><input name="dbusername" type="text" class="input" id="dbusername" size="30"></td>
                  </tr>
                  <tr>
                    <td align=left>Database Password: </td>
                    <td align=left valign=top><input name="dbpasswd" type="password" class="input" id="dbpasswd" size="30"></td>
                  </tr>
                  <tr>
                    <td align=left>Database Name:</td>
                    <td align=left valign=top><input name="database_name" type="text" class="input" id="database_name" value="sherodb" size="30"></td>
                  </tr>
				  <tr>
                    <td align=left colspan="2"><input name="step" type="hidden" value="1-2"><input name="test" type="submit" class="input" value="Test"></td>
				  </tr>
                </table>
              </form>
              <?php
}}
if($_POST["step"] == "1-2"){?>
<table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse; border: 1px solid #000000" width="735">
 <tr>
   <td width="100%">Step 1/<?=$steps;?> - MySQL information.</td>
 </tr>
</table>
<table width=100%>
 <tr>
   <td colspan="2" align=left><?
//echo"-".$_POST["dbhost"]." -".$_POST["dbusername"]." -".$_POST["dbpasswd"]."";
$connection = mysql_pconnect("".$_POST["dbhost"]."","".$_POST["dbusername"]."","".$_POST["dbpasswd"]."") or die ("Couldn't connect to server.");
$db = mysql_select_db("".$_POST["database_name"]."", $connection) or die("Couldn't select database.");
if($db == "1"){
echo"Connected succesfully!<br><br>";?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<input name="dbhost" type="hidden" id="dbhost" value="<? echo"".$_POST["dbhost"]."";?>">
<input name="dbusername" type="hidden" id="dbusername" value="<? echo"".$_POST["dbusername"]."";?>">
<input name="dbpasswd" type="hidden" id="dbpasswd" value="<? echo"".$_POST["dbpasswd"]."";?>">
<input name="database_name" type="hidden" id="database_name" value="<? echo"".$_POST["database_name"]."";?>">
<input name="step" type="hidden" value="2"><input name="test" type="submit" class="input" value="Next step (2/<?=$steps;?>)">
</form>
<? }?>
</td>
 </tr>
</table>
<?
}
if($_POST["step"] == "2"){?>
<table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse; border: 1px solid #000000" width="735">
 <tr>
   <td width="100%">Step 2/<?=$steps;?> - Creating tables.</td>
 </tr>
</table>
<table width=100%>
 <tr>
   <td colspan="2" align=left>
<?
$connection = mysql_pconnect("".$_POST["dbhost"]."","".$_POST["dbusername"]."","".$_POST["dbpasswd"]."") or die ("Couldn't connect to server.");
$db = mysql_select_db("".$_POST["database_name"]."", $connection) or die("Couldn't select database.");

$sh_hero_database = mysql_query("show tables like 'sh_hero_database'");
  if(mysql_fetch_row($sh_hero_database) === false) {
$tabelSQL = "CREATE TABLE IF NOT EXISTS `sh_hero_database` (
  `sh_name` varchar(50) NOT NULL default '',
  `sh_level` int(11) NOT NULL default '0',
  `sh_description` varchar(255) NOT NULL default '',
  `sh_image` varchar(255) NOT NULL default '',
  `sh_download` varchar(255) NOT NULL default '',
  `sh_source` varchar(255) NOT NULL default '',
  `sh_author` varchar(255) NOT NULL default '',
  `sh_author_mail` varchar(255) NOT NULL default '',
  `sh_bind` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`sh_name`)
) TYPE=MyISAM";
$num1 = mysql_query($tabelSQL);     // creates the table sh_hero_database
//---------sh_hero_database dump-----------------------
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Anubis', 1, 'Nothing Is Secret From You.\r\nHear Enemies - See Damage', 'anubis.jpg', 'sh_anubis.amxx', 'sh_anubis.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Aquaman', 1, 'You can Breathe Underwater and Fire your Bubble Thrower', 'aquaman.jpg', 'sh_aquaman.amxx', 'sh_aquaman.sma', '', '', '1')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Batman', 1, 'Extra Weapons and Health - Buy the Ammo or Use with Punisher', 'batman.jpg', 'sh_batman.amxx', 'sh_batman.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Bomberman', 1, 'Press +power button to plant, and again to detonate', 'bomberman.jpg', 'sh_bomberman.amxx', 'sh_bomberman.sma', '', '', '1')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Captain America', 1, 'Random Invincibility', 'captain_america.jpg', 'sh_captaina.amxx', 'sh_captaina.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Cyclops', 5, 'Press the +power key to fire your laser beam', 'cyclops.jpg', 'sh_cyclops.amxx', 'sh_cyclops.sma', '', '', '1')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Daredevil', 1, 'ESP Rings show you when other players are approaching', 'daredevil.jpg', 'sh_daredevil.amxx', 'sh_daredevil.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Dazzler', 1, 'Flash Nearby Enemies - Grows in intesity as you level up', 'dazzler.jpg', 'sh_dazzler.amxx', 'sh_dazzler.sma', '', '', '1')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Dracula', 1, 'Gain HP by shooting people - More HPs per level', 'dracula.jpg', 'sh_dracula.amxx', 'sh_dracula.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Flash', 1, 'You will run much faster with this hero', 'flash.jpg', 'sh_flash.amxx', 'sh_flash.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Hobgoblin', 1, 'Extra Nade Damage/Refill Nade', 'hobgoblin.jpg', 'sh_hobgoblin.amxx', 'sh_hobgoblin.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Hulk', 1, 'Immobilizes Self and Nearby Enemies', 'hulk.jpg', 'sh_hulk.amxx', 'sh_hulk.sma', '', '', '1')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Human Torch', 1, 'Get a Flame Thrower to use on enemies', 'humantorch.jpg', 'sh_humantorch.amxx', 'sh_humantorch.sma', '', '', '1')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Iron Man', 1, 'Rocket Jetpack - Jump and rocket to take off', 'ironman.jpg', 'sh_ironman.amxx', 'sh_ironman.sma', '', '', '1')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Kamikaze', 1, 'Blow up the enemies with a Kamikazi attack', 'kamikaze.jpg', 'sh_kamikaze.amxx', 'sh_kamikaze.sma', '', '', '1')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Magneto', 10, 'Get players guns when they shoot you', 'magneto.jpg', 'sh_magneto.amxx', 'sh_magneto.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Mystique', 1, 'Hold Down a Power Key to Look Like the Enemy - Release the Key to Look Like Yourself!', 'mystique.jpg', 'sh_mystique.amxx', 'sh_mystique.sma', '', '', '1')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('NightCrawler', 1, 'Can Walk Through Walls for Short Time - GET STUCK AND YOU''LL BE AUTO-SLAIN!', 'nightcrawler.jpg', 'sh_nightcrawler.amxx', 'sh_nightcrawler.sma', '', '', '1')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Punisher', 1, 'Endless Bullets. Chance at No Reload! Keep Shooting', 'punisher.jpg', 'sh_punisher.amxx', 'sh_punisher.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Skeletor', 1, 'Will Automatically Summon Monsters To Attack Enemy Campers', 'skeletor.jpg', 'sh_skeletor.amxx', 'sh_skeletor.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Spider-Man', 1, 'Shoot Hook - Jump Reels In, Duck Reels Out', 'spiderman.jpg', 'sh_spiderman.amxx', 'sh_spiderman.sma', '', '', '1')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Superman', 1, 'More Health/Free Armor/Reduced Gravity', 'superman.jpg', 'sh_superman.amxx', 'sh_superman.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Wind Walker', 1, 'Enemy cannot hear your footsteps', 'windwalker.jpg', 'sh_windwalker.amxx', 'sh_windwalker.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Wolverine', 1, 'Auto-Heal,  Knife Damage, Extra Knife Speed', 'wolverine.jpg', 'sh_wolverine.amxx', 'sh_wolverine.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Xavier', 7, 'Detect what team a player is on by a glowing trail', 'xavier.jpg', 'sh_xavier.amxx', 'sh_xavier.sma', '', '', '0')");
mysql_query("INSERT INTO `sh_hero_database` VALUES ('Zeus', 9, 'Will Automatically Raise One Fallen Teammate', 'zeus.jpg', 'sh_zeus.amxx', 'sh_zeus.sma', '', '', '0')");
//---------sh_hero_database dump-----------------------
echo"sh_hero_database <font color=#00FF00>Created</font><br>";
}else{echo"sh_hero_database <font color=#FF0000>Error - Already exists!</font><br>";}

$users = mysql_query("show tables like 'users'");
  if(mysql_fetch_row($users) === false) {
$tabelSQL2 = "CREATE TABLE IF NOT EXISTS `users` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(40) NOT NULL default '',
  `passhash` varchar(32) NOT NULL default '',
  `email` varchar(80) NOT NULL default '',
  `status` enum('pending','confirmed') NOT NULL default 'pending',
  `added` datetime NOT NULL default '0000-00-00 00:00:00',
  `last_login` datetime NOT NULL default '0000-00-00 00:00:00',
  `last_access` datetime NOT NULL default '0000-00-00 00:00:00',
  `privacy` enum('strong','normal','low') NOT NULL default 'normal',
  `stylesheet` int(10) default '1',
  `info` text,
  `acceptpms` enum('yes','friends','no') NOT NULL default 'yes',
  `ip` varchar(15) NOT NULL default '',
  `class` tinyint(3) unsigned NOT NULL default '0',
  `avatar` varchar(100) NOT NULL default '',
  `title` varchar(30) NOT NULL default '',
  `country` int(10) unsigned NOT NULL default '0',
  `notifs` varchar(100) NOT NULL default '',
  `modcomment` text NOT NULL,
  `enabled` enum('yes','no') NOT NULL default 'yes',
  `avatars` enum('yes','no') NOT NULL default 'yes',
  `donor` enum('yes','no') NOT NULL default 'no',
  `warned` enum('yes','no') NOT NULL default 'no',
  `warneduntil` datetime NOT NULL default '0000-00-00 00:00:00',
  `deletepms` enum('yes','no') NOT NULL default 'yes',
  `savepms` enum('yes','no') NOT NULL default 'no',
  `supportfor` text NOT NULL,
  `support` enum('yes','no') NOT NULL default 'no',
  `deposit` bigint(20) NOT NULL default '0',
  `gender` enum('Male','Female','N/A') NOT NULL default 'N/A',
  `signatures` enum('yes','no') NOT NULL default 'yes',
  `parked` enum('yes','no') NOT NULL default 'no',
  `user_timezone` decimal(5,2) NOT NULL default '0.00',
  `user_dateformat` varchar(14) NOT NULL default 'd M Y H:i',
  `contacts` varchar(30) NOT NULL default '',
  `contacttype` int(10) NOT NULL default '0',
  `donated` int(5) unsigned NOT NULL default '0',
  `age` int(10) NOT NULL default '0',
  `website` varchar(50) NOT NULL default '',
  `language` int(10) NOT NULL default '1',
  `stars` enum('1','2','3','4') NOT NULL default '1',
  `permban` enum('yes','no') NOT NULL default 'no',
  `allow_special` enum('yes','no') NOT NULL default 'no',
  `forumpost` enum('yes','no') NOT NULL default 'yes',
  `last_warned` datetime NOT NULL default '0000-00-00 00:00:00',
  `lang` varchar(20) NOT NULL default 'english',
  `steamid` varchar(20) NOT NULL default '',
  `points` int(10) NOT NULL default '100',
  PRIMARY KEY  (`id`,`steamid`),
  UNIQUE KEY `username` (`username`),
  KEY `status_added` (`status`,`added`),
  KEY `ip` (`ip`),
  KEY `country` (`country`),
  KEY `last_access` (`last_access`),
  KEY `enabled` (`enabled`),
  KEY `warned` (`warned`)
) TYPE=MyISAM";
$num2 = mysql_query($tabelSQL2);     // creates the table users
echo"users <font color=#00FF00>Created</font><br>";
}else{echo"users <font color=#FF0000>Error - Already exists!</font><br>";}

$sh_config = mysql_query("show tables like 'sh_config'");
  if(mysql_fetch_row($sh_config) === false) {
$tabelSQL3 = "CREATE TABLE IF NOT EXISTS `sh_config` (
  `id` int(9) NOT NULL auto_increment,
  `maxxp` varchar(20) NOT NULL default '51200',
  `levels` char(3) NOT NULL default '10',
  `allow_dl` char(1) NOT NULL default '1',
  `servername` varchar(30) NOT NULL default '',
  `serverip` varchar(21) NOT NULL default '',
  `root_path` varchar(30) NOT NULL default 'stats',
  `max` char(3) NOT NULL default '20',
  `template` varchar(15) NOT NULL default 'blue',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM";
$num3 = mysql_query($tabelSQL3);   // creates the table sh_config
echo"sh_config <font color=#00FF00>Created</font><br>";
}else{echo"sh_config <font color=#FF0000>Error - Already exists!</font><br>";}

$avps = mysql_query("show tables like 'avps'");
  if(mysql_fetch_row($avps) === false) {
$tabelSQL4 = "CREATE TABLE IF NOT EXISTS `avps` (
  `arg` varchar(20) NOT NULL default '',
  `value_s` text NOT NULL,
  `value_i` int(11) NOT NULL default '0',
  `value_u` int(10) unsigned NOT NULL default '0',
  `last24` int(10) NOT NULL default '0',
  `last24record` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`arg`)
) TYPE=MyISAM";
$num4 = mysql_query($tabelSQL4);   // creates the table avps
//---------avps dump-----------------------
$num4_1 = mysql_query("INSERT INTO `avps` VALUES ('lastcleantime', '', 0, 1154787399, 0, '0000-00-00 00:00:00')");
$num4_2 = mysql_query("INSERT INTO `avps` VALUES ('last24', '', 3853, 1138753177, 0, '0000-00-00 00:00:00')");
$num4_3 = mysql_query("INSERT INTO `avps` VALUES ('expenses', '', 0, 2000, 0, '0000-00-00 00:00:00')");
$num4_4 = mysql_query("INSERT INTO `avps` VALUES ('lastpointtime', '', 0, 1154785237, 0, '0000-00-00 00:00:00')");
//---------avps dump-----------------------
echo"avps <font color=#00FF00>Created</font>"; if($num4_1 == "1" AND $num4_2 == "1" AND $num4_3 == "1" AND $num4_4 == "1"){echo" Rows added!";}echo"<br>";
}else{echo"avps <font color=#FF0000>Error - Already exists!</font><br>";}

$ban = mysql_query("show tables like 'ban'");
  if(mysql_fetch_row($ban) === false) {
$tabelSQL5 = "CREATE TABLE IF NOT EXISTS `ban` (
  `id` mediumint(8) NOT NULL auto_increment,
  `ip` varchar(255) NOT NULL default '',
  `userid` varchar(255) NOT NULL default '',
  `hash` varchar(255) NOT NULL default '',
  UNIQUE KEY `id` (`id`)
) TYPE=MyISAM";
$num5 = mysql_query($tabelSQL5);   // creates the table ban
echo"ban <font color=#00FF00>Created</font><br>";
}else{echo"ban <font color=#FF0000>Error - Already exists!</font><br>";}

$bans = mysql_query("show tables like 'bans'");
  if(mysql_fetch_row($bans) === false) {
$tabelSQL6 = "CREATE TABLE IF NOT EXISTS `bans` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `added` datetime NOT NULL default '0000-00-00 00:00:00',
  `addedby` int(10) unsigned NOT NULL default '0',
  `comment` varchar(255) NOT NULL default '',
  `first` bigint(20) default NULL,
  `last` bigint(20) default NULL,
  PRIMARY KEY  (`id`),
  KEY `first_last` (`first`,`last`)
) TYPE=MyISAM";
$num6 = mysql_query($tabelSQL6);   // creates the table bans
echo"bans <font color=#00FF00>Created</font><br>";
}else{echo"bans <font color=#FF0000>Error - Already exists!</font><br>";}

$blocks = mysql_query("show tables like 'blocks'");
  if(mysql_fetch_row($blocks) === false) {
$tabelSQL7 = "CREATE TABLE IF NOT EXISTS `blocks` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `userid` int(10) unsigned NOT NULL default '0',
  `blockid` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `userfriend` (`userid`,`blockid`)
) TYPE=MyISAM";
$num7 = mysql_query($tabelSQL7);   // creates the table blocks
echo"blocks <font color=#00FF00>Created</font><br>";
}else{echo"blocks <font color=#FF0000>Error - Already exists!</font><br>";}

$config = mysql_query("show tables like 'config'");
  if(mysql_fetch_row($config) === false) {
$tabelSQL8 = "CREATE TABLE IF NOT EXISTS `config` (
  `name` varchar(255) NOT NULL default '',
  `value` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`name`)
) TYPE=MyISAM";
$num8 = mysql_query($tabelSQL8);   // creates the table config
//-------config dump-----------------------
$num8_1 = mysql_query("INSERT INTO `config` VALUES ('sitename', 'SuperHero Mod Stats')");
$num8_2 = mysql_query("INSERT INTO `config` VALUES ('domain', 'http://localhost/')");
$num8_3 = mysql_query("INSERT INTO `config` VALUES ('sitemail', 'noreply@localhost')");
$num8_4 = mysql_query("INSERT INTO `config` VALUES ('funds', '0')");
$num8_5 = mysql_query("INSERT INTO `config` VALUES ('maxusers', '5000')");
$num8_6 = mysql_query("INSERT INTO `config` VALUES ('language', 'english')");
$num8_7 = mysql_query("INSERT INTO `config` VALUES ('domainname', 'localhost')");
//-------config dump-----------------------
echo"config <font color=#00FF00>Created</font>"; if($num8_1 == "1" AND $num8_2 == "1" AND $num8_3 == "1" AND $num8_4 == "1" AND $num8_5 == "1" AND $num8_6 == "1" AND $num8_7 == "1"){echo" Rows added!";}echo"<br>";
}else{echo"config <font color=#FF0000>Error - Already exists!</font><br>";}

$countries = mysql_query("show tables like 'countries'");
  if(mysql_fetch_row($countries) === false) {
$tabelSQL9 = "CREATE TABLE IF NOT EXISTS `countries` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(50) default NULL,
  `flagpic` varchar(50) default NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM";
$num9 = mysql_query($tabelSQL9);   // creates the table countries
//-------countries dump-----------------------
mysql_query("INSERT INTO `countries` VALUES (1, 'Sweden', 'sweden.gif')");
mysql_query("INSERT INTO `countries` VALUES (2, 'United States of America', 'usa.gif')");
mysql_query("INSERT INTO `countries` VALUES (3, 'Russia', 'russia.gif')");
mysql_query("INSERT INTO `countries` VALUES (4, 'Finland', 'finland.gif')");
mysql_query("INSERT INTO `countries` VALUES (5, 'Canada', 'canada.gif')");
mysql_query("INSERT INTO `countries` VALUES (6, 'France', 'france.gif')");
mysql_query("INSERT INTO `countries` VALUES (7, 'Germany', 'germany.gif')");
mysql_query("INSERT INTO `countries` VALUES (8, 'China', 'china.gif')");
mysql_query("INSERT INTO `countries` VALUES (9, 'Italy', 'italy.gif')");
mysql_query("INSERT INTO `countries` VALUES (10, 'Denmark', 'denmark.gif')");
mysql_query("INSERT INTO `countries` VALUES (11, 'Norway', 'norway.gif')");
mysql_query("INSERT INTO `countries` VALUES (12, 'United Kingdom', 'uk.gif')");
mysql_query("INSERT INTO `countries` VALUES (13, 'Ireland', 'ireland.gif')");
mysql_query("INSERT INTO `countries` VALUES (14, 'Poland', 'poland.gif')");
mysql_query("INSERT INTO `countries` VALUES (15, 'Netherlands', 'netherlands.gif')");
mysql_query("INSERT INTO `countries` VALUES (16, 'Belgium', 'belgium.gif')");
mysql_query("INSERT INTO `countries` VALUES (17, 'Japan', 'japan.gif')");
mysql_query("INSERT INTO `countries` VALUES (18, 'Brazil', 'brazil.gif')");
mysql_query("INSERT INTO `countries` VALUES (19, 'Argentina', 'argentina.gif')");
mysql_query("INSERT INTO `countries` VALUES (20, 'Australia', 'australia.gif')");
mysql_query("INSERT INTO `countries` VALUES (21, 'New Zealand', 'newzealand.gif')");
mysql_query("INSERT INTO `countries` VALUES (23, 'Spain', 'spain.gif')");
mysql_query("INSERT INTO `countries` VALUES (24, 'Portugal', 'portugal.gif')");
mysql_query("INSERT INTO `countries` VALUES (25, 'Mexico', 'mexico.gif')");
mysql_query("INSERT INTO `countries` VALUES (26, 'Singapore', 'singapore.gif')");
mysql_query("INSERT INTO `countries` VALUES (70, 'India', 'india.gif')");
mysql_query("INSERT INTO `countries` VALUES (65, 'Albania', 'albania.gif')");
mysql_query("INSERT INTO `countries` VALUES (29, 'South Africa', 'southafrica.gif')");
mysql_query("INSERT INTO `countries` VALUES (30, 'South Korea', 'southkorea.gif')");
mysql_query("INSERT INTO `countries` VALUES (31, 'Jamaica', 'jamaica.gif')");
mysql_query("INSERT INTO `countries` VALUES (32, 'Luxembourg', 'luxembourg.gif')");
mysql_query("INSERT INTO `countries` VALUES (33, 'Hong Kong', 'hongkong.gif')");
mysql_query("INSERT INTO `countries` VALUES (34, 'Belize', 'belize.gif')");
mysql_query("INSERT INTO `countries` VALUES (35, 'Algeria', 'algeria.gif')");
mysql_query("INSERT INTO `countries` VALUES (36, 'Angola', 'angola.gif')");
mysql_query("INSERT INTO `countries` VALUES (37, 'Austria', 'austria.gif')");
mysql_query("INSERT INTO `countries` VALUES (38, 'Yugoslavia', 'yugoslavia.gif')");
mysql_query("INSERT INTO `countries` VALUES (39, 'Western Samoa', 'westernsamoa.gif')");
mysql_query("INSERT INTO `countries` VALUES (40, 'Malaysia', 'malaysia.gif')");
mysql_query("INSERT INTO `countries` VALUES (41, 'Dominican Republic', 'dominicanrep.gif')");
mysql_query("INSERT INTO `countries` VALUES (42, 'Greece', 'greece.gif')");
mysql_query("INSERT INTO `countries` VALUES (43, 'Guatemala', 'guatemala.gif')");
mysql_query("INSERT INTO `countries` VALUES (44, 'Israel', 'israel.gif')");
mysql_query("INSERT INTO `countries` VALUES (45, 'Pakistan', 'pakistan.gif')");
mysql_query("INSERT INTO `countries` VALUES (46, 'Czech Republic', 'czechrep.gif')");
mysql_query("INSERT INTO `countries` VALUES (47, 'Serbia', 'serbia.gif')");
mysql_query("INSERT INTO `countries` VALUES (48, 'Seychelles', 'seychelles.gif')");
mysql_query("INSERT INTO `countries` VALUES (49, 'Taiwan', 'taiwan.gif')");
mysql_query("INSERT INTO `countries` VALUES (50, 'Puerto Rico', 'puertorico.gif')");
mysql_query("INSERT INTO `countries` VALUES (51, 'Chile', 'chile.gif')");
mysql_query("INSERT INTO `countries` VALUES (52, 'Cuba', 'cuba.gif')");
mysql_query("INSERT INTO `countries` VALUES (53, 'Congo', 'congo.gif')");
mysql_query("INSERT INTO `countries` VALUES (54, 'Afghanistan', 'afghanistan.gif')");
mysql_query("INSERT INTO `countries` VALUES (55, 'Turkey', 'turkey.gif')");
mysql_query("INSERT INTO `countries` VALUES (56, 'Uzbekistan', 'uzbekistan.gif')");
mysql_query("INSERT INTO `countries` VALUES (57, 'Switzerland', 'switzerland.gif')");
mysql_query("INSERT INTO `countries` VALUES (58, 'Kiribati', 'kiribati.gif')");
mysql_query("INSERT INTO `countries` VALUES (59, 'Philippines', 'philippines.gif')");
mysql_query("INSERT INTO `countries` VALUES (60, 'Burkina Faso', 'burkinafaso.gif')");
mysql_query("INSERT INTO `countries` VALUES (61, 'Nigeria', 'nigeria.gif')");
mysql_query("INSERT INTO `countries` VALUES (62, 'Iceland', 'iceland.gif')");
mysql_query("INSERT INTO `countries` VALUES (63, 'Nauru', 'nauru.gif')");
mysql_query("INSERT INTO `countries` VALUES (64, 'Slovenia', 'slovenia.gif')");
mysql_query("INSERT INTO `countries` VALUES (66, 'Turkmenistan', 'turkmenistan.gif')");
mysql_query("INSERT INTO `countries` VALUES (67, 'Bosnia Herzegovina', 'bosniaherzegovina.gif')");
mysql_query("INSERT INTO `countries` VALUES (68, 'Andorra', 'andorra.gif')");
mysql_query("INSERT INTO `countries` VALUES (69, 'Lithuania', 'lithuania.gif')");
mysql_query("INSERT INTO `countries` VALUES (71, 'Netherlands Antilles', 'nethantilles.gif')");
mysql_query("INSERT INTO `countries` VALUES (72, 'Ukraine', 'ukraine.gif')");
mysql_query("INSERT INTO `countries` VALUES (73, 'Venezuela', 'venezuela.gif')");
mysql_query("INSERT INTO `countries` VALUES (74, 'Hungary', 'hungary.gif')");
mysql_query("INSERT INTO `countries` VALUES (75, 'Romania', 'romania.gif')");
mysql_query("INSERT INTO `countries` VALUES (76, 'Vanuatu', 'vanuatu.gif')");
mysql_query("INSERT INTO `countries` VALUES (77, 'Vietnam', 'vietnam.gif')");
mysql_query("INSERT INTO `countries` VALUES (78, 'Trinidad & Tobago', 'trinidadandtobago.gif')");
mysql_query("INSERT INTO `countries` VALUES (79, 'Honduras', 'honduras.gif')");
mysql_query("INSERT INTO `countries` VALUES (80, 'Kyrgyzstan', 'kyrgyzstan.gif')");
mysql_query("INSERT INTO `countries` VALUES (81, 'Ecuador', 'ecuador.gif')");
mysql_query("INSERT INTO `countries` VALUES (82, 'Bahamas', 'bahamas.gif')");
mysql_query("INSERT INTO `countries` VALUES (83, 'Peru', 'peru.gif')");
mysql_query("INSERT INTO `countries` VALUES (84, 'Cambodia', 'cambodia.gif')");
mysql_query("INSERT INTO `countries` VALUES (85, 'Barbados', 'barbados.gif')");
mysql_query("INSERT INTO `countries` VALUES (86, 'Bangladesh', 'bangladesh.gif')");
mysql_query("INSERT INTO `countries` VALUES (87, 'Laos', 'laos.gif')");
mysql_query("INSERT INTO `countries` VALUES (88, 'Uruguay', 'uruguay.gif')");
mysql_query("INSERT INTO `countries` VALUES (89, 'Antigua Barbuda', 'antiguabarbuda.gif')");
mysql_query("INSERT INTO `countries` VALUES (90, 'Paraguay', 'paraguay.gif')");
mysql_query("INSERT INTO `countries` VALUES (93, 'Thailand', 'thailand.gif')");
mysql_query("INSERT INTO `countries` VALUES (92, 'Union of Soviet Socialist Republics', 'ussr.gif')");
mysql_query("INSERT INTO `countries` VALUES (94, 'Senegal', 'senegal.gif')");
mysql_query("INSERT INTO `countries` VALUES (95, 'Togo', 'togo.gif')");
mysql_query("INSERT INTO `countries` VALUES (96, 'North Korea', 'northkorea.gif')");
mysql_query("INSERT INTO `countries` VALUES (97, 'Croatia', 'croatia.gif')");
mysql_query("INSERT INTO `countries` VALUES (98, 'Estonia', 'estonia.gif')");
mysql_query("INSERT INTO `countries` VALUES (99, 'Colombia', 'colombia.gif')");
mysql_query("INSERT INTO `countries` VALUES (100, 'Lebanon', 'lebanon.gif')");
mysql_query("INSERT INTO `countries` VALUES (101, 'Latvia', 'latvia.gif')");
mysql_query("INSERT INTO `countries` VALUES (102, 'Costa Rica', 'costarica.gif')");
mysql_query("INSERT INTO `countries` VALUES (103, 'Egypt', 'egypt.gif')");
mysql_query("INSERT INTO `countries` VALUES (104, 'Bulgaria', 'bulgaria.gif')");
mysql_query("INSERT INTO `countries` VALUES (105, 'Isla de Muerte', 'jollyroger.gif')");
//-------countries dump-----------------------
echo"countries <font color=#00FF00>Created</font><br>";
}else{echo"countries <font color=#FF0000>Error - Already exists!</font><br>";}

$forum_cat = mysql_query("show tables like 'forum_cat'");
  if(mysql_fetch_row($forum_cat) === false) {
$tabelSQL10 = "CREATE TABLE IF NOT EXISTS `forum_cat` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(50) NOT NULL default '',
  `sort` int(5) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM";
$num10 = mysql_query($tabelSQL10);   // creates the table forum_cat
//---------forum_cat dump-----------------------
$num10_1 = mysql_query("INSERT INTO `forum_cat` VALUES (1, 'Forum', 0)");
//---------forum_cat dump-----------------------
echo"forum_cat <font color=#00FF00>Created</font>"; if($num10_1 == "1"){echo" Rows added!";}echo"<br>";
}else{echo"forum_cat <font color=#FF0000>Error - Already exists!</font><br>";}

$forums = mysql_query("show tables like 'forums'");
  if(mysql_fetch_row($forums) === false) {
$tabelSQL11 = "CREATE TABLE IF NOT EXISTS `forums` (
  `sort` tinyint(3) unsigned NOT NULL default '0',
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(60) NOT NULL default '',
  `description` varchar(200) default NULL,
  `minclassread` tinyint(3) unsigned NOT NULL default '0',
  `minclasswrite` tinyint(3) unsigned NOT NULL default '0',
  `postcount` int(10) unsigned NOT NULL default '0',
  `topiccount` int(10) unsigned NOT NULL default '0',
  `minclasscreate` tinyint(3) unsigned NOT NULL default '0',
  `parent_forum` tinyint(4) NOT NULL default '0',
  `forum_category` tinyint(4) NOT NULL default '0',
  `forid` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM";
$num11 = mysql_query($tabelSQL11);   // creates the table forums
//---------forum_cat dump-----------------------
$num11_1 = mysql_query("INSERT INTO `forums` VALUES (1, 1, 'Test Forum', 'This is nothing but a test forum', 0, 0, 4, 3, 0, 0, 0, 0)");
//---------forum_cat dump-----------------------
echo"forums <font color=#00FF00>Created</font>"; if($num11_1 == "1"){echo" Rows added!";}echo"<br>";
}else{echo"forums <font color=#FF0000>Error - Already exists!</font><br>";}

$friends = mysql_query("show tables like 'friends'");
  if(mysql_fetch_row($friends) === false) {
$tabelSQL12 = "CREATE TABLE IF NOT EXISTS `friends` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `userid` int(10) unsigned NOT NULL default '0',
  `friendid` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `userfriend` (`userid`,`friendid`)
) TYPE=MyISAM";
$num12 = mysql_query($tabelSQL12);   // creates the table friends
echo"friends <font color=#00FF00>Created</font><br>";
}else{echo"friends <font color=#FF0000>Error - Already exists!</font><br>";}

$guests = mysql_query("show tables like 'guests'");
  if(mysql_fetch_row($guests) === false) {
$tabelSQL13 = "CREATE TABLE IF NOT EXISTS `guests` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `ip` varchar(15) NOT NULL default '',
  `time_accessed` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM";
$num13 = mysql_query($tabelSQL13);   // creates the table guests
echo"guests <font color=#00FF00>Created</font><br>";
}else{echo"guests <font color=#FF0000>Error - Already exists!</font><br>";}

$messages = mysql_query("show tables like 'messages'");
  if(mysql_fetch_row($messages) === false) {
$tabelSQL14 = "CREATE TABLE IF NOT EXISTS `messages` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `sender` int(10) unsigned NOT NULL default '0',
  `receiver` int(10) unsigned NOT NULL default '0',
  `added` datetime default NULL,
  `subject` varchar(30) NOT NULL default 'No Subject',
  `msg` text,
  `unread` enum('yes','no') NOT NULL default 'yes',
  `poster` bigint(20) unsigned NOT NULL default '0',
  `location` smallint(6) NOT NULL default '1',
  `saved` enum('no','yes') NOT NULL default 'no',
  PRIMARY KEY  (`id`),
  KEY `receiver` (`receiver`)
) TYPE=MyISAM";
$num14 = mysql_query($tabelSQL14);   // creates the table messages
echo"messages <font color=#00FF00>Created</font><br>";
}else{echo"messages <font color=#FF0000>Error - Already exists!</font><br>";}

$news = mysql_query("show tables like 'news'");
  if(mysql_fetch_row($news) === false) {
$tabelSQL15 = "CREATE TABLE IF NOT EXISTS `news` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `userid` int(11) NOT NULL default '0',
  `added` datetime NOT NULL default '0000-00-00 00:00:00',
  `body` text NOT NULL,
  `title` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `added` (`added`)
) TYPE=MyISAM";
$num15 = mysql_query($tabelSQL15);   // creates the table news
echo"news <font color=#00FF00>Created</font><br>";
}else{echo"news <font color=#FF0000>Error - Already exists!</font><br>";}

$pmboxes = mysql_query("show tables like 'pmboxes'");
  if(mysql_fetch_row($pmboxes) === false) {
$tabelSQL16 = "CREATE TABLE IF NOT EXISTS `pmboxes` (
  `id` int(11) NOT NULL auto_increment,
  `userid` int(11) NOT NULL default '0',
  `boxnumber` tinyint(4) NOT NULL default '2',
  `name` varchar(15) NOT NULL default '',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM";
$num16 = mysql_query($tabelSQL16);   // creates the table pmboxes
echo"pmboxes <font color=#00FF00>Created</font><br>";
}else{echo"pmboxes <font color=#FF0000>Error - Already exists!</font><br>";}

$posts = mysql_query("show tables like 'posts'");
  if(mysql_fetch_row($posts) === false) {
$tabelSQL17 = "CREATE TABLE IF NOT EXISTS `posts` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `topicid` int(10) unsigned NOT NULL default '0',
  `userid` int(10) unsigned NOT NULL default '0',
  `added` datetime default NULL,
  `body` text,
  `editedby` int(10) unsigned NOT NULL default '0',
  `editedat` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`id`),
  KEY `topicid` (`topicid`),
  KEY `userid` (`userid`),
  FULLTEXT KEY `body` (`body`)
) TYPE=MyISAM";
$num17 = mysql_query($tabelSQL17);   // creates the table posts
echo"posts <font color=#00FF00>Created</font><br>";
}else{echo"posts <font color=#FF0000>Error - Already exists!</font><br>";}

$readposts = mysql_query("show tables like 'readposts'");
  if(mysql_fetch_row($readposts) === false) {
$tabelSQL18 = "CREATE TABLE IF NOT EXISTS `readposts` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `userid` int(10) unsigned NOT NULL default '0',
  `topicid` int(10) unsigned NOT NULL default '0',
  `lastpostread` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `userid` (`id`),
  KEY `topicid` (`topicid`)
) TYPE=MyISAM";
$num18 = mysql_query($tabelSQL18);   // creates the table readposts
echo"readposts <font color=#00FF00>Created</font><br>";
}else{echo"readposts <font color=#FF0000>Error - Already exists!</font><br>";}

$sitelog = mysql_query("show tables like 'sitelog'");
  if(mysql_fetch_row($sitelog) === false) {
$tabelSQL19 = "CREATE TABLE IF NOT EXISTS `sitelog` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `added` datetime default NULL,
  `txt` text,
  PRIMARY KEY  (`id`),
  KEY `added` (`added`)
) TYPE=MyISAM";
$num19 = mysql_query($tabelSQL19);   // creates the table sitelog
echo"sitelog <font color=#00FF00>Created</font><br>";
}else{echo"sitelog <font color=#FF0000>Error - Already exists!</font><br>";}

$topics = mysql_query("show tables like 'topics'");
  if(mysql_fetch_row($topics) === false) {
$tabelSQL20 = "CREATE TABLE IF NOT EXISTS `topics` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `userid` int(10) unsigned NOT NULL default '0',
  `subject` varchar(40) default NULL,
  `locked` enum('yes','no') NOT NULL default 'no',
  `forumid` int(10) unsigned NOT NULL default '0',
  `lastpost` int(10) unsigned NOT NULL default '0',
  `sticky` enum('yes','no') NOT NULL default 'no',
  `views` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `userid` (`userid`),
  KEY `subject` (`subject`),
  KEY `lastpost` (`lastpost`)
) TYPE=MyISAM";
$num20 = mysql_query($tabelSQL20);   // creates the table topics
echo"topics <font color=#00FF00>Created</font><br>";
}else{echo"topics <font color=#FF0000>Error - Already exists!</font><br>";}

$sh_saveskills = mysql_query("show tables like 'sh_saveskills'");
  if(mysql_fetch_row($sh_saveskills) === false) {
    $tabelSQL21 = "CREATE TABLE IF NOT EXISTS `sh_saveskills` (
    `SH_KEY` varchar(34) NOT NULL default '',
    `SKILL_NUMBER` int(10) unsigned NOT NULL default '0',
    `HERO_NAME` varchar(25) NOT NULL default '',
    PRIMARY KEY  (`SH_KEY`,`SKILL_NUMBER`)
    ) TYPE=MyISAM COMMENT='SUPERHERO Skill Saving Table'";
    $num21 = mysql_query($tabelSQL21);   // creates the table sh_saveskills
	if($num21 = "1"){
	echo"sh_saveskills <font color=#00FF00>Created</font><br>";
	}else{
	echo"sh_saveskills <font color=#FF0000>Error - Already exists!</font><br>";
	}
  }
  else {
    mysql_query("ALTER TABLE `sh_saveskills` CHANGE `SH_KEY` `SH_KEY` VARCHAR( 34 ) NOT NULL");
	echo"sh_saveskills <font color=#00FF00>Table Updated!</font><br>";
  }

$sh_savexp = mysql_query("show tables like 'sh_savexp'");
  if(mysql_fetch_row($sh_savexp) === false) {
    $tabelSQL22 = "CREATE TABLE IF NOT EXISTS `sh_savexp` (
    `SH_KEY` varchar(34) NOT NULL default '',
    `PLAYER_NAME` varchar(32) NOT NULL default '',
    `LAST_PLAY_DATE` timestamp(14) NOT NULL,
    `XP` int(10) unsigned NOT NULL default '0',
    `HUDHELP` tinyint(1) unsigned NOT NULL default '1',
    `SKILL_COUNT` int(3) unsigned NOT NULL default '0',
    PRIMARY KEY  (`SH_KEY`)
    ) TYPE=MyISAM COMMENT='SUPERHERO XP Saving Table'";
    $num22 = mysql_query($tabelSQL22);   // creates the table sh_savexp
	if($num22 = "1"){
	echo"sh_savexp <font color=#00FF00>Created</font><br>";
	}else{
	echo"sh_savexp <font color=#FF0000>Error - Already exists!</font><br>";
	}
	}else{
	$num22_1 = mysql_query("ALTER TABLE `sh_savexp` CHANGE `SH_KEY` `SH_KEY` VARCHAR( 34 ) NOT NULL");
	$num22_2 = mysql_query("ALTER TABLE `sh_savexp` CHANGE `PLAYER_NAME` `PLAYER_NAME` VARCHAR( 32 ) NOT NULL");
	echo"sh_savexp <font color=#00FF00>Table Updated!</font><br>";
	}
?>
  </td>
 </tr>
 <tr>
  <td>
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
  <input name="dbhost" type="hidden" id="dbhost" value="<? echo"".$_POST["dbhost"]."";?>">
  <input name="dbusername" type="hidden" id="dbusername" value="<? echo"".$_POST["dbusername"]."";?>">
  <input name="dbpasswd" type="hidden" id="dbpasswd" value="<? echo"".$_POST["dbpasswd"]."";?>">
  <input name="database_name" type="hidden" id="database_name" value="<? echo"".$_POST["database_name"]."";?>">
  <input name="step" type="hidden" value="3"><input name="test" type="submit" class="input" value="Next step (3/<?=$steps;?>)">
  </form>
  </td>
 </tr>
</table>

<? 
}
if($_POST["step"] == "3"){?>
<table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse; border: 1px solid #000000" width="735">
 <tr>
  <td width="100%">Step 3/<?=$steps;?> - Admin information.</td>
 </tr>
</table>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<table width="100%">
 <tr>
  <td colspan="2" align=left><strong>Admin Information: </strong></td>
 </tr>
 <tr>
  <td align=left>Admin Username: </td>
  <td align=left valign=top><input name="admin" type="text" class="input" id="admin" size="30"></td>
 </tr>
 <tr>
  <td align=left>Admin Password:</td>
  <td align=left valign=top><input name="pass" type="text" class="input" id="pass" size="30"></td>
 </tr>
 <tr>
  <td align=left>Admin Email: </td>
  <td align=left valign=top><input name="email" type="text" class="input" id="email" size="30"></td>
 </tr>
 <tr>
  <td align=left>Admin SteamID: </td>
  <td align=left valign=top><input name="steamid" type="text" class="input" id="steamid" size="30"></td>
 </tr>
 <tr>
  <td align=left>
<input name="dbhost" type="hidden" id="dbhost" value="<? echo"".$_POST["dbhost"]."";?>">
<input name="dbusername" type="hidden" id="dbusername" value="<? echo"".$_POST["dbusername"]."";?>">
<input name="dbpasswd" type="hidden" id="dbpasswd" value="<? echo"".$_POST["dbpasswd"]."";?>">
<input name="database_name" type="hidden" id="database_name" value="<? echo"".$_POST["database_name"]."";?>">
  <input name="step" type="hidden" value="3-2"><input name="test" type="submit" class="input" value="Create Account">
  </form></td>
  <td align=left>&nbsp;</td>
 </tr>
</table>
<?
}

if($_POST["step"] == "3-2"){?>
<table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse; border: 1px solid #000000" width="735">
 <tr>
  <td width="100%">Step 3/<?=$steps;?> - Admin information.</td>
 </tr>
</table>
<table width="100%">
 <tr>
  <td colspan="2" align=left>
<?
$connection = mysql_pconnect("".$_POST["dbhost"]."","".$_POST["dbusername"]."","".$_POST["dbpasswd"]."") or die ("Couldn't connect to server.");
$db = mysql_select_db("".$_POST["database_name"]."", $connection) or die("Couldn't select database.");

if($_POST["admin"] && $_POST["pass"] && $_POST["email"] && $_POST["steamid"]){
//echo"$_POST[admin] && $_POST[pass] && $_POST[email] && $_POST[steamid]";
$thetime = get_date_time();
$pass = $_POST["pass"];
$password = md5($pass);
mysql_query("INSERT INTO `users` (`id` , `username` , `passhash` , `email` , `status` , `added`, `class` , `steamid` ) VALUES ('1', '".$_POST["admin"]."', '$password', '".$_POST["email"]."', 'confirmed', '$thetime', '3', '".$_POST["steamid"]."') ");
echo"Admin Added!<br><br>";
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<input name="dbhost" type="hidden" id="dbhost" value="<? echo"".$_POST["dbhost"]."";?>">
<input name="dbusername" type="hidden" id="dbusername" value="<? echo"".$_POST["dbusername"]."";?>">
<input name="dbpasswd" type="hidden" id="dbpasswd" value="<? echo"".$_POST["dbpasswd"]."";?>">
<input name="database_name" type="hidden" id="database_name" value="<? echo"".$_POST["database_name"]."";?>">
  <input name="step" type="hidden" value="4"><input name="go" type="submit" class="input" value="Next step (4/<?=$steps;?>)">
  </form>
<?
}else{
echo"You need to fill all the fields!";
}
?>
</td>
 </tr>
</table>
<?
}
if($_POST["step"] == "4"){?>
<table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse; border: 1px solid #000000" width="735">
 <tr>
  <td width="100%">Step 4/<?=$steps;?> - Server Configuration.</td>
 </tr>
</table>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<table width="100%">
 <tr>
                    <td colspan="2" align=left><strong>Server Information: </strong></td>
                  </tr>
                  <tr>
                    <td align=left>Server Name: </td>
                    <td align=left valign=top><input name="servername" type="text" class="input" id="servername" size="30"></td>
                  </tr>
                  <tr>
                    <td align=left>Server IP:</td>
                    <td align=left valign=top><input name="serverip" type="text" class="input" id="serverip" size="30"></td>
                  </tr>
 <tr>
  <td align=left>
<input name="dbhost" type="hidden" id="dbhost" value="<? echo"".$_POST["dbhost"]."";?>">
<input name="dbusername" type="hidden" id="dbusername" value="<? echo"".$_POST["dbusername"]."";?>">
<input name="dbpasswd" type="hidden" id="dbpasswd" value="<? echo"".$_POST["dbpasswd"]."";?>">
<input name="database_name" type="hidden" id="database_name" value="<? echo"".$_POST["database_name"]."";?>">
  <input name="step" type="hidden" value="4-2"><input name="test" type="submit" class="input" value="Set Configuration">
  </form></td>
  <td align=left>&nbsp;</td>
 </tr>
</table>
<?
}
if($_POST["step"] == "4-2"){?>
<table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse; border: 1px solid #000000" width="735">
 <tr>
  <td width="100%">Step 4/<?=$steps;?> - Server Configuration.</td>
 </tr>
</table>
<table width="100%">
 <tr>
  <td colspan="2" align=left>
<?
$connection = mysql_pconnect("".$_POST["dbhost"]."","".$_POST["dbusername"]."","".$_POST["dbpasswd"]."") or die ("Couldn't connect to server.");
$db = mysql_select_db("".$_POST["database_name"]."", $connection) or die("Couldn't select database.");

if($_POST["servername"] && $_POST["serverip"]){
//echo"$_POST[admin] && $_POST[pass] && $_POST[email] && $_POST[steamid]";
mysql_query("INSERT INTO `sh_config` VALUES ('1', '51200', '10', '1', '".$_POST["servername"]."', '".$_POST["serverip"]."', 'stats', '20', 'blue')");
echo"Configuration set!<br><br>";
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<input name="dbhost" type="hidden" id="dbhost" value="<? echo"".$_POST["dbhost"]."";?>">
<input name="dbusername" type="hidden" id="dbusername" value="<? echo"".$_POST["dbusername"]."";?>">
<input name="dbpasswd" type="hidden" id="dbpasswd" value="<? echo"".$_POST["dbpasswd"]."";?>">
<input name="database_name" type="hidden" id="database_name" value="<? echo"".$_POST["database_name"]."";?>">
  <input name="step" type="hidden" value="fin"><input name="go" type="submit" class="input" value="Finish">
  </form>
<?
}else{
echo"You need to fill all the fields!";
}
?>
</td>
 </tr>
</table>
<?
}

if($_POST["step"] == "fin"){?>
<table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse; border: 1px solid #000000" width="735">
 <tr>
  <td width="100%">Step 5/<?=$steps;?> - Installation finished.</td>
 </tr>
</table>
<table width="100%">
 <tr>
  <td colspan="2" align=left>
  <?
  echo"\$mysql_host = \"".$_POST["dbhost"]."\";
\$mysql_user = \"".$_POST["dbusername"]."\";
\$mysql_pass = \"".$_POST["dbpasswd"]."\";
\$mysql_db = \"".$_POST["database_name"]."\";<br><br>";
/*$lafil = "secrets.php";
$fil = fopen($lafil,"w") or die("can't open file");;  
$tekst = "<?
$mysql_host = \"$_POST[dbhost]\";
$mysql_user = \"$_POST[dbusername]\";
$mysql_pass = \"$_POST[dbpasswd]\";
$mysql_db = \"$_POST[database_name]\";
 ?>";
fwrite($fil, $tekst, strlen($tekst));
fclose($fil);*/
makepage("secrets.php");
  ?>
The installation is now done.<br> We strongly suggest that you delete the 'install' dir.<br><br>If you have any problems, go to <a href=\"http://sh-mod.mfhosting.com\">this</a> supportside.
</td>
 </tr>
</table>
<?
}

function makepage($pagename)
{
  $pagenameHandle = fopen("../include/".$pagename."", 'w') or die("can't open file");
$text = "<?
\$mysql_host = \"$_POST[dbhost]\";
\$mysql_user = \"$_POST[dbusername]\";
\$mysql_pass = \"$_POST[dbpasswd]\";
\$mysql_db = \"$_POST[database_name]\";
 ?>";
fwrite($pagenameHandle, $text, strlen($text));
  fclose($pagenameHandle);
  echo"File: secrets created.<br>";
}
function get_date_time($timestamp = 0)
{
  if ($timestamp)
    return date("Y-m-d H:i:s", $timestamp);
  else
    return gmdate("Y-m-d H:i:s");
}
?><br>
        <table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse; border: 1px solid #000000" width="735">
          <tr>
            <td width="100%"><div align="center">
                Powered by <a href=http://sh-mod.mfhosting.com target=_blank>SH Stats</a>
            </div></td>
          </tr>
      </table></td>
  </tr>
</table></div>
</body>
</html>