/bitsand/admin/admin_finalconfirmation_m.php
PHP | 228 lines | 183 code | 25 blank | 20 comment | 35 complexity | c8b900c6e357f3a5c9336cf0239459f0 MD5 | raw file
- <?php
- /*
- Bitsand - a web-based booking system for LRP events
- Copyright (C) 2006 - 2012 The Bitsand Project (http://bitsand.googlecode.com/)
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
- include ('../inc/inc_head_db.php');
- include ('../inc/inc_admin.php');
- include ('../inc/inc_head_html.php');
- include ('../inc/inc_commonqueries.php');
-
- $db_prefix = DB_PREFIX;
- $key = CRYPT_KEY;
-
- $eventinfo = getEventDetails($_GET['EventID'], 0, 'admin.php');
- $eventid = $eventinfo['evEventID'];
-
- ?>
-
- <h1><?php echo TITLE?> - Final Confirmation</h1>
- <p>
- <a href = 'admin_manageevent.php?EventID=<?php echo $eventinfo['evEventID'];?>'>Return to event management for - <?php echo $eventinfo['evEventName'];?></a>
- </p>
-
- <h2><?php echo $eventinfo['evEventName'];?></h2>
-
- <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>
- <p>You can use the textbox provided to enter some custom text that will be included in your e-mail.</p>
- <hr />
- <p>
- Dear <player name>,
- </p>
- <p>
- Thank you for booking for the upcoming event, <event name>, you can download the event pack from <?php echo SYSTEM_URL ?>event.php
- </p>
- <p>
- <customised text>
- </p>
- <p>
- Our records show that:
- <ul>
- <li>You have booked as a (player/monster/staff member)</li>
- <li>Your emergency contact name is <emergency name></li>
- <li>Your emergency contact number is <emergency number></li>
- <li>You have/have not been assigned a bunk space</li>
- <li>You have/have not requested a meal ticket</li>
- <li>You have paid a total of £<amount paid></li>
- <li>You were expected to pay £<amount expected></li>
- <li>You will need to pay/be refunded £<difference> when you arrive on site</li>
- <li>Your In-Character information is as follows:
- <ul>
- <li>Character name:</li>
- <li>Race:</li>
- <li>Culture:</li>
- <li>Reason:</li>
- </ul>
- </li>
- </ul>
- </p>
- <p>
- If any of the above information is incorrect, please let <event contact> (<event contact email>) know as soon as possible.
- </p>
- <p>
- We look forward to seeing you at the event.
- </p>
- <form action='admin_finalconfirmation.php' method=post>
- <table>
- <tr><td>Custom text:</td><td><textarea name='txtCustom' rows='10'><?php echo stripslashes($_POST['txtCustom'])?></textarea></td></tr>
- <tr><td></td><td><input type='submit' value='Send e-mail' name='btnSend'/> <input value='Preview One' name='btnPreviewOne' type='submit' /> <input value='PreviewAll' name='btnPreviewAll' type='submit'/></td></tr>
- </table>
- </form>
-
-
- <?php
- $buttonpressed = 0;
- $customtext = htmlentities( stripslashes($_POST['txtCustom']));
-
- //The user has asked for a preview of all e-mails that will be sent
- if ($_POST['btnPreviewAll'] == 'Preview All' || $_POST['btnPreviewOne'] == 'Preview One')
- {
- $startPara = "<p>\n";
- $endPara = "</p>\n";
- $startIndent = "<ul>\n<li>";
- $endIndent = "</li></ul>\n";
- $indentItem = "</li>\n<li>";
- $poundsign = "£";
- $buttonpressed = 1;
- $customtext = str_replace("\n", "<br/>", $customtext);
- }
- //Or they want to send the e-mails
- else if ($_POST['btnSend'] == 'Send e-mail')
- {
- $startPara = "\n";
- $endPara = "\n";
- $startIndent = "\n\t";
- $endIndent = "";
- $indentItem = "\n\t";
- $poundsign = "?";
- $buttonpressed = 2;
- }
-
- if ($buttonpressed > 0 && CheckReferrer ('admin_finalconfirmation.php'))
- {
- $sql = "Select".
- " plPlayerID,".
- " plFirstName,".
- " plSurname,".
- " plEmail,".
- " bkBookAs,".
- " plEmergencyName,".
- " IFNULL(AES_DECRYPT(pleEmergencyNumber, '$key'),'') AS dEmergencyNumber,".
- "bkBunkAllocated, " .
- "bkMealTicket, " .
- "bkAmountPaid, ".
- "bkAmountExpected, ".
- "chName, chRace, chCulture, chReason " .
- "from {$db_prefix}players LEFT OUTER JOIN {$db_prefix}bookings ON {$db_prefix}players.plPlayerID = {$db_prefix}bookings.bkPlayerID " .
- " LEFT OUTER JOIN {$db_prefix}characters ON {$db_prefix}players.plPlayerID = {$db_prefix}characters.chPlayerID ".
- " WHERE bkDatePaymentConfirmed != '0000-00-00' and bkEventID = $eventid";
- " ORDER BY IF(plSurname='',1,0),plSurname";
-
- $result = ba_db_query ($link, $sql);
- echo "<hr/>";
- while ($record = ba_db_fetch_assoc ($result))
- {
- $output = "";
- $output.= $startPara;
- $output.= "Dear ".$record['plFirstName'].' '.$record['plSurname']."\n";
- $output.= $endPara;
- $output.= $startPara;
- $output.= "Thank you for booking for the upcoming event, ".EVENT_NAME.", you can download the event pack from ";
- $output.=SYSTEM_URL."event.php";
- $output.= $endPara;
-
- if (strlen($customtext) > 0)
- {
- $output.= $startPara;
- $output.= $customtext;
- $output.= $endPara;
- }
-
- $output.= $startPara;
- $output.= "Our records show that:";
- $output.= $startIndent . "You have booked as a " .$record['bkBookAs'];
- $output.= $indentItem . "Your emergency contact name is ".$record['plEmergencyName'];
- $output.= $indentItem . "Your emergency contact number is ".$record['dEmergencyNumber'];
- $bunk = "have not";
- if ($record['bkBunkAllocated'] == 1) {$bunk = "have";}
- $output.= $indentItem. "You $bunk been assigned a bunk space";
- $meal = "have not";
- if ($record['bkMealTicket'] == 1) {$meal = "have";}
- $output.= $indentItem. "You $meal requested a meal ticket";
- $output.= $indentItem. "You have paid a total of £".$record['bkAmountPaid'];
-
- $diff = $record['bkAmountExpected'] - $record['bkAmountPaid'];
- if ($diff != 0)
- {
- $output.= $indentItem. "You were expected to pay $poundsign".$record['bkAmountExpected'];
- if ($diff > 0)
- {
- $output.= $indentItem. "You will need to pay $poundsign$diff when you arrive on site";
- }
- else
- {
- $output.= $indentItem. "You will need to be refunded $poundsign".abs($diff)." when you arrive on site";
- }
- }
-
- if ($buttonpressed == 1)
- $output.= $indentItem. "Your In Character information is as follows:";
- else
- $output.= "\n\nYour In Character information is as follows:";
-
- $output.= $startIndent."Character name: ".$record['chName'];
-
-
-
- $output.= $indentItem. "Race: ".$record['chRace'];
- $output.= $indentItem. "Culture: ".$record['chCulture'];
- $output.= $indentItem. "Reason: ".$record['chReason'];
-
- $output.= $endIndent.$endIndent.$endPara;
- $output.= $endIndent.$endPara;
- $output.= $startPara;
- $output.="If any of the above information is incorrect, please let ";
- if ($buttonpressed == 1)
- $output.= EVENT_CONTACT_NAME." (<a href = 'mailto:" .Obfuscate (EVENT_CONTACT_MAIL) . "'>" . EVENT_CONTACT_MAIL . "</a>) know as soon as possible.";
- else
- $output.= EVENT_CONTACT_NAME." (".EVENT_CONTACT_MAIL . ") know as soon as possible.";
- $output.= $endPara;
- $output.= $startPara;
- $output.="We look forward to seeing you at the event.";
- $output.= $endPara;
-
- if ($buttonpressed == 1)
- {
- $output.= "<hr />";
- echo $output;
- }
- else if ($buttonpressed == 2)
- {
- echo "Sending confirmation e-mail to ".$record['plFirstName']." ".$record['plSurname']." (".PID_PREFIX . sprintf ('%03s', $record['plPlayerID']).")<br />\n";
-
- mail ($record ['plEmail'], SYSTEM_NAME . ' - Final Confirmation for '.EVENT_NAME, $output,
- "From:" . SYSTEM_NAME . " <" . EVENT_CONTACT_MAIL . ">");
- }
-
- }
- }
- ?>
-
- <?php
- include ('../inc/inc_foot.php');
- ?>