Cleaned up Codebase after finishing Tutorial on php and adding files, styles some logic for LearningPlattform Projekt
This commit is contained in:
parent
1b0b12b655
commit
cbabe10ee9
22 changed files with 16 additions and 3419 deletions
|
|
@ -1,3 +0,0 @@
|
|||
<?php
|
||||
$heading = "About Us";
|
||||
require "views/about.view.php";
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
<?php
|
||||
$heading = "Contact Us";
|
||||
require "views/contact.view.php";
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
require('Validator.php');
|
||||
$heading = 'Create Note';
|
||||
$username = 'appUser';
|
||||
$password = 'password';
|
||||
$config = require('config.php');
|
||||
$db = new Database($config['database'], $username, $password);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$errors = [];
|
||||
|
||||
if (! Validator::string($_POST['body'], 1, 1000)) {
|
||||
$errors['body'] = 'A body of no more than 1000 characters is required.';
|
||||
}
|
||||
if (empty($errors)) {
|
||||
|
||||
$db->query("INSERT INTO notes (body, user_id) VALUES (:body, :user_id)", [
|
||||
'body' => $_POST['body'],
|
||||
'user_id' => 1
|
||||
]);
|
||||
}
|
||||
}
|
||||
require 'views/notes/create.view.php';
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
$username = 'appUser';
|
||||
$password = 'password';
|
||||
$config = require('config.php');
|
||||
$db = new Database($config['database'], $username, $password);
|
||||
|
||||
$heading = "My Notes";
|
||||
|
||||
$notes = $db->query('select * from notes where user_id = 1')->get();
|
||||
//dd($notes);
|
||||
require "views/notes/index.view.php";
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
$username = 'appUser';
|
||||
$password = 'password';
|
||||
$config = require('config.php');
|
||||
$db = new Database($config['database'], $username, $password);
|
||||
|
||||
$heading = "Note";
|
||||
$currentUserId = 1;
|
||||
|
||||
$note = $db->query('select * from notes where id = :id', [
|
||||
'id' => $_GET['id']
|
||||
])->findOrFail();
|
||||
|
||||
authorize(($note['user_id'] === $currentUserId));
|
||||
|
||||
|
||||
//dd($notes);
|
||||
require "views/notes/show.view.php";
|
||||
Loading…
Add table
Add a link
Reference in a new issue