Просмотр файла install/index5.php

Размер файла: 5.99Kb
<?php
extract($_POST);

$fp=fopen('../config.php', w);
fwrite($fp, '<?php'."\r");
fwrite($fp, '$server = "'.$server.'";'."\r");
fwrite($fp, '$user = "'.$name.'";'."\r");
fwrite($fp, '$password = "'.$pass.'";'."\r");
fwrite($fp, '$db = "'.$db.'";'."\r");
fwrite($fp, '$pref = "'.$pref.'";'."\r");
fwrite($fp, 'if (!mysql_connect($server, $user, $password)) {'."\r");
fwrite($fp, 'echo "Ошибка подключения к серверу MySQL";'."\r");
fwrite($fp, 'exit;'."\r");
fwrite($fp, '}'."\r");
fwrite($fp, 'mysql_select_db($db) or die("Нипалучается выбрать базу данных");'."\r");
fwrite($fp, '?>');
fclose($fp);

$user = $name;
$password = $pass;
//$db = "optima";
//$pref = "cms_";
if (!mysql_connect($server, $user, $password)) {
echo "Ошибка подключения к серверу MySQL";
exit;
}
mysql_select_db($db) or die("Нипалучается выбрать базу данных");

$query='CREATE TABLE `'.$pref.'book` ( `id` int(10) NOT NULL auto_increment, `id_user` int(20) NOT NULL default 0, `data` text NOT NULL, `vrem` text NOT NULL, `dataunix` int(30) NOT NULL default 0, `login` text NOT NULL, `msg` text NOT NULL, `otvet` text NOT NULL, `brow` text NOT NULL, `ip` text NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=4';
mysql_query($query);
$query='CREATE TABLE `'.$pref.'config` ( `nomer` int(2) NOT NULL default 1, `adm` int(11) NOT NULL default 1, `nos` text NOT NULL, `theme` varchar(15) NOT NULL default "", `kolbook` int(20) NOT NULL default 0, `kolforum_thema` int(10) NOT NULL default 0, `kolforum_post` int(10) NOT NULL default 0, `indown` int(2) NOT NULL default 0, `innews` int(2) NOT NULL default 0, `news_in_index` int(2) NOT NULL default 0, `count` int(1) NOT NULL default 0, `pic_count` text NOT NULL, `gzip` int(1) NOT NULL default 0) ENGINE=MyISAM DEFAULT CHARSET=cp1251;';
mysql_query($query);
$query='CREATE TABLE `'.$pref.'counter` ( `id` int(1) NOT NULL default 1, `host` int(20) NOT NULL default 0, `hit` int(20) NOT NULL default 0, `day` int(3) NOT NULL default 0) ENGINE=MyISAM DEFAULT CHARSET=cp1251;';
mysql_query($query);
$query='CREATE TABLE `'.$pref.'down_files` ( `id` int(50) NOT NULL auto_increment, `name` text NOT NULL, `opis` text NOT NULL, `skrin` text NOT NULL, PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=5 ;';
mysql_query($query);
$query='CREATE TABLE `'.$pref.'forum` ( `id` int(20) NOT NULL auto_increment, `nomer` int(20) NOT NULL default 0, `name` text NOT NULL, `opis` text NOT NULL, `pravila` text NOT NULL, `last_theme_id` int(11) NOT NULL default 0, `last_theme` text NOT NULL, `last_autor` text NOT NULL, `last_autor_id` int(11) NOT NULL default 0, `last_time` text NOT NULL, PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=2 ;';
mysql_query($query);
$query='CREATE TABLE `'.$pref.'host_hit` ( `id` int(11) NOT NULL auto_increment, `soft` text NOT NULL, `ip` text NOT NULL, PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=2 ;';
mysql_query($query);
$query='CREATE TABLE `'.$pref.'news` ( `id` int(50) NOT NULL auto_increment, `id_user` int(50) NOT NULL default 0, `data` text NOT NULL, `vrem` text NOT NULL, `dataunix` int(50) NOT NULL default 0, `login` text NOT NULL, `msg` text NOT NULL, `komm` text NOT NULL, PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=4 ;';
mysql_query($query);
$query='CREATE TABLE `'.$pref.'online_guest` ( `soft_guest` text NOT NULL, `ip_guest` text NOT NULL, `gde_guest` text NOT NULL, `data_unix` int(50) NOT NULL default 0) ENGINE=MyISAM DEFAULT CHARSET=cp1251;';
mysql_query($query);
$query='CREATE TABLE `'.$pref.'online_user` ( `id_user` int(50) NOT NULL default 0, `login_user` text NOT NULL, `soft_user` text NOT NULL, `ip_user` text NOT NULL, `gde_user` text NOT NULL, `data_unix` int(50) NOT NULL default 0) ENGINE=MyISAM DEFAULT CHARSET=cp1251;';
mysql_query($query);
$query='CREATE TABLE `'.$pref.'tema` ( `id` int(30) NOT NULL auto_increment, `name_tema` text NOT NULL, `in_razd` int(10) NOT NULL default 0, `all_post` int(10) NOT NULL default 0, `first_post` text NOT NULL, `first_post_id` int(20) NOT NULL default 0, `last_post` text NOT NULL, `last_post_id` int(11) NOT NULL default 0, `data_first` int(50) NOT NULL default 0, `data_last` int(50) NOT NULL default 0, `data_last_post` int(50) NOT NULL default 0, `tema_nomer` int(50) NOT NULL default 0, PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=6 ;';
mysql_query($query);
$query='CREATE TABLE `'.$pref.'useres` ( `id` int(20) NOT NULL auto_increment, `login` text NOT NULL, `pwd` text NOT NULL, `dostup` int(3) NOT NULL default 0, `name` text NOT NULL, `city` text NOT NULL,  `pol` char(1) NOT NULL default "", `email` text NOT NULL, `icq` int(15) NOT NULL default 0, `data` text NOT NULL, `dataunix` int(50) NOT NULL default 0, `theme` text NOT NULL, `kolbook` int(20) NOT NULL default 0, `kolforum_thema` int(10) NOT NULL default 0, `kolforum_post` int(10) NOT NULL default 0, `indown` int(2) NOT NULL default 0, `innews` int(20) NOT NULL default 0, PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=4 ;';
mysql_query($query);
$query='INSERT INTO `'.$pref.'config` ( `adm` , `nos` , `theme` , `kolbook` , `kolforum_thema` , `kolforum_post` , `indown` , `innews` , `news_in_index` , `count` , `pic_count` , `gzip` ) VALUES (1, "Optima-CMS", "default", 10, 10, 10, 10, 10, 1, 0, "http://", 0);';
mysql_query($query);
$query='INSERT INTO `'.$pref.'useres` (`login` , `pwd` , `dostup` , `name` , `city` , `pol` , `email` , `icq` , `data` , `dataunix` , `theme` , `kolbook` , `kolforum_thema` , `kolforum_post` , `indown` , `innews` ) VALUES ("'.$login.'", "'.md5($passite).'", 1, "'.$imia.'", "'.$gorod.'", "'.$pol.'", "", "", "'.date("d-m-y H:i:s", time()).'", '.time().', "default", 10, 10, 10, 10, 10);';
mysql_query($query);
$query='INSERT INTO `'.$pref.'counter` (`host` , `hit` , `day` ) VALUES (0, 0, 0);';
mysql_query($query);
header("Location: index6.php");
?>