*/ use wishthis\{Page, Database}; if ($options && $options->getOption('isInstalled')) { header('Location: /?page=login'); die(); } $page = new page(__FILE__, 'Install'); $page->header(); $step = isset($_POST['step']) ? $_POST['step'] : 1; switch ($step) { case 1: ?>

Install

Step

Welcome to the wishthis installer.

wishthis needs a database to function properly. Please enter your credentials.

$value) { if ('DATABASE' === substr($key, 0, 8)) { $configContents = preg_replace('/(' . $key . '.+?\').*?(\')/', '$1' . $value . '$2', $configContents); } } file_put_contents($configPath, $configContents); ?>

Install

Step

Click Continue to test the database connection.

query('CREATE TABLE `users` ( `id` int PRIMARY KEY AUTO_INCREMENT, `email` varchar(64) NOT NULL UNIQUE, `password` varchar(128) NOT NULL );'); /** * Wishlists */ $database->query('CREATE TABLE `wishlists` ( `id` int PRIMARY KEY AUTO_INCREMENT, `user` int NOT NULL, `name` varchar(128) NOT NULL );'); /** * Products */ $database->query('CREATE TABLE `products` ( `id` int NOT NULL PRIMARY KEY AUTO_INCREMENT, `wishlist` int NOT NULL, `url` VARCHAR(255) NOT NULL FOREIGN KEY (`wishlist`) REFERENCES `wishlists` (id) ON DELETE CASCADE );'); /** * Options */ $database->query('CREATE TABLE `options` ( `id` int PRIMARY KEY AUTO_INCREMENT, `key` varchar(64) NOT NULL UNIQUE, `value` varchar(128) NOT NULL );'); $database->query('INSERT INTO `options` (`key`, `value`) VALUES ("isInstalled", true) ;'); ?>

Success

Login