Team:UCL/FAQ/Contact

From 2014.igem.org

(Difference between revisions)
Line 12: Line 12:
<div class="textTitle"><h3 class="widthCorrect">Contact Details</h3></div><!-- First title or p tag of a page needs the textTitle class as it corrects the placing of the rest of the page-->
<div class="textTitle"><h3 class="widthCorrect">Contact Details</h3></div><!-- First title or p tag of a page needs the textTitle class as it corrects the placing of the rest of the page-->
 +
<?php
 +
function spamcheck($field) {
 +
  // Sanitize e-mail address
 +
  $field=filter_var($field, FILTER_SANITIZE_EMAIL);
 +
  // Validate e-mail address
 +
  if(filter_var($field, FILTER_VALIDATE_EMAIL)) {
 +
    return TRUE;
 +
  } else {
 +
    return FALSE;
 +
  }
 +
}
 +
?>
 +
 +
<h2>Feedback Form</h2>
<?php
<?php
// display form if user has not clicked submit
// display form if user has not clicked submit
Line 18: Line 32:
   <form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
   <form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
   From: <input type="text" name="from"><br>
   From: <input type="text" name="from"><br>
-
  Email: <input type="text" name="email"><br>
 
-
  Phone: <input type="text" name="phone"><br>
 
   Subject: <input type="text" name="subject"><br>
   Subject: <input type="text" name="subject"><br>
   Message: <textarea rows="10" cols="40" name="message"></textarea><br>
   Message: <textarea rows="10" cols="40" name="message"></textarea><br>
Line 25: Line 37:
   </form>
   </form>
   <?php  
   <?php  
-
} else {   // the user has submitted the form
+
} else { // the user has submitted the form
   // Check if the "from" input field is filled out
   // Check if the "from" input field is filled out
   if (isset($_POST["from"])) {
   if (isset($_POST["from"])) {
-
     $from = $_POST["from"]; // sender
+
     // Check if "from" email address is valid
-
     $email = $_POST["email"];
+
    $mailcheck = spamcheck($_POST["from"]);
-
     $phone = $_POST["phone"];
+
     if ($mailcheck==FALSE) {
-
    $subject = $_POST["subject"];
+
      echo "Invalid input";
-
    $message = $_POST["message"];
+
     } else {
-
    // message lines should not exceed 70 characters (PHP rule), so wrap it
+
      $from = $_POST["from"]; // sender
-
    $message = wordwrap($message, 70);
+
      $subject = $_POST["subject"];
-
    // send mail
+
      $message = $_POST["message"];
-
    mail("ucligem@gmail.com",$subject,$message,"From: $from\n");
+
      // message lines should not exceed 70 characters (PHP rule), so wrap it
-
    echo "Thank you for sending us feedback";
+
      $message = wordwrap($message, 70);
 +
      // send mail
 +
      mail("webmaster@example.com",$subject,$message,"From: $from\n");
 +
      echo "Thank you for sending us feedback";
 +
    }
   }
   }
}
}
?>
?>
-
 

Revision as of 13:42, 16 September 2014

Goodbye Azodye UCL iGEM 2014

Goodbye Azodye UCL iGEM 2014

Contact Us

Human Practice Team

Contact Details

Feedback Form

"> From:
Subject:
Message:

Contact Us

University College London
Gower Street - London
WC1E 6BT
Biochemical Engineering Department
Phone: +44 (0)20 7679 2000
Email: ucligem2014@gmail.com

Follow Us