aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@caddy-256phi.local>2026-04-01 13:29:08 +0200
committerroot <root@caddy-256phi.local>2026-04-01 13:29:08 +0200
commit676e4f65e13cc4f95facdf450a842245751b333f (patch)
tree50b245b7e364ac6280c11951de78808e7cdcea54
parent62225f993fe7bf7e81105112d28b360a7001d57b (diff)
parent6caad3280121866fd2102798b53e0fd60068c66a (diff)
Merge branch 'master' of 10.0.0.37:/srv/git/256phi-mainWebsite
-rw-r--r--Caddyfile4
-rw-r--r--src/Pages/commissions/commissions.php54
2 files changed, 40 insertions, 18 deletions
diff --git a/Caddyfile b/Caddyfile
index ff902c8..404b190 100644
--- a/Caddyfile
+++ b/Caddyfile
@@ -2,6 +2,10 @@
# Site's directory
root * /var/www/html/src
+ # Block direct access to JSON data files
+ @jsonFiles path *.json
+ respond @jsonFiles 404
+
# Enable the static file server.
file_server
diff --git a/src/Pages/commissions/commissions.php b/src/Pages/commissions/commissions.php
index 2511bc0..2b34a5e 100644
--- a/src/Pages/commissions/commissions.php
+++ b/src/Pages/commissions/commissions.php
@@ -1,3 +1,8 @@
+<?php
+// Debug - enable error reporting
+ini_set('display_errors', 1);
+error_reporting(E_ALL);
+?>
<!DOCTYPE html>
<html lang="en">
<head>
@@ -347,16 +352,24 @@
$success = false;
$error = '';
+ // DEBUG - remove after testing
+ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ echo "<pre style='background:#333;color:#0f0;padding:10px;'>DEBUG POST:\n";
+ print_r($_POST);
+ echo "</pre>";
+ }
+
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Honeypot check
if (!empty($_POST['website'])) {
// Bot detected, silently ignore
+ echo "<p style='color:red;'>DEBUG: Honeypot triggered!</p>";
$success = true;
} else {
- $name = htmlspecialchars(trim($_POST['name'] ?? ''), ENT_QUOTES, 'UTF-8');
+ $name = trim($_POST['name'] ?? '');
$email = filter_var(trim($_POST['email'] ?? ''), FILTER_SANITIZE_EMAIL);
- $description = htmlspecialchars(trim($_POST['description'] ?? ''), ENT_QUOTES, 'UTF-8');
- $budget = htmlspecialchars(trim($_POST['budget'] ?? ''), ENT_QUOTES, 'UTF-8');
+ $description = trim($_POST['description'] ?? '');
+ $budget = trim($_POST['budget'] ?? '');
// Validation
if (empty($name) || empty($email) || empty($description)) {
@@ -366,23 +379,28 @@
} elseif (strlen($description) > 5000) {
$error = 'Description is too long (max 5000 characters).';
} else {
- // Compose email
- $to = 'commission@256phi.eu';
- $subject = "Commission Request from $name";
- $body = "New commission request:\n\n";
- $body .= "Name: $name\n";
- $body .= "Email: $email\n";
- $body .= "Budget: $budget\n\n";
- $body .= "Description:\n$description\n";
-
- $headers = "From: noreply@256phi.eu\r\n";
- $headers .= "Reply-To: $email\r\n";
- $headers .= "Content-Type: text/plain; charset=UTF-8\r\n";
-
- if (mail($to, $subject, $body, $headers)) {
+ // Save to JSON file
+ $submissionsFile = __DIR__ . '/submissions.json';
+ $submissions = [];
+
+ if (file_exists($submissionsFile)) {
+ $submissions = json_decode(file_get_contents($submissionsFile), true) ?? [];
+ }
+
+ $submissions[] = [
+ 'id' => uniqid(),
+ 'date' => date('Y-m-d H:i:s'),
+ 'name' => $name,
+ 'email' => $email,
+ 'budget' => $budget,
+ 'description' => $description,
+ 'status' => 'new'
+ ];
+
+ if (file_put_contents($submissionsFile, json_encode($submissions, JSON_PRETTY_PRINT))) {
$success = true;
} else {
- $error = 'Failed to send message. Please try emailing directly.';
+ $error = 'Failed to save request. Please email me directly.';
}
}
}