mirror of
https://github.com/tavo-wasd-gh/conex-builder.git
synced 2025-06-07 04:03:29 -06:00
44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
$date = new DateTime();
|
|
$isoDate = $date->format(DateTime::ISO8601);
|
|
|
|
$directory = "submit/";
|
|
$filename = "$isoDate.md";
|
|
$filePath = $directory . $filename;
|
|
|
|
if (!is_dir($directory)) {
|
|
mkdir($directory, 0755, true);
|
|
}
|
|
|
|
$title = isset($_POST["title"]) ? $_POST["title"] : "";
|
|
$slogan = isset($_POST["slogan"]) ? $_POST["slogan"] : "";
|
|
$name = isset($_POST["name"]) ? $_POST["name"] : "";
|
|
$email = isset($_POST["email"]) ? $_POST["email"] : "";
|
|
$phone = isset($_POST["phone"]) ? $_POST["phone"] : "";
|
|
$phone = isset($_POST["paypalOrderID"]) ? $_POST["paypalOrderID"] : "";
|
|
|
|
$editorContent = isset($_POST["editor"]) ? $_POST["editor"] : "";
|
|
$editorContent = str_replace("\r\n", "\n", $editorContent); // Convert CRLF to LF
|
|
$editorContent = str_replace("\r", "\n", $editorContent); // Convert CR to LF
|
|
|
|
$content = <<<EOD
|
|
---
|
|
date: $isoDate
|
|
author: "$name <$email> <$phone>"
|
|
orderID: $paypalOrderID
|
|
title: "$title"
|
|
description: "$slogan"
|
|
layout: single
|
|
---
|
|
|
|
$editorContent
|
|
EOD;
|
|
|
|
$file = "$isoDate.md";
|
|
file_put_contents($filePath, $content);
|
|
echo "Done";
|
|
} else {
|
|
echo "Error";
|
|
}
|
|
?>
|