diff options
| author | Niklas Olmes <niklas@olmes.de> | 2026-04-24 19:30:00 +0200 |
|---|---|---|
| committer | Niklas Olmes <niklas@olmes.de> | 2026-04-24 19:30:00 +0200 |
| commit | cdea8caa5617f0cb77bcbc9803759abd2df50644 (patch) | |
| tree | 2f7f1bd3af3b2396baf5403ad1a7ad00bcb7fae9 /addtemplate.php | |
Diffstat (limited to 'addtemplate.php')
| -rw-r--r-- | addtemplate.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/addtemplate.php b/addtemplate.php new file mode 100644 index 0000000..29bc05f --- /dev/null +++ b/addtemplate.php @@ -0,0 +1,42 @@ +<?php +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +?> +<?php +/* vim: set ts=4 sw=4 et : */ + +require_once __DIR__ . "/check_auth.php"; +require_once __DIR__ . "/../includes/common.php"; + +if (!isset($_POST['name']) || !isset($_POST['text'])) + exit(0); + +if (isset($_POST['email'])) { + $sql = "INSERT INTO email_templates (name, text, `from`, cc, bcc, subject) VALUES (?, ?, ?, ?, ?, ?);"; + + $stmt = $mysqli->prepare($sql); + $stmt->bind_param('ssssss', $_POST['name'], $_POST['text'], $_POST['from'], $_POST['cc'], $_POST['bcc'], $_POST['subject']); + $stmt->execute(); +} else if (isset($_POST['pdf'])) { + $sql = "INSERT INTO pdf_templates (name, text, subject, date) VALUES (?, ?, ?, ?);"; + + $stmt = $mysqli->prepare($sql); + $stmt->bind_param('ssss', $_POST['name'], $_POST['text'], $_POST['subject'], $_POST['date']); + $stmt->execute(); +} + +echo $stmt->insert_id; + +$stmt->reset(); +$mysqli->close(); + +exit(0); |
