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

Размер файла: 4.51Kb
<?php 
// by mides, 1da.su

$title = 'Установка новостной ленты mNews';
require_once 'db.php';
require_once 'header.php';

echo '<div class="title">Установка новостной ленты mNews</div><div class="main">';

switch ($_GET['act']) {
	default:
		echo '<form action="?act=do" method="post">Логин администратора(max20):<br /><input name="login" type="text" maxlength="20"><br />
		Пароль(max30):<br /><input name="pass" type="text" maxlength="20"><br />
		<input name="submit" type="submit" value="&#1059;&#1089;&#1090;&#1072;&#1085;&#1086;&#1074;&#1082;&#1072;!" />
		</form>
		</div>
		<div class="navigation">by <a href="http://1da.su">mides</a> 2011</div>';
	break;
	
	case 'do':
		$login = $_POST['login'];
		$pass = $_POST['pass'];
		mysql_query("CREATE TABLE IF NOT EXISTS `news` (
		  `id` int(11) NOT NULL AUTO_INCREMENT,
		  `title` varchar(100) NOT NULL,
		  `text` text NOT NULL,
		  `time` int(10) NOT NULL,
		  `rating` int(11) NOT NULL,
		  `views` int(11) NOT NULL,
		  `closed` int(1) NOT NULL,
		  PRIMARY KEY (`id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2");
		mysql_query("INSERT INTO `news` (`id`, `title`, `text`, `time`, `rating`, `views`, `closed`) VALUES (1, 'Установка', 'Если вы читаете эту новость, скрипт успешно установлен :)', '".time()."', 0, 0, 0)");
		mysql_query("CREATE TABLE IF NOT EXISTS `news_comm` (
		  `id` int(11) NOT NULL AUTO_INCREMENT,
		  `id_news` int(11) NOT NULL,
		  `login` varchar(20) NOT NULL,
		  `text` varchar(250) NOT NULL,
		  `time` int(10) NOT NULL,
		  `edit_time` int(10) NOT NULL,
		  `agent` varchar(250) NOT NULL,
		  `ip` varchar(100) NOT NULL,
		  PRIMARY KEY (`id`)
		) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1");
		mysql_query("CREATE TABLE IF NOT EXISTS `settings` (
		  `login` varchar(20) NOT NULL,
		  `pass` varchar(30) NOT NULL,
		  `main` varchar(50) NOT NULL,
		  `onpage` int(3) NOT NULL,
		  `symbol` int(4) NOT NULL,
		  `comm` int(1) NOT NULL,
		  `antispam` int(3) NOT NULL,
		  `alternate` int(1) NOT NULL
		) ENGINE=MyISAM DEFAULT CHARSET=utf8");
		mysql_query("INSERT INTO `settings` (`login`, `pass`, `main`, `onpage`, `symbol`, `comm`, `antispam`, `alternate`) VALUES ('$login', '$pass', '1da.su', 7, 120, 1, 15, 0)");
		mysql_query("CREATE TABLE IF NOT EXISTS `smiles` (
		  `id` int(11) NOT NULL AUTO_INCREMENT,
		  `code` varchar(50) NOT NULL,
		  `path` varchar(50) NOT NULL,
		  PRIMARY KEY (`id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=38");
		mysql_query("INSERT INTO `smiles` (`id`, `code`, `path`) VALUES
		(1, ':)', 'smiles/1.gif'),
		(2, ':-)', 'smiles/2.gif'),
		(3, ';))', 'smiles/4.gif'),
		(4, ':sad', 'smiles/4.gif'),
		(5, ';)', 'smiles/5.gif'),
		(6, '%0', 'smiles/6.gif'),
		(7, ':(', 'smiles/7.gif'),
		(8, ':-(', 'smiles/8.gif'),
		(9, ':yy', 'smiles/9.gif'),
		(10, ':sho', 'smiles/10.gif'),
		(11, ':o_o', 'smiles/11.gif'),
		(12, ':crazy', 'smiles/12.gif'),
		(13, ':d', 'smiles/13.gif'),
		(14, ':-d', 'smiles/14.gif'),
		(15, ':peace', 'smiles/15.gif'),
		(16, ':flud', 'smiles/16.gif'),
		(17, ':closed', 'smiles/17.gif'),
		(18, ':angry', 'smiles/18.gif'),
		(19, ':bravo', 'smiles/19.gif'),
		(20, ':ban', 'smiles/20.gif'),
		(21, ':f', 'smiles/21.gif'),
		(22, ':welcome', 'smiles/22.gif'),
		(23, ':good', 'smiles/23.gif'),
		(24, ':ubanned', 'smiles/24.gif'),
		(25, ':spam', 'smiles/25.gif'),
		(26, ':shut', 'smiles/26.gif'),
		(27, ':shock', 'smiles/27.gif'),
		(28, ':read', 'smiles/28.gif'),
		(29, ':overlook', 'smiles/29.gif'),
		(30, ':oops', 'smiles/30.gif'),
		(31, ':?', 'smiles/31.gif'),
		(32, ':@', 'smiles/32.gif'),
		(33, ';/', 'smiles/33.gif'),
		(34, ':off', 'smiles/34.gif'),
		(35, ':lol', 'smiles/35.gif'),
		(36, ':hack', 'smiles/36.gif'),
		(37, ':sorry', 'smiles/37.gif')");
		mysql_query("UPDATE `settings` SET `login` = '$login', `pass` = '$pass'");
		echo 'Установка завершена. Удалите файл install.php<br />Ваш логин и пароль: '.$login.' & '.$pass.'<br />
		Автологин:<br /><input name="auto" type="text" value="http://'.$_SERVER['HTTP_HOST'].'/папка_с_новостями/a.php?act=do&amp;l='.$login.'&amp;p='.$pass.'" /><br /><a href="a.php?act=do&amp;l='.$login.'&amp;p='.$pass.'">Войти по автологину</a></div>
		<div class="navigation">by <a href="http://1da.su">mides</a> 2011</div>';
	break;
}

require_once 'tail.php';
?>