Permalink
Browse files

added anti-spam measure to the docking request form

  • Loading branch information...
1 parent 69c7241 commit 7a8e5ee01c7191638a366898d78bb090e27210fd anodyne committed Dec 17, 2009
Showing with 53 additions and 46 deletions.
  1. +53 −46 pages/dockingrequest.php
View
@@ -9,8 +9,8 @@
File: pages/dockingrequest.php
Purpose: To display the form for ships to request docking permission at the starbase
-System Version: 2.6.9
-Last Modified: 2009-03-08 2304 EST
+System Version: 2.6.10
+Last Modified: 2009-12-17 1134 EST
**/
/* check the simm type */
@@ -33,56 +33,61 @@
/* determine if request form is being sumbitted */
if(isset($_POST['action_x']))
{
- $insert = "INSERT INTO sms_starbase_docking (dockingShipName, dockingShipRegistry, dockingShipClass, dockingShipURL, ";
- $insert.= "dockingShipCO, dockingShipCOEmail, dockingDuration, dockingDesc, dockingStatus) VALUES (%s, %s, %s, %s, %s, ";
- $insert.= "%s, %s, %s, %s)";
+ $spam = $_POST['check_field'];
- $query = sprintf(
- $insert,
- escape_string($_POST['dockingShipName']),
- escape_string($_POST['dockingShipRegistry']),
- escape_string($_POST['dockingShipClass']),
- escape_string($_POST['dockingShipURL']),
- escape_string($_POST['dockingShipCO']),
- escape_string($_POST['dockingShipCOEmail']),
- escape_string($_POST['dockingDuration']),
- escape_string($_POST['dockingDesc']),
- escape_string('pending')
- );
-
- $result = mysql_query($query);
-
- /* optimize the table */
- optimizeSQLTable( "sms_starbase_docking" );
-
- foreach($_POST as $key => $value)
+ if (empty($spam))
{
- $$key = $value;
- }
+ $insert = "INSERT INTO sms_starbase_docking (dockingShipName, dockingShipRegistry, dockingShipClass, dockingShipURL, ";
+ $insert.= "dockingShipCO, dockingShipCOEmail, dockingDuration, dockingDesc, dockingStatus) VALUES (%s, %s, %s, %s, %s, ";
+ $insert.= "%s, %s, %s, %s)";
+
+ $query = sprintf(
+ $insert,
+ escape_string($_POST['dockingShipName']),
+ escape_string($_POST['dockingShipRegistry']),
+ escape_string($_POST['dockingShipClass']),
+ escape_string($_POST['dockingShipURL']),
+ escape_string($_POST['dockingShipCO']),
+ escape_string($_POST['dockingShipCOEmail']),
+ escape_string($_POST['dockingDuration']),
+ escape_string($_POST['dockingDesc']),
+ escape_string('pending')
+ );
+
+ $result = mysql_query($query);
+
+ /* optimize the table */
+ optimizeSQLTable( "sms_starbase_docking" );
+
+ foreach($_POST as $key => $value)
+ {
+ $$key = $value;
+ }
+
+ if(!empty($result))
+ {
+ /* email the ship CO */
+ $subject1 = $emailSubject . " Docking Request";
+ $to1 = $dockingShipCOEmail;
+ $from1 = printCO() . " < " . printCOEmail() . " >";
+ $message1 = $dockingShipCO . ", thank you for submitting a request to dock with " . $shipPrefix . " " . $shipName . ". The CO has been sent a copy of your request and will be reviewing it shortly. In the meantime, please feel free to browse our site (" . $webLocation . ") until the CO reviews your request.
- if(!empty($result))
- {
- /* email the ship CO */
- $subject1 = $emailSubject . " Docking Request";
- $to1 = $dockingShipCOEmail;
- $from1 = printCO() . " < " . printCOEmail() . " >";
- $message1 = $dockingShipCO . ", thank you for submitting a request to dock with " . $shipPrefix . " " . $shipName . ". The CO has been sent a copy of your request and will be reviewing it shortly. In the meantime, please feel free to browse our site (" . $webLocation . ") until the CO reviews your request.
-
This is an automatically generated message, please do not respond.";
-
- mail($to1, $subject1, $message1, "From: " . $from1 . "\nX-Mailer: PHP/" . phpversion());
- /* email the CO */
- $subject2 = $emailSubject . " Docking Request";
- $to2 = printCOEmail();
- $from2 = $dockingShipCO . " < " . $dockingShipCOEmail . " >";
- $message2 = "Greetings " . printCO() . ",
+ mail($to1, $subject1, $message1, "From: " . $from1 . "\nX-Mailer: PHP/" . phpversion());
+
+ /* email the CO */
+ $subject2 = $emailSubject . " Docking Request";
+ $to2 = printCOEmail();
+ $from2 = $dockingShipCO . " < " . $dockingShipCOEmail . " >";
+ $message2 = "Greetings " . printCO() . ",
+
+ $dockingShipCO of the $dockingShipName has sent a request to dock with the $shipName. To answer the Commanding Officer and approve or deny his request, please log in to your Control Panel.
-$dockingShipCO of the $dockingShipName has sent a request to dock with the $shipName. To answer the Commanding Officer and approve or deny his request, please log in to your Control Panel.
-
" . $webLocation . "login.php?action=login";
-
- mail($to2, $subject2, $message2, "From: " . $from2 . "\nX-Mailer: PHP/" . phpversion());
+
+ mail($to2, $subject2, $message2, "From: " . $from2 . "\nX-Mailer: PHP/" . phpversion());
+ }
}
}
@@ -165,7 +170,9 @@
<td><textarea name="dockingDesc" rows="5" class="desc"></textarea></td>
</tr>
<tr>
- <td colspan="3" height="25">&nbsp;</td>
+ <td colspan="3" height="25">
+ <input type="text" style="border: 1px solid transparent; background: transparent; color: transparent;" tabindex="500" name="check_field" value="" />
+ </td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>

0 comments on commit 7a8e5ee

Please sign in to comment.