diff --git a/.gitignore b/.gitignore index cd7aa82..6a6350a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /vendor/ /logs/* +/tmp/ diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..618291d --- /dev/null +++ b/.htaccess @@ -0,0 +1,2 @@ +RewriteEngine On +RewriteRule ^$ /public [L] diff --git a/DATABASE.md b/DATABASE.md new file mode 100644 index 0000000..7589d8e --- /dev/null +++ b/DATABASE.md @@ -0,0 +1,8 @@ +Om phpMyAdmin te gebruiken voor de database moet je het volgende doen: + +Inloggen op http://cpanel.verictas.nl met: + +gebruikersnaam: inforbank +wachtwoord: inforban + +Klik op phpMyAdmin onder "Databases". diff --git a/Eindopdracht.pdf b/Eindopdracht.pdf new file mode 100644 index 0000000..bf6639e Binary files /dev/null and b/Eindopdracht.pdf differ diff --git a/README.md b/README.md index 9c700b1..46a034b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Om te kunnen werken aan dit project moet je het volgende doen: Je doet een git clone (in een random map) (het spreekt voor zich dat je hiervoor eerst git (https://git-scm.com/downloads) moet installeren) met `git clone https://git.verictas.com/InformaticaD4p/informatica-eindproject.git`. Er verschijnt nu een nieuwe map genaamd `informatica-eindproject`. In deze map ga je werken. -Om te starten heb je ook een PHP installatie nodig op je PC. Ik heb een zip bestand met de php installatie op http://christiaangoossens.nl/uploads/afc06760-f1b9-4458-8d93-fc6ea8b2a828/php7.zip. Je pakt dit bestand uit en vindt dan een map genaamd `php7`. Deze map zet je neer op een logische plek (bijvoorbeeld C:/php7 of C:/Program Files/php7) en die voeg je dan toe aan je windows path (dat kun je doen via Configuratischerm>System>Opstartvariabelen of met dit commando in de shell (cmd): `set PATH=%PATH%;C:\php7` (let op, wel het path veranderen naar de map waar je de `php7` map hebt neergezet). +Om te starten heb je ook een PHP installatie nodig op je PC. Ik heb een zip bestand met de php installatie op http://christiaangoossens.nl/uploads/afc06760-f1b9-4458-8d93-fc6ea8b2a828/php7.zip. Je pakt dit bestand uit en vindt dan een map genaamd `php7`. Deze map zet je neer op een logische plek (bijvoorbeeld C:/php7 of C:/Program Files/php7) en die voeg je dan toe aan je windows path (dat kun je doen via Configuratischerm>System>Opstartvariabelen (let op, wel het path veranderen naar de map waar je de `php7` map hebt neergezet). Als het goed is kun je in de `informatica-eindproject` map nu het volgende commando uitvoeren (mag in CMD of de Git shell): `php -v`. Je krijgt dan het volgende te zien: @@ -15,11 +15,10 @@ Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies ``` -Je bent nu klaar om Composer te installeren. Composer is een hulpprogramma dat alle benodigdheden voor jouw project automatisch downloadt en toevoegt. Je kunt de Composer installer vinden op: https://getcomposer.org/download/. +(Je kunt ook zelf updaten naar de laatste versie van PHP, deze is een beetje verouderd.) + +Switch nu naar de dev branch en je dan ben je klaar om Composer te installeren. Composer is een hulpprogramma dat alle benodigdheden voor jouw project automatisch downloadt en toevoegt. Je kunt de Composer installer vinden op: https://getcomposer.org/download/. Composer zal je tijdens de installatie vragen om je php versie op te geven, dit staat waarschijnlijk automatisch goed, maar je kunt hem ook zelf zoeken. - -Zodra alles geïnstalleerd is, ga je terug naar de `informatica-eindproject` map en doe je een `composer install` in de commandline. Alle benodigdheden worden nu gedownload en geïnstalleerd. - -Je kunt je website nu starten via `composer start`. Er zal dan een webserver voor je worden gestart. Je kunt nu zelf een webbrowser openen om naar `http://localhost:8080` te gaan en dan zul je je website zien. +Je kunt je website nu starten via `composer run`. Er zal dan een webserver voor je worden gestart en de benodigdheden worden automatisch geinstalleerd. Je kunt nu zelf een webbrowser openen om naar `http://localhost:8080` te gaan en dan zul je je website zien. diff --git a/composer.json b/composer.json index d508ce8..7f151af 100644 --- a/composer.json +++ b/composer.json @@ -2,13 +2,17 @@ "require": { "php": ">=5.5.0", "slim/slim": "^3.1", - "slim/php-view": "^2.0" + "slim/php-view": "^2.0", + "vrana/notorm": "dev-master" }, "config": { "process-timeout" : 0 }, "scripts": { + "run": "composer install && composer start", "start": "php -S 0.0.0.0:8080 -t public public/index.php" + }, + "autoload": { + "psr-4": {"Inforbank\\": "src/"} } - } diff --git a/composer.lock b/composer.lock index 4d8df69..0f0c531 100644 --- a/composer.lock +++ b/composer.lock @@ -4,22 +4,25 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "37fe8b36d00a40955cbd52e4949aa8f1", + "content-hash": "ca8f6133814e92e4e70538a15c4b1a32", "packages": [ { "name": "container-interop/container-interop", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/container-interop/container-interop.git", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", "shasum": "" }, + "require": { + "psr/container": "^1.0" + }, "type": "library", "autoload": { "psr-4": { @@ -31,7 +34,8 @@ "MIT" ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "time": "2014-12-30T15:22:37+00:00" + "homepage": "https://github.com/container-interop/container-interop", + "time": "2017-02-14T19:40:03+00:00" }, { "name": "nikic/fast-route", @@ -122,6 +126,55 @@ ], "time": "2015-09-11T15:10:35+00:00" }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -290,12 +343,53 @@ "router" ], "time": "2016-12-20T20:30:47+00:00" + }, + { + "name": "vrana/notorm", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/vrana/notorm.git", + "reference": "e49d5d2f1bfe440dc82b61f46172635dfcb6f6dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vrana/notorm/zipball/e49d5d2f1bfe440dc82b61f46172635dfcb6f6dd", + "reference": "e49d5d2f1bfe440dc82b61f46172635dfcb6f6dd", + "shasum": "" + }, + "type": "library", + "autoload": { + "files": [ + "NotORM.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0", + "GPL-2.0+" + ], + "authors": [ + { + "name": "Jakub Vrána", + "homepage": "http://www.vrana.cz/" + } + ], + "description": "NotORM is a PHP library for simple working with data in the database.", + "homepage": "http://www.notorm.com/", + "keywords": [ + "database", + "dbal" + ], + "time": "2014-10-30 16:55:08" } ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "vrana/notorm": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/public/.htaccess b/public/.htaccess index c506092..4ec0df7 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,10 +1,4 @@ -RewriteEngine On - -# Some hosts may require you to use the `RewriteBase` directive. -# If you need to use the `RewriteBase` directive, it should be the -# absolute physical path to the directory that contains this htaccess file. -# -# RewriteBase / - +RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f -RewriteRule ^ index.php [QSA,L] +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA] diff --git a/public/assets/css/main.css b/public/assets/css/main.css new file mode 100644 index 0000000..e69de29 diff --git a/public/index.php b/public/index.php index 2784ee0..4b0a035 100644 --- a/public/index.php +++ b/public/index.php @@ -1,4 +1,28 @@ run(); +include __DIR__ . '/../src/bootstrap.php'; diff --git a/src/Application.php b/src/Application.php new file mode 100644 index 0000000..18dda13 --- /dev/null +++ b/src/Application.php @@ -0,0 +1,37 @@ +getContainer(); + } + + public static function getContainer() + { + return self::$container; + } + + public static function getApplication() + { + return self::$app; + } +} diff --git a/src/Application/API/Handler.php b/src/Application/API/Handler.php new file mode 100644 index 0000000..3690c71 --- /dev/null +++ b/src/Application/API/Handler.php @@ -0,0 +1,130 @@ +group('/api', function () { + /** + * TransactionRequest API Endpoint + * + * Requires the following POST arguments: + * - clientId + * - transactionId + * - amount + * - description + * - returnUrl + * - sha1 + */ + $this->post('/transactionRequest', function ($request, $response, $args) { + $parsedBody = $request->getParsedBody(); + + if (isset($parsedBody['clientId']) && isset($parsedBody['transactionId']) && isset($parsedBody['amount']) && isset($parsedBody['description']) && isset($parsedBody['returnUrl']) && isset($parsedBody['sha1'])) { + // Correct request + + $clientSecret = Handler::getClientSecret($parsedBody['clientId']); + $sha = sha1($parsedBody['transactionId'] . $parsedBody['amount'] . $clientSecret); + + if ($sha === $parsedBody['sha1']) { + $responseJSON = array( + "success" => true, + "redirect" => "https://example.com" + ); + } else { + $response = $response->withStatus(403); + $responseJSON = array( + "success" => false, + "error" => "Incorrect sha1 verification hash." + ); + } + } else { + $response = $response->withStatus(400); + $responseJSON = array( + "success" => false, + "error" => "Missing one of the following attributes: [clientId, transactionId, amount, description, returnUrl, sha1]" + ); + } + + $body = $response->getBody(); + $body->write(json_encode($responseJSON)); + return $response->withBody($body); + }); + + /** + * StatusRequest API Endpoint + * + * Requires the following POST arguments: + * - clientId + * - transactionId + * - sha1 + */ + $this->post('/statusRequest', function ($request, $response, $args) { + $parsedBody = $request->getParsedBody(); + + if (isset($parsedBody['clientId']) && isset($parsedBody['transactionId']) && isset($parsedBody['sha1'])) { + // Correct request + + $clientSecret = Handler::getClientSecret($parsedBody['clientId']); + $sha = sha1($parsedBody['transactionId'] . $clientSecret); + + if ($sha === $parsedBody['sha1']) { + $responseJSON = array( + "success" => true, + "transaction" => array( + "status" => "Success", + "transactionId" => "notyetfromdb", + "someotherrandomkey" => "changethis" + ) + ); + } else { + $response = $response->withStatus(403); + $responseJSON = array( + "success" => false, + "error" => "Incorrect sha1 verification hash." + ); + } + } else { + $response = $response->withStatus(400); + $responseJSON = array( + "success" => false, + "error" => "Missing one of the following attributes: [clientId, transactionId, sha1]" + ); + } + + $body = $response->getBody(); + $body->write(json_encode($responseJSON)); + return $response->withBody($body); + }); + })->add(function ($request, $response, $next) { + /** + * Add the correct JSON headers to the responses + */ + $response = $response->withHeader('Content-type', 'application/json'); + return $next($request, $response); + }); + } + + public static function getClientSecret($clientId) + { + return '3'; + } +} diff --git a/src/Application/Auth/Authorization.php b/src/Application/Auth/Authorization.php new file mode 100644 index 0000000..65ab98a --- /dev/null +++ b/src/Application/Auth/Authorization.php @@ -0,0 +1,59 @@ +db; + + $rekeningen = $db->rekeningen->where('rekeningnr', $rekeningnr); + + if (count($rekeningen) !== 1) { + throw new \Exception("Rekening niet bekend."); + } + + $id = $rekeningen->max("id"); + $klantnr = $rekeningen[$id]['klantid']; + + $klant = $db->klanten->where('id', $klantnr)[$klantnr]; + + if ($klant['code'] === $passcode) { + $_SESSION['userid'] = $klant['id']; + return true; + } + + return false; + } + + public function getUserID() + { + return $_SESSION['userid']; + } + + public function isUserAuthenticated() + { + return $this->getUserID() !== null; + } + + public function logout() + { + unset($_SESSION['userid']); + } +} diff --git a/src/Application/Auth/Middleware.php b/src/Application/Auth/Middleware.php new file mode 100644 index 0000000..e578d91 --- /dev/null +++ b/src/Application/Auth/Middleware.php @@ -0,0 +1,34 @@ +auth->isUserAuthenticated()) { + return $next($request, $response); + } else { + // Redirect to the login page + return Redirect::create($response, '/login'); + } + } +} diff --git a/src/Application/Daniel.php b/src/Application/Daniel.php new file mode 100644 index 0000000..31d384f --- /dev/null +++ b/src/Application/Daniel.php @@ -0,0 +1,28 @@ +get('/daniel', function ($request, $response, $args) { + // Render index view + return $this->renderer->render($response, 'Daniel.phtml', $args); + }); + } +} diff --git a/src/Application/Helper/IBAN.php b/src/Application/Helper/IBAN.php new file mode 100644 index 0000000..a6f97cb --- /dev/null +++ b/src/Application/Helper/IBAN.php @@ -0,0 +1,64 @@ +wordToNumbers($landcode); + + + $bankcode = "INFO"; + $banknumber = $this->wordToNumbers($bankcode); + + $rekeningnr = str_pad($rekeningnr, 10, 0, STR_PAD_LEFT); + + $bignum = $banknumber . $rekeningnr . $landnumber . "00"; + + $modulo97 = ''; + $checkdigits = '00'; + + // begin modulo staartdeling + $modulo97 = (int)substr($bignum, 0, 6); + $modulo97 = $modulo97 % 97; + $modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 6, 6); + $modulo97 = $modulo97 % 97; + $modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 12, 6); + $modulo97 = $modulo97 % 97; + $modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 18, 6); + $modulo97 = $modulo97 % 97; + $checkdigits = 98 - $modulo97; + // einde modulo staartdeling + if (strlen($checkdigits) < 2) { + $checkdigits = '0' . $checkdigits; + } + + $rekeningnrarr = str_split($rekeningnr, 4); + return $landcode.$checkdigits." ".$bankcode." ".$rekeningnrarr[0]." ".$rekeningnrarr[1]." ".$rekeningnrarr[2]; + } +} diff --git a/src/Application/Helper/Klant.php b/src/Application/Helper/Klant.php new file mode 100644 index 0000000..edc2ba1 --- /dev/null +++ b/src/Application/Helper/Klant.php @@ -0,0 +1,41 @@ +auth->getUserID(); + + $db = $container->db; + + $klant = $db->klanten->where('id', $user)[$user]; + + return array( + 'voornaam' => $klant['voornaam'], + 'tussenvoegsel' => $klant['tussenvoegsel'], + 'achternaam' => $klant['achternaam'], + 'bedrijfsnaam' => $klant['bedrijfsnaam'], + 'straat' => $klant['straat'], + 'huisnummer' => $klant['huisnummer'], + 'postcode' => $klant['postcode'], + 'woonplaats' => $klant['woonplaats'] + ); + } +} diff --git a/src/Application/Helper/Redirect.php b/src/Application/Helper/Redirect.php new file mode 100644 index 0000000..ed1ab63 --- /dev/null +++ b/src/Application/Helper/Redirect.php @@ -0,0 +1,35 @@ +withStatus(302); + $response = $response->withHeader('Location', Redirect::getBasepath() . $path); + return $response; + } + + private static function getBasepath() + { + if (isset($_SERVER['HTTPS'])) { + $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http"; + } else { + $protocol = 'http'; + } + return $protocol . "://" . $_SERVER['HTTP_HOST']; + } +} diff --git a/src/Application/Helper/Rekeningen.php b/src/Application/Helper/Rekeningen.php new file mode 100644 index 0000000..31a1438 --- /dev/null +++ b/src/Application/Helper/Rekeningen.php @@ -0,0 +1,42 @@ +auth->getUserID(); + + $db = $container->db; + $ibanhelper = new IBAN; + + $rekeningen = $db->rekeningen->where('klantid', $user); + + $returnArray = array(); + + foreach ($rekeningen as $rekening) { + $returnArray[] = array( + "rekeningnr" => $ibanhelper->getIBAN($rekening['rekeningnr']), + "saldo" => (double) $rekening['saldo'] + ); + } + + return $returnArray; + } +} diff --git a/src/Application/Login.php b/src/Application/Login.php new file mode 100644 index 0000000..33da093 --- /dev/null +++ b/src/Application/Login.php @@ -0,0 +1,51 @@ +get('/login', function ($request, $response, $args) { + // Render index view + return $this->renderer->render($response, 'login.phtml', $args); + }); + + $app->post('/login', function ($request, $response, $args) { + // Render index view + $post = $request->getParsedBody(); + + try { + $resp = $this->auth->login($post['rekeningnr'], $post['pascode']); + + if ($resp) { + return Redirect::create($response, '/'); + } else { + return Redirect::create($response, '/login?error'); + } + } catch (\Exception $e) { + return Redirect::create($response, '/login?error'); + } + }); + + $app->get('/logout', function ($request, $response, $args) { + $this->auth->logout(); + return Redirect::create($response, '/login'); + }); + } +} diff --git a/src/Application/Main.php b/src/Application/Main.php new file mode 100644 index 0000000..02d056c --- /dev/null +++ b/src/Application/Main.php @@ -0,0 +1,48 @@ +get('/', function ($request, $response, $args) { + // Ophalen klant + $klant = Klant::getCurrentUser(); + $rekeningen = Rekeningen::getCurrentUserRekeningen(); + + // Render index view + return $this->renderer->render($response, 'index.phtml', [ + 'klant' => $klant, + 'rekeningen' => $rekeningen + ]); + })->add(new Auth\Middleware()); + } +} diff --git a/src/bootstrap.php b/src/bootstrap.php new file mode 100644 index 0000000..fee2e5a --- /dev/null +++ b/src/bootstrap.php @@ -0,0 +1,134 @@ +getContainer(); + +// Create the view renderer +/** + * ============== + * INSTRUCTIEBLOK + * ============== + * + * Hier wordt de 'view renderer' aan de dependency container (zie hierboven) toegevoegd. Dit zorgt dat je in je applicatie deze 'view renderer' kunt gebruiken via `$this->renderer`. + * De renderer wordt gebruikt om een PHP template (https://en.wikipedia.org/wiki/Web_template_system) aan je URL te koppelen. + * + * Dit kun je doen in je 'route' (URL) met de volgende code: + * + * ``` + * return $this->renderer->render($response, 'index.phtml', $args); + * ``` + * + * (index.phtml kan hier vervangen worden door een template adres uit de map templates) + */ +$container['renderer'] = function ($c) { + $settings = $c->get('settings')['renderer']; + return new Slim\Views\PhpRenderer($settings['template_path']); +}; + +// Add the database layer +/** + * ============== + * INSTRUCTIEBLOK + * ============== + * + * Je kunt de database gebruiken in je code via $this->db. Vermijd het direct gebruiken van het PDO object via $this->get('db.pdo'). + * Je kunt hiervoor beter de ingebouwde functies van NotORM gebruiken. + */ +$container['db.pdo'] = function ($c) { + $settings = $c->get('settings')['db']; + $host = $settings['host']; + $name = $settings['name']; + $user = $settings['user']; + $pass = $settings['pass']; + $charset = $settings['charset']; + + return new PDO("mysql:dbname=$name;host=$host;charset=$charset", $user, $pass, + array( + PDO::ATTR_TIMEOUT => 5, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION + )); +}; + +$container['db'] = function ($c) { + $settings = $c->get('settings')['db']; + $pdo = $c->get('db.pdo'); + return new NotORM($pdo); +}; + +// Add auth object +$container['auth'] = function () { + return new \Inforbank\Application\Auth\Authorization(); +}; + + +// Link static objects +Inforbank\Application::set($app); + +// Inject the application main class +/** + * ============== + * INSTRUCTIEBLOK + * ============== + * + * Hieronder wordt de Main class van onze applicatie aangeroepen. + * + * In object georiënteerd PHP is een applicatie vaak gestructureerd in meerdere 'classes', die ook wel objecten worden genoemd. Een object kan worden gemaakt door het volgende: + * + */ + +new Inforbank\Application\Login($app); +new Inforbank\Application\Daniel($app); +new Inforbank\Application\Main($app); + +// Added API handler +new Inforbank\Application\API\Handler($app); + +/** + * Bij het maken van dit object is in de class de __construct functie aangeroepen met de parameter $app. De functies die daar in staan zullen nu worden uitgevoerd. + * + * Je kunt de class herkennen uit talen als Java en C(++ of #), omdat ze daar ook worden gebruikt. + * + * Je kunt voor een beter begrip de volgende sites lezen: + * - https://www.sitepoint.com/php-53-namespaces-basics/ (over namespaces (wij gebruiken InfD4p\Application)) + * - http://php.net/manual/en/language.oop5.basic.php (over de class) + */ + +// Run app +$app->run(); diff --git a/src/dependencies.php b/src/dependencies.php deleted file mode 100644 index af58864..0000000 --- a/src/dependencies.php +++ /dev/null @@ -1,10 +0,0 @@ -getContainer(); - -// view renderer -$container['renderer'] = function ($c) { - $settings = $c->get('settings')['renderer']; - return new Slim\Views\PhpRenderer($settings['template_path']); -}; diff --git a/src/middleware.php b/src/middleware.php deleted file mode 100644 index 116a0ff..0000000 --- a/src/middleware.php +++ /dev/null @@ -1,4 +0,0 @@ -add(new \Slim\Csrf\Guard); diff --git a/src/routes.php b/src/routes.php deleted file mode 100644 index ea11a20..0000000 --- a/src/routes.php +++ /dev/null @@ -1,7 +0,0 @@ -get('/[{name}]', function ($request, $response, $args) { - // Render index view - return $this->renderer->render($response, 'index.phtml', $args); -}); diff --git a/src/settings.php b/src/settings.php index fe7e7b2..739ee3c 100644 --- a/src/settings.php +++ b/src/settings.php @@ -7,6 +7,15 @@ return [ // Renderer settings 'renderer' => [ 'template_path' => __DIR__ . '/../templates/', + ], + + // Database settings + 'db' => [ + 'host' => '185.56.145.27', + 'user' => 'inforban_db', + 'pass' => 'inforbank', + 'name' => 'inforban_db', + 'charset' => 'utf8' ] ], ]; diff --git a/templates/__footer.phtml b/templates/__footer.phtml new file mode 100644 index 0000000..308b1d0 --- /dev/null +++ b/templates/__footer.phtml @@ -0,0 +1,2 @@ + + diff --git a/templates/__header.phtml b/templates/__header.phtml new file mode 100644 index 0000000..670aa15 --- /dev/null +++ b/templates/__header.phtml @@ -0,0 +1,8 @@ + + + + + Inforbank + + + diff --git a/templates/daniel.phtml b/templates/daniel.phtml new file mode 100644 index 0000000..5f76b49 --- /dev/null +++ b/templates/daniel.phtml @@ -0,0 +1,59 @@ + + + + + InforBank - Inloggen + + + + + + +
+
+

InforBank

+
+
+
+
+ + + + + + + +
+
+ + + + + diff --git a/templates/index.phtml b/templates/index.phtml index d732287..bcda5f1 100644 --- a/templates/index.phtml +++ b/templates/index.phtml @@ -1,38 +1,9 @@ - - - - - Slim 3 - - - - -

Slim

-
a microframework for PHP
+

Welkom klant

+Uitloggen +
+
+
- -

Hello !

- -

Try SlimFramework - - - + diff --git a/templates/login.phtml b/templates/login.phtml new file mode 100644 index 0000000..5f76b49 --- /dev/null +++ b/templates/login.phtml @@ -0,0 +1,59 @@ + + + + + InforBank - Inloggen + + + + + + +

+
+

InforBank

+
+
+
+
+ + + + + + + +
+
+ + + + +