From 3d7d9755ffce8930ea81ab3ce9497090781296ec Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Thu, 23 May 2019 19:01:40 -0400 Subject: static: Add contact/submit --- static/contact/submit/index.php | 62 +++++++++++++++++++++++++++++++++++++++ static/contact/submit/submit.html | 46 +++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 static/contact/submit/index.php create mode 100644 static/contact/submit/submit.html (limited to 'static/contact/submit') diff --git a/static/contact/submit/index.php b/static/contact/submit/index.php new file mode 100644 index 0000000..b88bdea --- /dev/null +++ b/static/contact/submit/index.php @@ -0,0 +1,62 @@ +'; + return mail(to(), + $p . ' sent a message to 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 (!email_valid($e)) { + $errors[] = em_fw('Email is invalid'); + } + if (empty($m)) { + $errors[] = em_fw('Message is required'); + } + + $sok = true; + if (empty($errors)) { + $sok = send($n, $e, $m); + } + if (!$sok) { + $errors[] = 'Unable to process your submission.'; + } + + return [ + 'ok' => empty($errors) && $sok, + 'errors' => $errors + ]; +} + +$result = post(); +include(__DIR__ . '/submit.html'); diff --git a/static/contact/submit/submit.html b/static/contact/submit/submit.html new file mode 100644 index 0000000..cea66fd --- /dev/null +++ b/static/contact/submit/submit.html @@ -0,0 +1,46 @@ + + + +Submit — Contact — Free Software Foundation India + + + + + +
+
+
+
+

Contact

+
+ +
+
+ + +

We'll get back to you soon!

+ +

Oops! There were some issues:

+ +
    + +
  • + +
+ + Try again + + + +
+
+ +
+
+ +
+ + + + + -- cgit v1.2.3