[gnome-web-www/wptest] validate for errors before sending email in the application form
- From: Vinicius Scopel Depizzol <vdepizzol src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-web-www/wptest] validate for errors before sending email in the application form
- Date: Tue, 14 Feb 2012 21:07:28 +0000 (UTC)
commit 1c7f855089646669fa5fd22f46353c7e88f64f87
Author: Vinicius Depizzol <vdepizzol gmail com>
Date: Tue Feb 14 19:07:19 2012 -0200
validate for errors before sending email in the application form
theme/page-apply.php | 64 ++++++++++++++++++++++++++++----------------------
1 files changed, 36 insertions(+), 28 deletions(-)
---
diff --git a/theme/page-apply.php b/theme/page-apply.php
index 1e94f99..9991bee 100644
--- a/theme/page-apply.php
+++ b/theme/page-apply.php
@@ -2,45 +2,53 @@
if (array_key_exists('submit', $_POST)) {
+
+ $errors = false;
$full_name = trim(stripslashes($_POST['full_name']));
$email = trim(stripslashes($_POST['email']));
$obfuscated_email = str_replace("@", " AT ", $email);
+ $not_spam = $_POST['not_spam'];
+
+ if ($not_spam != 'not spam') {
+ $errors = true;
+ }
$summary = trim(stripslashes($_POST['summary']));
$previous_participation = trim(stripslashes($_POST['previous_participation']));
- $formmail = "Contact Information\n" .
- "-------------------\n\n" .
-
- "Full Name: " . $full_name . "\n".
- "Email: " . $obfuscated_email . "\n\n" .
-
- "Contribuitions Summary:\n" .
- $summary . "\n\n" .
-
- "Foundation Previous Participation\n" .
- $previous_participation . "\n\n" .
-
- "[Application received at " . date("D M j G:i:s Y") . " (Eastern time)]" .
-
- "If you have any questions, you can contact the Membership Committee by\n" .
- "replying to this mail. Please note that it usually takes up to a week for an application to be fully processed.";
-
- $headers = "From: GNOME Foundation Membership Committee Script <membership-committee gnome org>\n" .
- "Cc: $email\n";
-
- $subject = "Application received from " . $full_name . " (" . $obfuscated_email . ")";
+ if (empty($full_name) || empty($email) || empty($summary)) {
+ $errors = true;
+ }
- mail("membership-applications gnome org", $subject, $formmail, $headers);
-
-}
-
-
-
-
+ if ($errors == false) {
+
+ $formmail = "Contact Information\n" .
+ "-------------------\n\n" .
+
+ "Full Name: " . $full_name . "\n".
+ "Email: " . $obfuscated_email . "\n\n" .
+
+ "Contribuitions Summary:\n" .
+ $summary . "\n\n" .
+
+ "Foundation Previous Participation\n" .
+ $previous_participation . "\n\n" .
+
+ "[Application received at " . date("D M j G:i:s Y") . " (Eastern time)]" .
+
+ "If you have any questions, you can contact the Membership Committee by\n" .
+ "replying to this mail. Please note that it usually takes up to a week for an application to be fully processed.";
+ $headers = "From: GNOME Foundation Membership Committee Script <membership-committee gnome org>\n" .
+ "Cc: $email\n";
+
+ $subject = "Application received from " . $full_name . " (" . $obfuscated_email . ")";
+
+ mail("membership-applications gnome org", $subject, $formmail, $headers);
+ }
+}
?>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]