Add season placeholder

This commit is contained in:
Jay 2021-11-15 12:55:01 +01:00
parent ae9cc94506
commit 6684149e9f
5 changed files with 32 additions and 8 deletions

View file

@ -28,7 +28,7 @@ form {
section { section {
max-width: 80ch; max-width: 80ch;
padding: 2rem; padding: 2rem;
margin: 0 auto; margin: 1rem auto 0 auto;
background-color: #fff; background-color: #fff;
} }

View file

@ -8,5 +8,19 @@
function getCurrentSeason(): string function getCurrentSeason(): string
{ {
var_dump(date()); $now = time();
$month = date('n');
$season = '';
$startOfYear = strtotime('01. January');
$startOfEaster = strtotime('15. April'); // Approximate
$startOfChristmas = strtotime('24. December');
if ($now <= $startOfEaster) {
$season = 'Easter';
} elseif ($now <= $startOfChristmas) {
$season = 'Christmas';
}
return $season;
} }

View file

@ -16,6 +16,12 @@ $page->header();
<section> <section>
<h1>Welcome to wishthis</h1> <h1>Welcome to wishthis</h1>
<a href="?page=register">Register</a> <a href="?page=register">Register</a>
<a href="?page=login">Login</a>
</section>
<section>
<h2>Wishlist</h2>
<a href="?page=wishlist">Create a wishlist</a>
</section> </section>
</main> </main>

View file

@ -94,6 +94,15 @@ switch ($step) {
PRIMARY KEY (id) PRIMARY KEY (id)
);'); );');
/**
* Wishlists
*/
$database->query('CREATE TABLE `wishlists` (
`id` int AUTO_INCREMENT,
`name` varchar(128) NOT NULL,
PRIMARY KEY (id)
);');
/** /**
* Options * Options
*/ */

View file

@ -32,12 +32,7 @@ $page->header();
<form method="post"> <form method="post">
<fieldset> <fieldset>
<label>Name</label> <label>Name</label>
<input type="name" name="name" placeholder="<?= getCurrentSeason() ?>" /> <input type="text" name="name" placeholder="<?= getCurrentSeason() ?>" />
</fieldset>
<fieldset>
<label>Password</label>
<input type="password" name="password" />
</fieldset> </fieldset>
<input type="submit" value="Create" /> <input type="submit" value="Create" />