Early-bird Registration Starts December 1!
Registration is currently closed while we prepare for the coming year. Check back December 1 for early-bird registration.
} else { if (!$_SESSION['id']) { ?> loginForm(); } else { ?>Register
$r=mysqliQuery("SELECT m.type FROM transactions as t, memberships as m WHERE t.memberships_id=m.id AND t.status='Paid' AND t.athletes_id='{$_SESSION['id']}' AND t.memberships_id>0 AND t.datetime>'".($config['season']-1)."-11-01 00:00:00' ORDER BY m.price DESC LIMIT 1"); if (mysqli_num_rows($r)<1) $member_type=0; else $member_type=mysqli_fetch_row($r)[0]; if ($_GET['order_id']) { if ($_GET['msg']!='Success') { print "Error {$_GET['code']}: {$_GET['message']}. Please contact us with this error message and we'll help sort things out.
"; $error_id=mysqliInsert('errors', ['transaction_code'=>$_GET['order_id'], 'error'=>'Msg!=Success', 'debug_info'=>$_SERVER["QUERY_STRING"]]); mailGun('jrtour@maplejt.com', "Transaction Error", "", "{$_GET['code']}: {$_GET['message']}\n{https://www.maplejt.com/admin/?table=errors&act=addedit&id=$error_id}"); } else { $total=mysqli_fetch_row(mysqliQuery("SELECT sum(total) FROM transactions WHERE transaction_code='%s'",$_GET['order_id']))[0]; $initial_total=$total; $credits=credits($_SESSION['id']); if (!$total && $credits>=0) { print "Order ID not found. Please contact us and we'll manually make sure your payment is assigned correctly.
"; $error_id=mysqliInsert('errors', ['transaction_code'=>$_GET['order_id'], 'error'=>'Order ID Not Found', 'debug_info'=>$_SERVER["QUERY_STRING"]]); mailGun('jrtour@maplejt.com', "Transaction Error", "", "Order ID Not Found\n{https://www.maplejt.com/admin/?table=errors&act=addedit&id=$error_id}"); } else { $nonmember_credits=nonmember_credits($_SESSION['id'],$_GET['order_id']); $mini_fee_credit=mini_fee_credit($_SESSION['id'],$_GET['order_id']); $total=$total-$credits-$nonmember_credits-$mini_fee_credit; if ($total<0) $total=0; if (round($total,2)!=round($_GET['total_amt'],2)) { print "Total amount paid does not match the total we've calculated for these items. Please contact us and we'll manually make sure your payment is assigned correctly.
"; $error_id=mysqliInsert('errors', ['transaction_code'=>$_GET['order_id'], 'error'=>'Total Not Matching', 'debug_info'=>$_SERVER["QUERY_STRING"]]); mailGun('jrtour@maplejt.com', "Transaction Error", "", "Total Not Matching\n{https://www.maplejt.com/admin/?table=errors&act=addedit&id=$error_id}"); } else { if ($_GET['total_amt']>0) { $response=file_get_contents("https://direct.gtpaysecure.net/direct/services/validation?CRESecureID=gt26489479&CRESecureAPIToken=64cfbeb701ee79ec1f6046056e6ab226&order_id={$_GET['order_id']}&total_amt=$total&trans_id={$_GET['TxnGUID']}", false, stream_context_create(array("ssl"=>array("cafile" => "cacert.pem", 'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)))); parse_str($response,$resp); } if ($resp && ($resp['order_id_match']!='YES' || /* $resp['total_amt_match']!='YES' || */ $resp['status']!='success' || $resp['trans_id_match']!='YES')) { print "Transaction match error. Please email us and we'll get your purchases assigned properly.
"; $error_id=mysqli_fetch_row(mysqliQuery("INSERT INTO errors (transaction_code,error,debug_info) VALUES ('%s','Transaction Not Matching','%s')",array($_GET['order_id'],$response.'\n'.$_SERVER["QUERY_STRING"])))[0]; mailGun('jrtour@maplejt.com', "Transaction Error", "", "Transaction Not Matching\n{https://www.maplejt.com/admin/?table=errors&act=addedit&id=$error_id}"); } else { $uq=0; $to_credit=$credits; if (!$_GET['type']) $_GET['type']=''; if ($credits>0||$nonmember_credits>0||$mini_fee_credit>0) { if ($nonmember_credits>0) { $nonmember_price=mysqli_fetch_row(mysqliQuery("SELECT sum(c.nonmember_surcharge) FROM transactions as t LEFT JOIN tournaments as c ON (t.tournaments_id=c.id) WHERE t.status='Paid' AND t.datetime>'".date('Y')."-01-01 00:00:00' AND t.tournaments_id>0 AND t.athletes_id='%s'",$_SESSION['id']))[0]; $nonmember_tax=$nonmember_credits-$nonmember_price; mysqliInsert("transactions",array('status'=>'Paid','athletes_id'=>$_SESSION['id'],'transaction_code'=>$_GET['order_id'],'admin_items_id'=>6,'item_name'=>'Non-member Upgrade Credit','price'=>"-$nonmember_price",'tax'=>"-$nonmember_tax",'total'=>"-$nonmember_credits",'label'=>"Non-member Upgrade Credit for {$_SESSION['label']} at ".date('Y-m-d H:i:s'))); } if ($mini_fee_credit>0) { $old_memberships_id=mysqli_fetch_row(mysqliQuery("SELECT memberships_id FROM transactions WHERE datetime>'".date('Y')."-01-01 00:00:00' AND athletes_id='%s' AND memberships_id>0 AND status='Paid' ORDER BY datetime DESC LIMIT 1", $_SESSION['id']))[0]; mysqliUpdate("athlete_mini_points", array("memberships_id"=>$memberships_id), "athletes_id='%s' AND memberships_id='%s'", array($_SESSION['id'], $old_memberships_id)); $mini_trans=mysqli_fetch_assoc(mysqliQuery("SELECT id, price, tax, total FROM transactions WHERE status='Paid' AND datetime>'".date('Y')."-01-01 00:00:00' AND memberships_id>0 AND athletes_id='%s'",$_SESSION['id'])); mysqliInsert("transactions",array('status'=>'Paid','athletes_id'=>$_SESSION['id'],'transaction_code'=>$_GET['order_id'],'admin_items_id'=>6,'item_name'=>'Non-member Upgrade Credit','price'=>"-{$mini_trans['price']}",'tax'=>"-{$mini_trans['tax']}",'total'=>"-{$mini_trans['total']}",'label'=>"Non-member Upgrade Credit for {$_SESSION['label']} at ".date('Y-m-d H:i:s'))); mysqliUpdate("transactions", array('status'=>'Fully Credited'), "id='%s'", $mini_trans['id'], 1); } if ($credits<0) { if ($credits+$nonmember_credits+$mini_fee_credit>=0) $to_credit=0; else $to_credit+=$nonmember_credits+$mini_fee_credit; } $running_credits=$credits+$nonmember_credits+$mini_fee_credit; if ($running_credits>0) { $r=mysqliQuery("SELECT id, total FROM transactions WHERE paid=0 AND transaction_code='%s' ORDER BY total DESC",$_GET['order_id']); while($item=mysqli_fetch_assoc($r)) { if ($item['total']>=$running_credits) { $item['total']-=$running_credits; $running_credits=0; } else { $running_credits-=$item['total']; $item['total']=0; } mysqliQuery("UPDATE transactions SET status='Paid', paid={$item['total']}, card_type='%s', notes=concat('Credit used. ',notes) WHERE id='{$item['id']}' LIMIT 1",$_GET['type']); $uq+=mysqli_affected_rows(); if ($running_credits<=0) break; } } } if ($to_credit<0) { if (mysqli_num_rows(mysqliQuery("SELECT id FROM transactions WHERE transaction_code='%s' AND athletes_id='%s' AND admin_items_id=25 LIMIT 1",array($_GET['order_id'],$_SESSION['id'])))<1) { mysqliInsert("transactions",array("status"=>"Paid","athletes_id"=>$_SESSION['id'],"transaction_code"=>$_GET['order_id'],"admin_items_id"=>25,"item_name"=>"Payment on Account","Paid"=>$to_credit*-1,"card_type"=>$_GET['type'],"label"=>"Payment on Account for {$_SESSION['label']} at ".date('Y-m-d H:i:s'))); $uq++; } } if ($_GET['order_description']=='early_bird_membership_only' || $_GET['order_description']=='early_bird_plus_tournaments' || $_GET['order_description']=='regular_membership' || $_GET['order_description']=='collegiate_membership') { //purchasing membership mysqliQuery("UPDATE athletes SET participation='active member' WHERE id='%s' LIMIT 1",$_SESSION['id']); } else if ($member_type===0 && $_GET['order_description']!='payment_on_account') { mysqliQuery("UPDATE athletes SET participation='active non-member' WHERE participation='inactive' AND id='%s' LIMIT 1",$_SESSION['id']); } if ($_SESSION['promo_code']) { mysqliQuery("UPDATE promo_codes SET used=used+1 WHERE label='%s' LIMIT 1",$_SESSION['promo_code']); unset($_SESSION['promo_code']); } mysqliQuery("UPDATE transactions SET status='Paid', paid=total, card_type='%s' WHERE transaction_code='%s' AND paid=0 AND status='Processing'",array($_GET['type'],$_GET['order_id'])); $uq+=mysqli_affected_rows(); $details="Items
| \${$items['price']} | {$items['item_name']} |
\$".number_format($subtotal,2)." | Sub-total |
| \$".number_format($tax,2)." | Taxes |
-\$".number_format($credits+$nonmember_credits+$mini_fee_credit,2)." | Credits |
| \$".number_format($total,2)." | Total |
\n\n"; $details.="
Payment Info
\n{$_GET['type']}
\n{$_GET['name']}
\n{$_GET['mPAN']}
\n{$_GET['exp']}
Athlete Info
\n{$_SESSION['first_name']} {$_SESSION['last_name']}
\n{$_SESSION['address']}
\n{$_SESSION['city']}, {$_SESSION['province']}
\n{$_SESSION['postal_code']}
Purchase Complete
We've emailed you a confirmation. The email may take up to 1 hour. Please check your spam folder and/or white-list the email address
Warning: Undefined variable $config in /home/tgc1tj2yfgbk/domains/dev.maplejt.com/html/register.php on line 138
Warning: Trying to access array offset on null in /home/tgc1tj2yfgbk/domains/dev.maplejt.com/html/register.php on line 138
. The below confirmation message is the same as the email you will receive.
Warning: Undefined variable $email in /home/tgc1tj2yfgbk/domains/dev.maplejt.com/html/register.php on line 139
Warning: Trying to access array offset on null in /home/tgc1tj2yfgbk/domains/dev.maplejt.com/html/register.php on line 139
Warning: Undefined variable $details in /home/tgc1tj2yfgbk/domains/dev.maplejt.com/html/register.php on line 140
Don't forget to follow us on Twitter and LIKE US on Facebook!
if ($uq>0) {
$details=str_replace(' ',' ',strip_tags($details));
$email_msg=buildEmail($_GET['order_description'], $details);
if ($_SESSION['players_email'])
mailGun($_SESSION['players_email'],"Registration", "", $email_msg);
if ($_SESSION['mothers_email'] && $_SESSION['mothers_email']!=$_SESSION['players_email'])
mailGun($_SESSION['mothers_email'],"Registration", "", $email_msg);
if ($_SESSION['fathers_email'] && $_SESSION['fathers_email']!=$_SESSION['mothers_email'] && $_SESSION['fathers_email']!=$_SESSION['players_email'])
mailGun($_SESSION['fathers_email'],"Registration", "", $email_msg);
if ($notes) $notes="Comments, Requests or Notes for Head Office:\n$notes\n\n";
mailGun($config['MJT_email_address'],"Registration Received","","You've received the following purchase:\n\n$notes$details");
}
}
}
}
}
} else {
$price=0;
$promo_discount=0;
$provs=array();
$taxrate=@mysqli_fetch_row(mysqliQuery("SELECT ROUND(rate/100,4) FROM taxes WHERE province='{$_SESSION['province']}' LIMIT 1"))[0];
if ($_SESSION['province']=='BC') $pst=0.07; else if ($_SESSION['province']=='MB') $pst=0.08; else $pst=0;
if (!$taxrate) $taxrate=0;
if ($_POST['register']) {
if ($_POST['membership']) {
$mem=mysqli_fetch_assoc(mysqliQuery("SELECT id, label, province, price, early_bird_price, early_bird_deadline FROM memberships WHERE year='{$config['season']}' AND (province='{$_SESSION['province']}' OR province='XX') AND type='%s' ORDER BY province, price DESC LIMIT 1",$_POST['membership']));
if (strtotime('-3 hours') Redirecting to confirmation page. Please be patient. You will now be redirected to the payment page...