v0.0.9c Small changes
This commit is contained in:
parent
a7f2072a7a
commit
9f969c4a92
|
@ -1,10 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require "../../bootstrap.php";
|
|
||||||
|
|
||||||
use Backend\Model\Post;
|
|
||||||
|
|
||||||
if(isset($_GET['id'])){
|
|
||||||
$id = $_GET['id'];
|
|
||||||
$post = Post::query()->find($id);
|
|
||||||
}
|
|
|
@ -5,7 +5,6 @@ use Backend\Model\Post;
|
||||||
|
|
||||||
header('Content-Type: application/json;charset=UTF-8');
|
header('Content-Type: application/json;charset=UTF-8');
|
||||||
|
|
||||||
//Home.php
|
|
||||||
$data = Post::all();
|
$data = Post::all();
|
||||||
echo $data;
|
echo $data;
|
||||||
|
|
||||||
|
|
|
@ -24,19 +24,23 @@ if (isset($_POST['loginsubmit'])) {
|
||||||
} else {
|
} else {
|
||||||
session_destroy();
|
session_destroy();
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
|
header('location: ../../Frontend/login.php?error=couldNotSaveToken');
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
session_destroy();
|
session_destroy();
|
||||||
http_response_code(401);
|
http_response_code(401);
|
||||||
echo json_encode(["message" => "Wrong password"]);
|
header('location: ../../Frontend/login.php?message=wrongPassword');
|
||||||
|
//echo json_encode(["message" => "Wrong password"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
session_destroy();
|
session_destroy();
|
||||||
http_response_code(401);
|
http_response_code(401);
|
||||||
echo json_encode(["message" => "User was not found"]);
|
header('location: ../../Frontend/login.php?message=userWasNotFound');
|
||||||
|
//echo json_encode(["message" => "User was not found"]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
|
header('location: ../../Frontend/login.php?message=badMethod');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
require "../Backend/controller/accessControl.php";
|
require "../Backend/controller/accessControl.php";
|
||||||
//require "../Backend/controller/edit.php";//Bootstrap is require via this file
|
require "../bootstrap.php";
|
||||||
|
use Backend\Model\Post;
|
||||||
|
$id = $_GET['id'];
|
||||||
|
$data = Post::query()->find($id);
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
@ -9,12 +12,12 @@ require "../Backend/controller/accessControl.php";
|
||||||
<title>Home</title>
|
<title>Home</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php $ad = $_GET['id']; ?>
|
|
||||||
|
|
||||||
<form action="../Backend/controller/update.php" method="POST">
|
<form action="../Backend/controller/update.php" method="POST">
|
||||||
<input type="number" name="id" hidden value="<?php echo $ad ?>">
|
<input type="number" name="id" hidden value="<?php echo $id ?>">
|
||||||
<input type="text" name="upTitle" placeholder="Title">
|
<input type="text" name="upTitle" placeholder="Title" value="<?php echo $data->title ?>">
|
||||||
<input type="text" name="upDescription" placeholder="Description">
|
<input type="text" name="upDescription" placeholder="Description" value="<?php echo $data->description; ?>">
|
||||||
<input type="submit" name="update">
|
<input type="submit" name="update">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,10 @@ use Backend\Model\Post;
|
||||||
<a href="../Backend/controller/logout.php">Log ud</a>
|
<a href="../Backend/controller/logout.php">Log ud</a>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Opret post</p>
|
<p>Opret post</p>
|
||||||
<!--<form action="../Backend/controller/upload.php" method="POST">-->
|
<!--We use ajax to send the code to the backend-->
|
||||||
<input type="text" id="title" name="title" maxlength="255">
|
<input type="text" id="title" name="title" maxlength="255">
|
||||||
<input type="text" id="description" name="description" maxlength="2000">
|
<input type="text" id="description" name="description" maxlength="2000">
|
||||||
<button id="submit" name="createPost">Opret opslag</button>
|
<button id="submit" name="createPost">Opret opslag</button>
|
||||||
<!-- </form>-->
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue