[Commits] [svn:einsteintoolkit] www/ (Rev. 320)

cjordan at cct.lsu.edu cjordan at cct.lsu.edu
Wed Aug 4 16:33:03 CDT 2010


User: cjordan
Date: 2010/08/04 04:33 PM

Modified:
 /about/members/
  send-registration.php
 /info/documentation/
  request.php, send-account.php

Log:
 fixed the scripts to work with php5, corrected grammar logic

File Changes:

Directory: /info/documentation/
===============================

File [modified]: request.php
Delta lines: +5 -5
===================================================================
--- info/documentation/request.php	2010-07-26 18:20:13 UTC (rev 319)
+++ info/documentation/request.php	2010-08-04 21:33:02 UTC (rev 320)
@@ -23,11 +23,11 @@
 </tr>
 <tr>
 <td>Position</td>
-<td><input type="radio" name="position" value="an undergraduate in" checked /> undergraduate
-<input type="radio" name="position" value="a graduate student in" /> graduate student<br>
-<input type="radio" name="position" value="a postdoc in" /> postdoc
-<input type="radio" name="position" value="a researcher in" /> researcher
-<input type="radio" name="position" value="faculty of" /> faculty
+<td><input type="radio" name="position" value="an undergraduate " checked /> undergraduate
+<input type="radio" name="position" value="a graduate student " /> graduate student<br>
+<input type="radio" name="position" value="a postdoc " /> postdoc
+<input type="radio" name="position" value="a researcher " /> researcher
+<input type="radio" name="position" value="faculty " /> faculty
 </td>
 </tr>
 <tr>

File [modified]: send-account.php
Delta lines: +27 -10
===================================================================
--- info/documentation/send-account.php	2010-07-26 18:20:13 UTC (rev 319)
+++ info/documentation/send-account.php	2010-08-04 21:33:02 UTC (rev 320)
@@ -5,22 +5,39 @@
 
 <?php
 /* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
-$name = $HTTP_POST_VARS['name'];
-$email = $HTTP_POST_VARS['email'];
-$department = $HTTP_POST_VARS['department'];
-$institution = $HTTP_POST_VARS['institution'];
-$position = $HTTP_POST_VARS['position'];
-$advisor = $HTTP_POST_VARS['advisor'];
+$name = $_POST['name'];
+$email = $_POST['email'];
+$department = $_POST['department'];
+$institution = $_POST['institution'];
+$position = $_POST['position'];
+$advisor = $_POST['advisor'];
 
 if ($position=='undergraduate' || $position=='graduate') {
 $mentionadvisor = 'This student\'s advisor is '.$advisor.'.';
 }
 
+if (! empty($department)){
+if ($position=='faculty ') {
+$position = $position.'of ';
+}
+else {
+$position = $position.'in ';
+}}
 
-$message = "Einstein Toolkit maintainers: \n\n".$name.", ".$position." the ".$department." Department at ".$institution.", has submitted a request for a test account for the Einstein Toolkit. His or her email address is ".$email.". ".$mentionadvisor." \n\n Thanks,\n Einstein Toolkit Request Bot\n";
+if (! empty($department)) {
+$department = 'the '.$department.' Department ';
+}
 
+if (! empty($institution)) {
+$institution = 'at '.$institution.', ';
+}
+
+$message = "Einstein Toolkit maintainers: \n\n".$name.", ".$position." ".$department.$institution."has submitted a request for a test account for the Einstein Toolkit. His or her email address is ".$email.". ".$mentionadvisor." \n\n Thanks,\n Einstein Toolkit Request Bot\n";
+
+echo $message;
+
 /* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
-if ($name == '') {
+if (empty($name)) {
   echo '<h4>Please fill in your name.</h4>';
   echo '<br /><a href="javascript:history.back(1);">Try again</a>';
   }
@@ -31,11 +48,11 @@
 
 /* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
 elseif (mail('maintainers at einsteintoolkit.org','New Einstein Toolkit test account request received',$message,'From: RegistrationBot at einsteintoolkit.org')) {
-  echo '<h4>Your request for a test account has been successfully submitted. You will hear from us soon.</h4>';
+  echo '<h4>Your request for a test account has been successfully submitted. You will hear from us soon!</h4>';
   echo '<br /><a href="/">Home</a>';
 } else {
   echo '<h4>Unfortunately, there was a problem requesting an account.</h4>';
-  echo '<a href="javascript:history.back(1);">Go back to try again?</a>';
+  echo 'Go back to <a href="javascript:history.back(1);">try again</a>?';
 }
 ?>
 

Directory: /about/members/
==========================

File [modified]: send-registration.php
Delta lines: +12 -8
===================================================================
--- about/members/send-registration.php	2010-07-26 18:20:13 UTC (rev 319)
+++ about/members/send-registration.php	2010-08-04 21:33:02 UTC (rev 320)
@@ -5,11 +5,15 @@
 
 <?php
 /* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
-$name = $HTTP_POST_VARS['name'];
-$email = $HTTP_POST_VARS['email'];
-$institution = $HTTP_POST_VARS['institution'];
-$list = $HTTP_POST_VARS['list'];
+$name = $_POST['name'];
+$email = $_POST['email'];
+$institution = $_POST['institution'];
+$list = $_POST['list'];
 
+if (! empty($institution)){
+$institution = ' from '.$institution;
+}
+
 if ($list=='yes') {
 $addtolist = "Please add this person to the ET users mailing list.\n".$name." <".$email.">";
 }
@@ -17,16 +21,16 @@
 $addtolist = "This person's email address is ".$email."; however, this person does not wish to be added to the ET users mailing list.";
 }
 
-$message = "Einstein Toolkit maintainers: \n\n".$name." from ".$institution." has submitted a request to register with the Einstein Toolkit. ".$addtolist."\n\n Thanks,\n Einstein Toolkit Registration Bot\n";
+$message = "Einstein Toolkit maintainers: \n\n".$name.$institution." has submitted a request to register with the Einstein Toolkit. ".$addtolist."\n\n Thanks,\n Einstein Toolkit Registration Bot\n";
 
 /* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
-if ($name == '') {
+if (empty($name)) {
   echo '<h4>Please fill in your name.</h4>';
   echo '<br /><a href="javascript:history.back(1);">Try again</a>';
   }
   elseif (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {
   echo '<h4>Please provide a valid email address.</h4>';
-  echo '<br /><a href="javascript:history.back(1);">Try again</a>';
+  echo '<br />Please <a href="javascript:history.back(1);">try again</a>';
 }
 
 /* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
@@ -35,7 +39,7 @@
   echo '<br /><a href="/">Home</a>';
 } else {
   echo '<h4>Unfortunately, there was a problem registering.</h4>';
-  echo '<a href="javascript:history.back(1);">Go back to try again?</a>';
+  echo 'Go back to <a href="javascript:history.back(1);">try again</a>?';
 }
 ?>
 



More information about the Commits mailing list