Файл: CMS/votes/install.php
Строк: 57
<?php
define('CMS',TRUE);
include('cfg.php');
define('COLLATE','utf8');
$tbl[] = "CREATE TABLE IF NOT EXISTS ?_vote (
`vote_id` smallint(4) unsigned NOT NULL auto_increment,
`vote_title` varchar(100) NOT NULL,
`vote_count` smallint(4) unsigned NOT NULL default '0',
`vote_closed` tinyint(1) unsigned NOT NULL default '0',
`vote_time` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`vote_id`)
) ENGINE=MyISAM /*!40101 DEFAULT CHARACTER SET " . COLLATE . " COLLATE " . COLLATE . "_general_ci */";
$tbl[] = "CREATE TABLE IF NOT EXISTS ?_vote_answer (
`answer_id` mediumint(8) unsigned NOT NULL auto_increment,
`answer_vote_id` smallint(4) unsigned NOT NULL,
`answer_option` varchar(50) NOT NULL,
`answer_result` smallint(4) unsigned NOT NULL default '0',
PRIMARY KEY (`answer_id`)
) ENGINE=MyISAM /*!40101 DEFAULT CHARACTER SET " . COLLATE . " COLLATE " . COLLATE . "_general_ci */";
$tbl[] = "CREATE TABLE IF NOT EXISTS ?_vote_poll (
`poll_id` int(11) unsigned NOT NULL auto_increment,
`poll_vote_id` smallint(4) unsigned NOT NULL,
`poll_user` varchar(20) NOT NULL,
PRIMARY KEY (`poll_id`)
) ENGINE=MyISAM /*!40101 DEFAULT CHARACTER SET " . COLLATE . " COLLATE " . COLLATE . "_general_ci */";
$tbl[] = "INSERT INTO ?_vote (`vote_id`, `vote_title`, `vote_count`, `vote_closed`, `vote_time`) VALUES
(1, 'Оцените работу движка', 0, 0, '" . time() . "');";
$tbl[] = "INSERT INTO ?_vote_answer (`answer_id`, `answer_vote_id`, `answer_option`, `answer_result`) VALUES
(1, 1, 'Лучший из лучших', 0),
(2, 1, 'Неплохой движок', 0),
(3, 1, 'Устраивает ... но ...', 0),
(4, 1, 'Встречал и получше', 0),
(5, 1, 'Совсем не понравился', 0);";
for ( $i = 0; $i < count( $tbl ); ++$i ) {
$db->query( $tbl[$i] );
}
?>
OK