From 9b82967f2fa3b8ffa3372b46e08035d99625bcec Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Wed, 22 May 2019 22:10:30 -0400 Subject: Add static/volunteer/submit. --- static/volunteer/submit/ack.html | 46 +++++++++++++++++++++++++++ static/volunteer/submit/index.php | 65 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 static/volunteer/submit/ack.html create mode 100644 static/volunteer/submit/index.php diff --git a/static/volunteer/submit/ack.html b/static/volunteer/submit/ack.html new file mode 100644 index 0000000..454cb8b --- /dev/null +++ b/static/volunteer/submit/ack.html @@ -0,0 +1,46 @@ + + + +Submit — Volunteer — Free Software Foundation India + + + + + +
+
+
+
+

Volunteer

+
+ +
+
+ + +

Thank you! We'll get back to you soon.

+ +

Oops! There were some issues:

+ +
    + +
  • + +
+ + Try again + + + +
+
+ +
+
+ +
+ + + + + diff --git a/static/volunteer/submit/index.php b/static/volunteer/submit/index.php new file mode 100644 index 0000000..732e031 --- /dev/null +++ b/static/volunteer/submit/index.php @@ -0,0 +1,65 @@ +'; + return mail(to(), + $p . ' wants to volunteer for FSF India', + 'Per says:' . PHP_EOL . PHP_EOL . $m + ); +} + +function em_fw($t) { + return preg_replace('/^(\w+)( .+)/', '$1$2', $t); +} + +function post() { + $n = $_POST['name']; + $e = $_POST['email']; + $m = $_POST['msg']; + + $errors = []; + if (empty($n)) { + $errors[] = em_fw('Name is required'); + } + if (!email_valid($e)) { + $errors[] = em_fw('Email is invalid'); + } + if (empty($m)) { + $errors[] = em_fw('Message is required'); + } + + $sok = true; + if (empty($error)) { + $sok = send($n, $e, $m); + }$sok = false; + if (!$sok) { + $errors[] = 'Unable to process your submission.'; + } + + return [ + 'ok' => empty($errors) && $sok, + 'errors' => $errors + ]; +} + +$result = post(); +include(__DIR__ . '/ack.html'); -- cgit v1.2.3