Add create wishlist
This commit is contained in:
parent
6684149e9f
commit
e934812622
2 changed files with 8 additions and 8 deletions
|
@ -99,6 +99,7 @@ switch ($step) {
|
|||
*/
|
||||
$database->query('CREATE TABLE `wishlists` (
|
||||
`id` int AUTO_INCREMENT,
|
||||
`user` int NOT NULL,
|
||||
`name` varchar(128) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);');
|
||||
|
@ -121,7 +122,7 @@ switch ($step) {
|
|||
<main>
|
||||
<section>
|
||||
<h1>Success</h1>
|
||||
<a href="?page=login">Login</a>
|
||||
<a href="?page=register">Login</a>
|
||||
</section>
|
||||
</main>
|
||||
<?php
|
||||
|
|
|
@ -10,12 +10,11 @@ use wishthis\Page;
|
|||
|
||||
$page = new page(__FILE__, 'Home');
|
||||
|
||||
if (isset($_POST['email'], $_POST['password'])) {
|
||||
$user = $database->query(
|
||||
'SELECT * FROM `users`
|
||||
WHERE `email` = "' . $_POST['email'] . '"
|
||||
AND `password` = "' . sha1($_POST['password']) . '";'
|
||||
)->fetch();
|
||||
if (isset($_POST['name'])) {
|
||||
$database->query('INSERT INTO `wishlists`
|
||||
(`user`, `name`) VALUES
|
||||
(' . $_SESSION['user']['id'] . ', "' . $_POST['name'] . '")
|
||||
;');
|
||||
|
||||
$_SESSION['user'] = $user;
|
||||
|
||||
|
@ -32,7 +31,7 @@ $page->header();
|
|||
<form method="post">
|
||||
<fieldset>
|
||||
<label>Name</label>
|
||||
<input type="text" name="name" placeholder="<?= getCurrentSeason() ?>" />
|
||||
<input type="text" name="name" placeholder="<?= getCurrentSeason() ?>" value="<?= getCurrentSeason() ?>" />
|
||||
</fieldset>
|
||||
|
||||
<input type="submit" value="Create" />
|
||||
|
|
Loading…
Reference in a new issue