This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
rangitaki/rcc/res/save.php
mmk2410 6e6e26ad26 Delete Posts
Edit Posts
Back to blog
2015-12-06 15:19:16 +01:00

22 lines
371 B
PHP

<?php
$title = $_POST["title"];
$date = $_POST["date"];
$author = $_POST["author"];
$tags = $_POST["tags"];
$text = $_POST["text"];
$filename = $_POST["file"];
$md = <<<EOD
%TITLE: $title
%DATE: $date
%AUTHOR: $author
%TAGS: $tags
$text
EOD;
if (file_put_contents($filename, $md)) {
echo 0;
} else if (file_exists(($filename))) {
echo 1;
} else {
echo -1;
}