iwa-panda2

Manage Weather Data by International Weather Agency (Version 2)
Log | Files | Refs | README

commit 706c386f6d143f19474ce5c1b5c118c1876c7393
parent 801dcc31e1aa6e08bc3ed4ab09fd10303595b0bc
Author: MoiBaguette <[email protected]>
Date:   Tue,  6 Jun 2023 13:54:47 +0200

start of key

Diffstat:
ALollipop/Session.php | 11+++++++++++
AModel/Key.php | 7+++++++
Aindex.php | 23+++++++++++++++++++++++
Aviews/dashboard.php | 6++++++
Mviews/login.php | 10++++++----
Aviews/panda.html | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 142 insertions(+), 4 deletions(-)

diff --git a/Lollipop/Session.php b/Lollipop/Session.php @@ -0,0 +1,10 @@ +<?php +Class Session{ + if (!isset($_SESSION['CREATED'])) { + $_SESSION['CREATED'] = time(); +} else if (time() - $_SESSION['CREATED'] > 1800) { + // session started more than 30 minutes ago + session_regenerate_id(true); // change session ID for the current session and invalidate old session ID + $_SESSION['CREATED'] = time(); // update creation time +} +} +\ No newline at end of file diff --git a/Model/Key.php b/Model/Key.php @@ -0,0 +1,6 @@ +<?php +Class Key{ + function myfunction($key){ + + } +} +\ No newline at end of file diff --git a/index.php b/index.php @@ -0,0 +1,22 @@ +<?php + +require_once "utils/autoloader.php"; + +$router = new Lollipop\Router(); + +$router->addRoute(["GET"], "/", "views/login.php"); +$router->addRoute(["POST"], "/login", "logic/login.php"); +$router->addRoute(["POST"], "/", function($vars){ + $data = []; + foreach ($_POST as $key => $value) { + $data[$key] = $value; + } + $t = new Lollipop\Template(); + $t->template("views/login.php", $data); +}); +$router->addRoute(["GET"], "/dashboard", "views/dashboard.php"); +$router->addRoute(["GET"], "/api/:data", function($vars) { + var_dump($vars); +}); + +$router->route(); +\ No newline at end of file diff --git a/views/dashboard.php b/views/dashboard.php @@ -0,0 +1,6 @@ +<html> + <head> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"> + </head> + +</html> diff --git a/views/login.php b/views/login.php @@ -1,10 +1,12 @@ <!DOCTYPE html> <?php - session_start(); - if (isset($_SESSION['email'])) { - header('Location: /dashboard'); + if (!isset($_SESSION['CREATED'])) { + $_SESSION['CREATED'] = time(); + } else if (time() - $_SESSION['CREATED'] > 1800) { + // session started more than 30 minutes ago + session_regenerate_id(true); // change session ID for the current session and invalidate old session ID + $_SESSION['CREATED'] = time(); // update creation time } - include "logic/login.php"; ?> <html> <head> diff --git a/views/panda.html b/views/panda.html @@ -0,0 +1,88 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Panda Breeding Facilities</title> + <link rel="stylesheet" type="text/css" href="/css/panda.css" /> +</head> +<body> +<div class="panda"> + <div class="circle"> + <div class="head"> </div> + <div class="ears"> + <div class="earleft"> + <div class="shadowleft"> </div> + </div> + <div class="earright"> + <div class="shadowright"> </div> + </div> + </div> + <div class="eyes"> + <div class="eyeleft"> + <div class="pupilleft"> + <div class="pupilinsideleft"> </div> + </div> + </div> + <div class="eyeright"> + <div class="pupilright"> + <div class="pupilinsideright"></div> + </div> + </div> + </div> + <div class="mouth"> </div> + <div class="mouthmiddle"> </div> + <div class="mouthend"> </div> + </div> + <div class="wall"></div> + <div class="wall1"> + <div class="wall1side"> </div> + </div> + </div> + <div class="handsright"> </div> + <div class="handsleft"> </div> +</div> + +<nav> + <ul> + <li><a href="#"><IMG class="logo" SRC="/img/logo.png"></a></li> + <li><a href="#">Breeding Facility</a></li> + <li><a href="#">Zoo's</a></li> + <li><a href="#">About</a></li> + </ul> +</nav> + + +<!--<IMG class="gif" SRC="/img/panda.gif">--> +</div> +<h1>Welcome to Panda Breeding Facilities</h1> +<p class="inlog">Je bent ingelogd als "Rapper Sjors"</p> + +<div class="block1"> + <div class="content"> + <ul class="fancy-list"> + <li>Item 1</li> + <li>Item 2</li> + <li>Item 3</li> + <li>Item 4</li> + </ul> + </div> + + <div class="content1"> + <p>Sate met rijst</p> + <p>€3</p> + </div> +</div> + +<div class="content2"> + <div class="graph"> + <div class="bar" style="height: 120px; left: 50px;"></div> + <div class="bar" style="height: 200px; left: 120px;"></div> + <div class="bar" style="height: 80px; left: 190px;"></div> + <div class="bar" style="height: 160px; left: 260px;"></div> + </div> +</div> + +</body> +</html> +</html> +\ No newline at end of file