diff --git a/install.php b/install.php new file mode 100644 index 0000000..b6b42f9 --- /dev/null +++ b/install.php @@ -0,0 +1,48 @@ + + +

Installer

+ +"; +} else { + echo "Table 'Blog' created successfully.
"; +} + +# Try to create 'users' table +$sql = "CREATE TABLE `users` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(20) NOT NULL,`name` varchar(40) NOT NULL,`password` varchar(64) NOT NULL,`salt` int(64) NOT NULL,`session` int(64), PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; +$result = mysql_query($sql); +if (mysql_error()) { + echo mysql_error() . ".
"; +} else { + echo "Table 'Users' created successfully.
"; +} + +# Try to create 'admin' user +$sql = "INSERT INTO `users` (`id`, `username`, `name`, `password`, `session`) VALUES (NULL, 'admin', 'Admin', PASSWORD('admin'), RAND(10000), NULL);"; +$result = mysql_query($sql); +if (mysql_error()) { + echo "User 'admin' already exists.
"; +} else { + echo "User 'admin/admin' created successfully.
"; +} + +end_html(); +?>