notes app created with files backend
This commit is contained in:
parent
7755aa53f7
commit
9d716fd449
9 changed files with 85 additions and 14 deletions
41
local/notes/write.php
Normal file
41
local/notes/write.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
$title = "";
|
||||
$note = "";
|
||||
switch ($_SERVER["REQUEST_METHOD"]) {
|
||||
case "GET":
|
||||
if (isset($_GET["title"])) {
|
||||
$title = $_GET["title"];
|
||||
$note = file_get_contents("notesDir/" . base64_encode($title));
|
||||
};
|
||||
break;
|
||||
case "POST":
|
||||
file_put_contents("notesDir/" . base64_encode($_POST["title"]), $_POST["note"]);
|
||||
header("Location: .");
|
||||
exit;
|
||||
}
|
||||
$_title = "Notes";
|
||||
$root = $_SERVER["DOCUMENT_ROOT"];
|
||||
require "$root/templates/header.php";
|
||||
?>
|
||||
<form method="post">
|
||||
<input name="title" class="content" placeholder="Title" value="<?= $title ?>">
|
||||
<button type="submit" class="content">Save</button>
|
||||
<button class="">Delete</button><br><br>
|
||||
<textarea name="note" class="note content" placeholder="Note"><?= $note ?></textarea>
|
||||
</form>
|
||||
<style>
|
||||
button {
|
||||
padding: 5px 10px;
|
||||
}
|
||||
.content {
|
||||
color: #ffffff;
|
||||
background-color: #303030;
|
||||
}
|
||||
.note {
|
||||
width: 98%;
|
||||
height: 280px;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
require "$root/templates/footer.php";
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue