PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/bitsand/admin/admin_finalconfirmation_m.php

http://bitsand.googlecode.com/
PHP | 228 lines | 183 code | 25 blank | 20 comment | 35 complexity | c8b900c6e357f3a5c9336cf0239459f0 MD5 | raw file
  1. <?php
  2. /*
  3. Bitsand - a web-based booking system for LRP events
  4. Copyright (C) 2006 - 2012 The Bitsand Project (http://bitsand.googlecode.com/)
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. */
  17. include ('../inc/inc_head_db.php');
  18. include ('../inc/inc_admin.php');
  19. include ('../inc/inc_head_html.php');
  20. include ('../inc/inc_commonqueries.php');
  21. $db_prefix = DB_PREFIX;
  22. $key = CRYPT_KEY;
  23. $eventinfo = getEventDetails($_GET['EventID'], 0, 'admin.php');
  24. $eventid = $eventinfo['evEventID'];
  25. ?>
  26. <h1><?php echo TITLE?> - Final Confirmation</h1>
  27. <p>
  28. <a href = 'admin_manageevent.php?EventID=<?php echo $eventinfo['evEventID'];?>'>Return to event management for - <?php echo $eventinfo['evEventName'];?></a>
  29. </p>
  30. <h2><?php echo $eventinfo['evEventName'];?></h2>
  31. <p>The text below will be sent as an e-mail to all players fully booked for the upcoming event. Players are considered fully booked if their payment date is not blank, so be sure to mark everyone as paid before sending this e-mail.</p>
  32. <p>You can use the textbox provided to enter some custom text that will be included in your e-mail.</p>
  33. <hr />
  34. <p>
  35. Dear &lt;player name&gt;,
  36. </p>
  37. <p>
  38. Thank you for booking for the upcoming event, &lt;event name&gt;, you can download the event pack from <?php echo SYSTEM_URL ?>event.php
  39. </p>
  40. <p>
  41. &lt;customised text&gt;
  42. </p>
  43. <p>
  44. Our records show that:
  45. <ul>
  46. <li>You have booked as a (player/monster/staff member)</li>
  47. <li>Your emergency contact name is &lt;emergency name&gt;</li>
  48. <li>Your emergency contact number is &lt;emergency number&gt;</li>
  49. <li>You have/have not been assigned a bunk space</li>
  50. <li>You have/have not requested a meal ticket</li>
  51. <li>You have paid a total of &pound;&lt;amount paid&gt;</li>
  52. <li>You were expected to pay &pound;&lt;amount expected&gt;</li>
  53. <li>You will need to pay/be refunded &pound;&lt;difference&gt; when you arrive on site</li>
  54. <li>Your In-Character information is as follows:
  55. <ul>
  56. <li>Character name:</li>
  57. <li>Race:</li>
  58. <li>Culture:</li>
  59. <li>Reason:</li>
  60. </ul>
  61. </li>
  62. </ul>
  63. </p>
  64. <p>
  65. If any of the above information is incorrect, please let &lt;event contact&gt; (&lt;event contact email&gt;) know as soon as possible.
  66. </p>
  67. <p>
  68. We look forward to seeing you at the event.
  69. </p>
  70. <form action='admin_finalconfirmation.php' method=post>
  71. <table>
  72. <tr><td>Custom text:</td><td><textarea name='txtCustom' rows='10'><?php echo stripslashes($_POST['txtCustom'])?></textarea></td></tr>
  73. <tr><td></td><td><input type='submit' value='Send e-mail' name='btnSend'/>&nbsp;<input value='Preview One' name='btnPreviewOne' type='submit' />&nbsp;<input value='PreviewAll' name='btnPreviewAll' type='submit'/></td></tr>
  74. </table>
  75. </form>
  76. <?php
  77. $buttonpressed = 0;
  78. $customtext = htmlentities( stripslashes($_POST['txtCustom']));
  79. //The user has asked for a preview of all e-mails that will be sent
  80. if ($_POST['btnPreviewAll'] == 'Preview All' || $_POST['btnPreviewOne'] == 'Preview One')
  81. {
  82. $startPara = "<p>\n";
  83. $endPara = "</p>\n";
  84. $startIndent = "<ul>\n<li>";
  85. $endIndent = "</li></ul>\n";
  86. $indentItem = "</li>\n<li>";
  87. $poundsign = "&pound;";
  88. $buttonpressed = 1;
  89. $customtext = str_replace("\n", "<br/>", $customtext);
  90. }
  91. //Or they want to send the e-mails
  92. else if ($_POST['btnSend'] == 'Send e-mail')
  93. {
  94. $startPara = "\n";
  95. $endPara = "\n";
  96. $startIndent = "\n\t";
  97. $endIndent = "";
  98. $indentItem = "\n\t";
  99. $poundsign = "?";
  100. $buttonpressed = 2;
  101. }
  102. if ($buttonpressed > 0 && CheckReferrer ('admin_finalconfirmation.php'))
  103. {
  104. $sql = "Select".
  105. " plPlayerID,".
  106. " plFirstName,".
  107. " plSurname,".
  108. " plEmail,".
  109. " bkBookAs,".
  110. " plEmergencyName,".
  111. " IFNULL(AES_DECRYPT(pleEmergencyNumber, '$key'),'') AS dEmergencyNumber,".
  112. "bkBunkAllocated, " .
  113. "bkMealTicket, " .
  114. "bkAmountPaid, ".
  115. "bkAmountExpected, ".
  116. "chName, chRace, chCulture, chReason " .
  117. "from {$db_prefix}players LEFT OUTER JOIN {$db_prefix}bookings ON {$db_prefix}players.plPlayerID = {$db_prefix}bookings.bkPlayerID " .
  118. " LEFT OUTER JOIN {$db_prefix}characters ON {$db_prefix}players.plPlayerID = {$db_prefix}characters.chPlayerID ".
  119. " WHERE bkDatePaymentConfirmed != '0000-00-00' and bkEventID = $eventid";
  120. " ORDER BY IF(plSurname='',1,0),plSurname";
  121. $result = ba_db_query ($link, $sql);
  122. echo "<hr/>";
  123. while ($record = ba_db_fetch_assoc ($result))
  124. {
  125. $output = "";
  126. $output.= $startPara;
  127. $output.= "Dear ".$record['plFirstName'].' '.$record['plSurname']."\n";
  128. $output.= $endPara;
  129. $output.= $startPara;
  130. $output.= "Thank you for booking for the upcoming event, ".EVENT_NAME.", you can download the event pack from ";
  131. $output.=SYSTEM_URL."event.php";
  132. $output.= $endPara;
  133. if (strlen($customtext) > 0)
  134. {
  135. $output.= $startPara;
  136. $output.= $customtext;
  137. $output.= $endPara;
  138. }
  139. $output.= $startPara;
  140. $output.= "Our records show that:";
  141. $output.= $startIndent . "You have booked as a " .$record['bkBookAs'];
  142. $output.= $indentItem . "Your emergency contact name is ".$record['plEmergencyName'];
  143. $output.= $indentItem . "Your emergency contact number is ".$record['dEmergencyNumber'];
  144. $bunk = "have not";
  145. if ($record['bkBunkAllocated'] == 1) {$bunk = "have";}
  146. $output.= $indentItem. "You $bunk been assigned a bunk space";
  147. $meal = "have not";
  148. if ($record['bkMealTicket'] == 1) {$meal = "have";}
  149. $output.= $indentItem. "You $meal requested a meal ticket";
  150. $output.= $indentItem. "You have paid a total of &pound;".$record['bkAmountPaid'];
  151. $diff = $record['bkAmountExpected'] - $record['bkAmountPaid'];
  152. if ($diff != 0)
  153. {
  154. $output.= $indentItem. "You were expected to pay $poundsign".$record['bkAmountExpected'];
  155. if ($diff > 0)
  156. {
  157. $output.= $indentItem. "You will need to pay $poundsign$diff when you arrive on site";
  158. }
  159. else
  160. {
  161. $output.= $indentItem. "You will need to be refunded $poundsign".abs($diff)." when you arrive on site";
  162. }
  163. }
  164. if ($buttonpressed == 1)
  165. $output.= $indentItem. "Your In Character information is as follows:";
  166. else
  167. $output.= "\n\nYour In Character information is as follows:";
  168. $output.= $startIndent."Character name: ".$record['chName'];
  169. $output.= $indentItem. "Race: ".$record['chRace'];
  170. $output.= $indentItem. "Culture: ".$record['chCulture'];
  171. $output.= $indentItem. "Reason: ".$record['chReason'];
  172. $output.= $endIndent.$endIndent.$endPara;
  173. $output.= $endIndent.$endPara;
  174. $output.= $startPara;
  175. $output.="If any of the above information is incorrect, please let ";
  176. if ($buttonpressed == 1)
  177. $output.= EVENT_CONTACT_NAME." (<a href = 'mailto:" .Obfuscate (EVENT_CONTACT_MAIL) . "'>" . EVENT_CONTACT_MAIL . "</a>) know as soon as possible.";
  178. else
  179. $output.= EVENT_CONTACT_NAME." (".EVENT_CONTACT_MAIL . ") know as soon as possible.";
  180. $output.= $endPara;
  181. $output.= $startPara;
  182. $output.="We look forward to seeing you at the event.";
  183. $output.= $endPara;
  184. if ($buttonpressed == 1)
  185. {
  186. $output.= "<hr />";
  187. echo $output;
  188. }
  189. else if ($buttonpressed == 2)
  190. {
  191. echo "Sending confirmation e-mail to ".$record['plFirstName']." ".$record['plSurname']." (".PID_PREFIX . sprintf ('%03s', $record['plPlayerID']).")<br />\n";
  192. mail ($record ['plEmail'], SYSTEM_NAME . ' - Final Confirmation for '.EVENT_NAME, $output,
  193. "From:" . SYSTEM_NAME . " <" . EVENT_CONTACT_MAIL . ">");
  194. }
  195. }
  196. }
  197. ?>
  198. <?php
  199. include ('../inc/inc_foot.php');
  200. ?>