<?
 
 if ($heslo!="" AND $nick!="")
 {
  include 'config.php';

  /*Generuje tabulku servers*/
  $dotaz = "CREATE TABLE IF NOT EXISTS `servers` (
  `id_server` int(11) NOT NULL auto_increment,
  `ip` varchar(20) character set latin1 NOT NULL,
  `nazev` varchar(50) collate latin2_czech_cs NOT NULL,
  `time` int(11) NOT NULL,
  `activ` enum('0','1') character set latin1 NOT NULL,
  `dostupnost` varchar(50) character set latin1 NOT NULL,
  `naposled` int(11) NOT NULL,
  `pocethitu` int(11) NOT NULL,
  `uptime` varchar(60) collate latin2_czech_cs NOT NULL,
  `memdnu` int(11) NOT NULL,
  PRIMARY KEY  (`id_server`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin2 COLLATE=latin2_czech_cs AUTO_INCREMENT=1 ";

  $result = mysql_query($dotaz);
  
    /*Generuje tabulku zatez*/
  $dotaz = "CREATE TABLE IF NOT EXISTS `zatez` (
  `id_server` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  `cpu` float NOT NULL,
  `ramused` float NOT NULL,
  `ramall` float NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_czech_cs";

  $result = mysql_query($dotaz);
  
    /*Generuje tabulku dostupnost*/
  $dotaz = "CREATE TABLE IF NOT EXISTS `dostupnost` (
  `id_server` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  `dostupnost` float NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_czech_cs";

  $result = mysql_query($dotaz);
  

  /*Generuje tabulku services*/
  $dotaz = "CREATE TABLE IF NOT EXISTS `services` (
  `id_services` int(11) NOT NULL auto_increment,
  `id_server` int(11) NOT NULL,
  `nazev` varchar(100) NOT NULL,
  `vlastnik` varchar(100) NOT NULL,
  `stav` varchar(50) NOT NULL,
  `cpu` varchar(50) NOT NULL,
  `ram` varchar(50) NOT NULL,
  `start` varchar(50) NOT NULL,
  `ppid` varchar(30) NOT NULL,
  PRIMARY KEY  (`id_services`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ";

  $result = mysql_query($dotaz);

  /*Generuje tabulku users*/
  $dotaz = "CREATE TABLE IF NOT EXISTS `users` (
  `userid` int(25) NOT NULL auto_increment,
  `nick` varchar(25) collate latin2_czech_cs NOT NULL default '',
  `PASSWORD` varchar(255) collate latin2_czech_cs NOT NULL default '',
  `pravo` enum('0','1','2') collate latin2_czech_cs NOT NULL default '0',
  `last_akce` int(11) default '0',
  `activated` enum('0','1') collate latin2_czech_cs NOT NULL default '0',
  `online` enum('0','1') collate latin2_czech_cs NOT NULL default '0',
  `email` varchar(70) collate latin2_czech_cs NOT NULL,
  PRIMARY KEY  (`userid`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin2 COLLATE=latin2_czech_cs COMMENT='Membership Information' AUTO_INCREMENT=1 ";

  $result = mysql_query($dotaz);
  $heslo=md5($heslo);
  /*Přidání uživatele*/
  $dotaz = "INSERT INTO `users` (`userid`, `nick`, `PASSWORD`, `pravo`, `last_akce`, `activated`, `online`, `email`) VALUES 
           ('', '".$nick."' , '".$heslo."', '0', 1197380061, '1', '0', '".$email."')";
  $result = mysql_query($dotaz);
  echo "Tabulky byly uspesne vygenerovany.";
 }
 else
  echo "Nezadali jste nektere udaje!";

?>
