Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start(); // start up PHP session to retrieve from variables from previous pages!
- $vapis=0;
- if($_POST['workshopname']==""){
- $_SESSION["wserr"]=1;
- $vaipis=1;
- }else{
- $_SESSION["wserrv"]=$_POST['workshopname'];
- $_SESSION["wserr"]=0;
- }
- if($_POST['date']==""){
- $_SESSION["daterr"]=1;
- $vaipis=1;
- }else{
- $_SESSION["daterrv"]=$_POST['date'];
- $_SESSION["daterr"]=0;
- }
- if($_POST['location']==""){
- $_SESSION["locerr"]=1;
- $vaipis=1;
- }else{
- $_SESSION["locerrv"]=$_POST['location'];
- $_SESSION["locerr"]=0;
- }
- if($_POST['name']==""){
- $_SESSION["namerr"]=1;
- $vaipis=1;
- }else{
- $_SESSION["namerrv"]=$_POST['name'];
- $_SESSION["namerr"]=0;
- }
- if($_POST['organisation']==""){
- }else{
- $_SESSION["organisation"]=$_POST['organisation'];
- }
- if($_POST['email']==""){
- $_SESSION["emailerr"]=1;
- $vaipis=1;
- }else{
- $_SESSION["emailerrv"]=$_POST['email'];
- $_SESSION["emailerr"]=0;
- }
- if($_POST['phone']==""){
- $_SESSION["phonerr"]=1;
- $vaipis=1;
- }else{
- $_SESSION["phonerrv"]=$_POST['phone'];
- $_SESSION["phonerr"]=0;
- }
- if($_POST['postal1']==""){
- $_SESSION["p1err"]=1;
- $vaipis=1;
- }else{
- $_SESSION["p1errv"]=$_POST['postal1'];
- $_SESSION["p1err"]=0;
- }
- if($vapis==1){
- //header("location:workshop-registration.php");
- exit(0);
- }
- if($_POST['attendee1']==""){
- $_SESSION["a1err"]=1;
- header("location:workshop-registration.php");
- }else{
- $_SESSION["a1errv"]=$_POST['attendee1'];
- $_SESSION["a1err"]=0;
- }
- if(!isset($_POST['acceptterms'])){
- $_SESSION["accterm"]=1;
- header("location:workshop-registration.php");
- }
- $_SESSION['date'] = $_POST['date'];
- $_SESSION['name'] = $_POST['name'];
- $_SESSION['organisation'] = $_POST['organisation'];
- $_SESSION['workshopnamefull'] = $_POST['workshopnamefull'];
- $_SESSION['invoice_id'] = $invoice_id;
- $_SESSION['totalattending'] = $_POST['attendeecount'];
- $totalatt=$_POST['attendeecount'];
- $_SESSION['costextax'] = $_POST['costextax'];
- $_SESSION['gstcost'] = $_POST['gstcost'];
- $_SESSION['totalcost2'] = $_POST['totalcost2'];
- if (isset($_POST['btnProcess'])){
- // attempt to connect to database and insert next unique record and retrieve as the next invoice number
- $hostname="localhost";
- $user="lili2764_literh";
- $pass="kWHRR5g";
- $database="lili2764_literh_db";
- $connection = mysqli_connect($hostname, $user, $pass) or die ("Unable to connect!");
- mysqli_select_db($connection, $database) or die(mysqli_errno($connection) . ": " . mysqli_error($connection) . "<br>");
- // Returns next value for an invoice, taken from a table with a single auto-incremented field.
- function get_next_counter($invoicesoutstanding) {
- // Insert new row, auto-incrementing counter, get inserted value which is the next id to use.
- $rc = mysqli_query($connection, 'INSERT INTO '.$invoicesoutstanding.' VALUES ((NULL), NOW())');
- if($rc === false)
- die('MySQL error: '.mysqli_error($connection));
- $next_counter = mysqli_insert_id($connection);
- return $next_counter;
- }
- $invoice_id = get_next_counter('invoicesoutstanding');
- // set up session variables for retrieval at later pages (eg. invoice display)
- $_SESSION['date'] = $_POST['date'];
- $_SESSION['name'] = $_POST['name'];
- $_SESSION['organisation'] = $_POST['organisation'];
- $_SESSION['workshopnamefull'] = $_POST['workshopnamefull'];
- $_SESSION['invoice_id'] = $invoice_id;
- $_SESSION['totalattending'] = $_POST['attendeecount'];
- $totalatt=$_POST['attendeecount'];
- $_SESSION['costextax'] = $_POST['costextax'];
- $_SESSION['gstcost'] = $_POST['gstcost'];
- $_SESSION['totalcost2'] = $_POST['totalcost2'];
- // Assign a cost to the selected workshop
- $workshopname = $_POST['workshopname'];
- if (($workshopname == 'prep') || ($workshopname == 'intervention-strategies') || ($workshopname == 'six-traits') || ($workshopname == 'blp1-6') || ($workshopname == 'rtc3-6')) {
- $workshopcost = '275';
- }
- elseif (($workshopname == 'literacy-apps') || ($workshopname == 'guidedreading') || ($workshopname == 'literacy-blocks') || ($workshopname == 'readingstamina')) {
- $workshopcost = '85';
- }
- elseif (($workshopname == 'aides') || ($workshopname == 'aides-r')) {
- $workshopcost = '195';
- }
- // Retrive field variable from form and removed slashes added by PHP - eg. for apostrophes in words
- $workshopdate = $_POST['date'];
- if($workshopdate==""){
- $_SESSION["daterr"]=1;
- echo $_SESSION["daterr"];
- header("location:workshop-registration.php");
- }
- $organisation = stripslashes($_POST['organisation']);
- $postal1 = stripslashes($_POST['postal1']);
- for($i=1;$i<=$_POST['attendeecount'];$i++)
- {
- $var="attendee".$i;
- $attendeename[$i-1] = stripslashes($_POST[$var]);
- }
- // Some slashes still appearing in workshop-registration-4.php - run stripslashes again. Not sure of a more efficient way to do this?
- $organisation = stripslashes($organisation);
- $postal1 = stripslashes($postal1);
- // Assign full name to selected workshop
- if ($workshopname == 'prep') {
- $workshopnamefull = 'Prep Reading and Writing';
- }
- if ($workshopname == 'intervention-strategies') {
- $workshopnamefull = 'Intervention Strategies';
- }
- if ($workshopname == 'six-traits') {
- $workshopnamefull = 'The Six Traits of Writing';
- }
- if ($workshopname == 'rtc3-6') {
- $workshopnamefull = 'Reciprocal Teaching and Comprehension Strategies';
- }
- if ($workshopname == 'blp1-6') {
- $workshopnamefull = 'A Balanced Literacy Program';
- }
- if ($workshopname == 'aides') {
- $workshopnamefull = 'Teachers Aides Literacy Workshop';
- }
- if ($workshopname == 'guidedreading') {
- $workshopnamefull = 'Guided Reading';
- }
- if ($workshopname == 'literacy-apps') {
- $workshopnamefull = 'Meaningful Apps for Teaching Literacy';
- }
- if ($workshopname == 'literacy-blocks') {
- $workshopnamefull = 'Teaching Approaches: Reading and Writing (incl. Literacy Block)';
- }
- if ($workshopname == 'readingstamina') {
- $workshopnamefull = 'Reading Stamina';
- }
- // Determine how many people have been registered
- $totalattending=0;
- for($i=1;$i<=$_POST['attendeecount'];$i++)
- {
- $var="attendee".$i;
- if($attendeename[$i-1]!="")
- {
- $totalattending++;
- }
- }
- // work out total cost of registrations including GST (note totalcost has a different variable name when formated due to an unknown error when using 5 people for full-day w'shop
- $totalcost1 = $totalattending * $workshopcost * 110 / 100;
- $totalcost2 = number_format($totalcost1,2);
- $costextax = $totalattending * $workshopcost;
- $gstcost = $totalcost1 / 11;
- // GST set to 0 for non Australian locations
- if (($location == 'Auckland') || ($location == 'Wellington')) {
- $gstcost = '0';
- $totalcost = $totalattending * $workshopcost;
- //$totalcost2 = $totalcost2 / 11 * 10;
- $totalcost2 = number_format($totalcost,2);
- }
- $costextax = number_format($costextax,2);
- $gstcost = number_format($gstcost,2);
- // Amount for transfer to eway for processing - remove cents - eway payment system can't handle cents? code removed as live process does handle cents but not test.
- // $roundoff = explode(".", $totalcost1);
- // $txtAmount = $roundoff[0].".00";
- // $txtAmount = $txtAmount * 100;
- // Amount sent to eway payment gateway (no decimal point)
- $txtAmount = $totalcost1 * 100;
- // additional session variables for retrieval at later pages (eg. invoice display)
- $_SESSION['organisation'] = stripslashes($_POST['organisation']);
- $_SESSION['postal1'] = stripslashes($_POST['postal1']);
- for($i=1;$i<=$_POST['attendeecount'];$i++)
- {
- $vars="attendee".$i."name";
- $_SESSION[$var]=stripslashes($attendeename[$i-1]);
- }
- // Some slashes still appearing in workshop-registration-4.php - run stripslashes again. Not sure of a more efficient way to do this?
- $_SESSION['organisation'] = stripslashes($_SESSION['organisation']);
- $_SESSION['postal1'] = stripslashes($_SESSION['postal1']);
- /**************** Send confirmation email to Litsol, Cassie and client. **********************/
- /* See mailer-registration.php file in scripts folder for fully commented script.
- /* EMAIL VALIDATION */
- if(!isset($_SERVER['HTTP_USER_AGENT'])){
- die("Forbidden - You are not authorized to view this page");
- exit;
- }
- if(!$_SERVER['REQUEST_METHOD'] == "POST"){
- die("Forbidden - You are not authorized to view this page");
- exit;
- }
- $authHosts = array("literacysolutions.com.au");
- $fromArray = parse_url(strtolower($_SERVER['HTTP_REFERER']));
- $wwwUsed = strpos($fromArray['host'], "www.");
- if(!in_array(($wwwUsed === false ? $fromArray['host'] : substr(stristr($fromArray['host'], '.'), 1)), $authHosts)){
- header("HTTP/1.0 403 Forbidden");
- exit;
- }
- $badStrings = array("content-type:",
- "mime-version:",
- "content-transfer-encoding:",
- "bcc:",
- "to:",
- "cc:");
- foreach($_POST as $k => $v){
- foreach($badStrings as $v2){
- $v = strtolower($v);
- if(strpos($v, $v2) !== false){
- header("HTTP/1.0 403 Forbidden");
- exit;
- }
- }
- }
- unset($k, $v, $v2, $badStrings, $authHosts, $fromArray, $wwwUsed);
- /* END EMAIL VALIDATION */
- $sendTo = "info@literacysolutions.com.au";
- $subject = "Workshop Registration & Tax Invoice - Payment Required";
- $headers = "From: " . $_POST["litsolname"] ." ". "<" . $_POST["litsolemail"] .">\r\n";
- $headers .= "Reply-To: " . $_POST["litsolemail"] . "\r\n";
- $headers .= "Cc: cassie@literacysolutions.com.au, " . $_POST["email"] . "\r\n";
- $headers .= "Return-path: " . $_POST["email"];
- // Following code necessary to remove multiple added slashes on apostropes in names. more added at each form page. Find more efficient way to do this.
- $name = stripslashes($name);
- $name = stripslashes($name);
- $name = stripslashes($name);
- $name = stripslashes($name);
- $organisation = stripslashes($organisation);
- $organisation = stripslashes($organisation);
- $organisation = stripslashes($organisation);
- $organisation = stripslashes($organisation);
- $postal1 = stripslashes($postal1);
- $postal1 = stripslashes($postal1);
- $postal1 = stripslashes($postal1);
- $postal1 = stripslashes($postal1);
- $instructions = stripslashes($instructions);
- $instructions = stripslashes($instructions);
- $instructions = stripslashes($instructions);
- $instructions = stripslashes($instructions);
- if (!empty($organisation)) {
- $to = $organisation;
- }
- else {$to = $name;
- }
- $message =
- "------ WORKSHOP REGISTRATION -----\r\n".
- "\r\nThank you, literacy workshop registration details have been received as detailed below.\r\n".
- " ------------------------------------\r\n".
- "Location: ". $_POST["location"] ."\r\n".
- "Workshop: ". $_SESSION["workshopnamefull"] ."\r\n".
- " ------------------------------------\r\n".
- "Date: ". $_POST["date"] ."\r\n".
- " ------------------------------------\r\n".
- "Name: ". $name ."\r\n".
- "School: ". $organisation ."\r\n".
- "Email: ". $_POST["email"] ."\r\n".
- "Phone: ". $_POST["phone"] ."\r\n".
- "Address: ". $postal1 ."\r\n".
- " ------------------------------------\r\n";
- /*
- for($i=1;$i<=$_POST['attendeecount'];$i++)
- {
- $stringaman=stripslashes(trim(implode("",explode("\\",$attendeename[$i-1]))));
- $message=$message."Attendee $i: ".stripslashes($stringaman)."\r\n";
- }
- */
- $ic=1;
- for($i=1;$i<=$_POST['attendeecount'];$i++)
- {
- $stringaman=stripslashes(trim(implode("",explode("\\",$attendeename[$i-1]))));
- if($stringaman!=""){
- $message=$message."Attendee $ic: ".stripslashes($stringaman)."\r\n";
- $ic++;
- }
- }
- $message=$message." ------------------------------------\r\n".
- "Instructions:\r\n".
- $instructions ."\r\n".
- " ------------------------------------\r\n".
- "Note:\r\n".
- "Full-day workshops commence at 8:45am and finish at 2:45pm.\r\n".
- "After school workshops commence at 3:30pm and finish at 5:15pm.\r\n".
- "\r\n".
- "Please see our website at http://www.literacysolutions.com.au/workshops/ for workshop venues and further details. Should you have any questions, feel free to contact us at info@literacysolutions.com.au.\r\n".
- "\r\n".
- "Cancellations\r\n".
- "As part of your registration, you accepted the Term and Conditions of registration which in part state:\r\n".
- "Cancellations received 20 business days or more prior to the workshop date incur a 10% charge per registration to cover administration costs. Cancellations received less than 20 business days, but more than five business days prior to the workshop, incur a 50% charge per registration to cover administration, catering and facility costs. Cancellations received five business days or less before a workshop are non refundable or if payment is yet to be made, the full cost of the course is payable.\r\n".
- "----------------------------------------------\r\n".
- "----------------------------------------------\r\n".
- "\r\n".
- "\r\n".
- "\r\n".
- "----------------- TAX INVOICE ----------------\r\n\r\n".
- "Invoice number: " . $invoice_id . "\r\n".
- "Date: " . Date('l d F Y') . "\r\n".
- "To: " . $to . "\r\n".
- "Address: ". $postal1 ."\r\n".
- "\r\n".
- "Registration Details\r\n".
- "Registration (x". $totalattending . ") for " . $workshopnamefull . "\r\n$" . $costextax . "\r\n".
- "GST: $" . $_SESSION["gstcost"] . "\r\n".
- "Total paid: $0.00\r\n".
- "Balance due: $" . $_SESSION["totalcost2"] . "\r\n".
- " ------------------------------------\r\n".
- "Literacy Solutions Pty Ltd\r\n".
- "PO Box 1350\r\n".
- "Carindale Qld 4152\r\n".
- "Telephone: (07) 3901 8373\r\n".
- "Mobile: 0412 401 676\r\n".
- "Fax: (07) 3324 1322\r\n".
- "Email: cassie@literacysolutions.com.au\r\n".
- "ABN: 75 603 254 066\r\n".
- "www.literacysolutions.com.au\r\n".
- "----------------------------------------------\r\n".
- "----------------------------------------------\r\n".
- "Payments can be made by cheque or EFT.\r\n".
- "Account name: Literacy Solutions\r\n".
- "BSB: 638060\r\n".
- "Account: 13542028\r\n".
- "\r\n".
- "\r\n".
- "\r\n".
- "\r\n".
- "\r\n".
- "\r\n".
- "Marketing stream:"."\r\n".
- " Flyer faxed: ". $_POST["flyerfaxed"] ."\r\n".
- " Flyer mailed: ". $_POST["flyermailed"] ."\r\n".
- " Brochure: ". $_POST["brochure"] ."\r\n".
- " Advertisement: ". $_POST["advertisement"] ."\r\n".
- "Email to school: ". $_POST["emailschool"] ."\r\n".
- " Email direct: ". $_POST["emailtoyou"] ."\r\n".
- " Search engine: ". $_POST["searchengine"] ."\r\n".
- " Editorial: ". $_POST["editorial"] ."\r\n".
- " Word of mouth: ". $_POST["wordofmouth"] ."\r\n".
- " Dont know: ". $_POST["dontknow"] ."\r\n";
- //mail($sendTo, $subject, $message, $headers);
- header("location:http://www.literacysolutions.com.au/workshops/workshop-registration-3a.php");
- /**************** END confirmation email. **********************/
- }else{
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Payment options: Literacy Solutions</title>
- <?php include("../includes/head-code.htm"); ?>
- <script src="/scripts/forms.js" type="text/javascript"></script>
- </head>
- <body id="workshops">
- <?php include("../includes/header.htm");
- ?>
- <div id="content">
- <div id="mainContent" class="fullWidth">
- <article class="topContent">
- <h1>Payment options</h1>
- <div id="formsteps"><div><strong>STEP 1</strong><br />Registration details</div><div class="formstepselected"><strong>STEP 2</strong><br />Payment options</div><div><strong>STEP 3</strong><br />Make payment</div><div><strong>STEP 4</strong><br />Invoice</div></div>
- <!--<div class="simple"> -->
- <form name="registrationform" id="longform" title="registration" method="post" action="https://www.literacysolutions.com.au/workshops/workshop-registration-3.php">
- <?php
- // Put all previous page form parameteres into a hidden field for passing on to next page
- foreach ($_POST as $key => $val) {
- echo '<input type="hidden" name="' . $key . '" value="'
- . htmlentities($val, ENT_QUOTES) . '" />' . "\r\n";
- }
- $workshopdate = $_POST['date'];
- $location = $_POST['location'];
- $_SESSION['date'] = $_POST['date'];
- $_SESSION['name'] = $_POST['name'];
- $_SESSION['organisation'] = $_POST['organisation'];
- $_SESSION['workshopnamefull'] = $_POST['workshopnamefull'];
- $_SESSION['invoice_id'] = $invoice_id;
- $_SESSION['totalattending'] = $_POST['attendeecount'];
- $totalatt=$_POST['attendeecount'];
- $_SESSION['costextax'] = $_POST['costextax'];
- $_SESSION['gstcost'] = $_POST['gstcost'];
- $_SESSION['totalcost2'] = $_POST['totalcost2'];
- $totalattending=0;
- for($i=1;$i<=$_POST['attendeecount'];$i++)
- {
- $var="attendee".$i;
- if($_POST[$var]!="")
- {
- $totalattending++;
- }
- }
- // Assign a cost to the selected workshop
- if (($workshopname == 'prep') || ($workshopname == 'intervention-strategies') || ($workshopname == 'six-traits') || ($workshopname == 'blp1-6') || ($workshopname == 'rtc3-6')) {
- $workshopcost = '275';
- }
- elseif (($workshopname == 'literacy-apps') || ($workshopname == 'guidedreading') || ($workshopname == 'literacy-blocks') || ($workshopname == 'readingstamina')) {
- $workshopcost = '85';
- }
- elseif (($workshopname == 'aides') || ($workshopname == 'aides-r')) {
- $workshopcost = '195';
- }
- // Assign full name to selected workshop
- if ($workshopname == 'prep') {
- $workshopnamefull = 'Prep Reading and Writing';
- }
- if ($workshopname == 'intervention-strategies') {
- $workshopnamefull = 'Intervention Strategies';
- }
- if ($workshopname == 'six-traits') {
- $workshopnamefull = 'The Six Traits of Writing';
- }
- if ($workshopname == 'rtc3-6') {
- $workshopnamefull = 'Reciprocal Teaching and Comprehension Strategies';
- }
- if ($workshopname == 'blp1-6') {
- $workshopnamefull = 'A Balanced Literacy Program';
- }
- if ($workshopname == 'aides') {
- $workshopnamefull = 'Teachers Aides Literacy Workshop';
- }
- if ($workshopname == 'guidedreading') {
- $workshopnamefull = 'Guided Reading';
- }
- if ($workshopname == 'literacy-apps') {
- $workshopnamefull = 'Meaningful Apps for Teaching Literacy';
- }
- if ($workshopname == 'literacy-blocks') {
- $workshopnamefull = 'Teaching Approaches: Reading and Writing (incl. Literacy Block)';
- }
- if ($workshopname == 'readingstamina') {
- $workshopnamefull = 'Reading Stamina';
- }
- // change language depending on number of registrations submitted
- if ($totalattending > 1) {
- $personpeople = 'people';
- }
- else {$personpeople = 'person';
- }
- // work out total cost of registrations including GST
- $costextax = $totalattending * $workshopcost;
- $totalcost = $totalattending * $workshopcost * 110 / 100;
- $gstcost = $totalcost - $costextax;
- // GST set to 0 for non Australian locations
- if (($location == 'Auckland') || ($location == 'Wellington')) {
- $gstcost = '0';
- $totalcost = $totalattending * $workshopcost;
- }
- $costextax = number_format($costextax,2);
- $totalcost = number_format($totalcost,2);
- $gstcost = number_format($gstcost,2);
- $_SESSION['gstcost'] = $gstcost;
- $_SESSION['totalcost2'] = $totalcost;
- //$_SESSION['totalcost2'] = number_format($totalcost,2);
- echo "<p>You are about to register <strong>" . $totalattending . "</strong> " . $personpeople . " to attend:</p>
- <p><strong><cite>" . $workshopnamefull . "</cite> (" . $location . ") on " . $workshopdate . ".</strong></p>
- <p>To confirm this booking you will need to make your payment. The total cost including GST (where applicable) is <strong>$" . $totalcost . "</strong>.</p>";
- ?>
- <input type="hidden" name="workshopnamefull" id="workshopnamefull" value="<?php echo $workshopnamefull; ?>" />
- <div class="input alignleft">
- <input type="submit" class="submit" value="Pay Now by Credit Card" />
- </div>
- </form>
- <p> OR</p>
- <form name="offline-payment" id="offline-payment" title="offline-payment" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" ENCTYPE="multipart/form-data">
- <?php
- // Put all previous page form parameters into a hidden field for passing on to next page
- foreach ($_POST as $key => $val) {
- echo '<input type="hidden" name="' . $key . '" value="'
- . htmlentities($val, ENT_QUOTES) . '" />' . "\r\n";
- }
- ?>
- <input type="hidden" name="workshopnamefull" id="workshopnamefull" value="<?php echo $workshopnamefull; ?>" />
- <div class="input alignleft">
- <input type="submit" class="submit" name="btnProcess" id="btnProcess" value="Pay Later by Cheque or EFT" />
- </div>
- </form>
- <!--</div>-->
- </article>
- </div> <!-- close mainContent -->
- </div> <!-- close content -->
- <?php include("../includes/footer.htm"); ?>
- <script>
- var navigation = responsiveNav("#nav");
- </script>
- </body>
- </html>
- <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement