1114 && $md<1201 && !$_GET['preview'] && !$_GET['show']) { ?>

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.

Register

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
\n"; $tax=0; $subtotal=0; $r=mysqliQuery("SELECT * FROM transactions WHERE transaction_code='%s' ORDER BY id DESC",$_GET['order_id']); while($items=mysqli_fetch_assoc($r)) { if ($items['notes'] && !$notes) $notes=$items['notes']; $details.="\n"; $subtotal+=$items['price']; $tax+=$items['tax']; } if ($total<=0) $credits=$subtotal+$tax; $details.="\n\n\n"; if ($credits||$nonmember_credits||$mini_fee_credit) $details.="\n"; $details.="
\${$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']}

\n\n"; $details.="
Athlete Info
\n

{$_SESSION['first_name']} {$_SESSION['last_name']}
\n{$_SESSION['address']}
\n{$_SESSION['city']}, {$_SESSION['province']}
\n{$_SESSION['postal_code']}

\n\n"; //$email=mysqli_fetch_assoc(mysqliQuery("SELECT %s as msg, email_signature as sig FROM emails LIMIT 1",$_GET['order_description'])); ?>

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! 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')$_SESSION['id'],'player_consent_name'=>$_POST['player_consent_name'],'parent_consent_name'=>$_POST['parent_consent_name'],'waiver'=>$_POST['waiver'])); $tournaments=0;$products=0;$subtotal=0;$total=0;$taxes=0;$tax_rate=0;$product_taxes=0; if ($_POST['products']) { $i=0; foreach($_POST['products'] as $id => $doesntmatter) { $prod=mysqli_fetch_assoc(mysqliQuery("SELECT * FROM products WHERE id='%s' LIMIT 1",$id)); $product[$i]=$prod; $product[$i]['tax']=$prod['price']*$taxrate; if ($prod['pst_applicable']) $product[$i]['tax']+=$prod['price']*$pst; if ($_POST['prod_opt1'][$id]) $product[$i]['options'].=$product[$i]['option_1_name'].": ".$_POST['prod_opt1'][$id]; if ($_POST['prod_opt2'][$id]) { if ($product[$i]['options']) print ', '; $product[$i]['options'].=$product[$i]['option_2_name'].": ".$_POST['prod_opt2'][$id]; } if ($_POST['prod_opt3'][$id]) { if ($product[$i]['options']) print ', '; $product[$i]['options'].=$product[$i]['option_3_name'].": ".$_POST['prod_opt3'][$id]; } $product[$i]['option_1_values']=$_POST['prod_opt1'][$id]; $product[$i]['option_2_values']=$_POST['prod_opt2'][$id]; $product[$i]['option_3_values']=$_POST['prod_opt3'][$id]; $products+=$prod['price']; $product_taxes+=$product[$i]['tax']; $i++; } } if ($_POST['tournaments']) { $multiday=0; $i=0; //$atl_count=0; //$atl_price=0; //$atl_tax=0; //$atl_discount=0; foreach($_POST['tournaments'] as $id => $doesntmatter) { $tourney=mysqli_fetch_assoc(mysqliQuery("SELECT t.id, t.year, t.start_date, t.end_date, t.label, t.class, t.entry_fee, t.nonmember_surcharge, t.kids_event, t.max_registrants, count(tr.id) as entries, g.province, tax.rate/100 as tax_rate FROM tournaments as t LEFT JOIN transactions as tr ON (t.id=tr.tournaments_id AND tr.status='paid') LEFT JOIN golf_course_extras as gx ON (t.golf_course_extras_id=gx.id) LEFT JOIN companies as g ON (gx.companies_id=g.id) LEFT JOIN taxes as tax ON (g.province=tax.province) WHERE t.id='%s' GROUP BY t.id",$id)); if ($tourney['class']<3) $multiday=1; if ($tourney['kids_event']) $mini=1; else $junior=1; //if (!$tourney['tax_rate']) $tourney['tax_rate']=$taxrate; if (!$tourney['tax_rate']) $tourney['tax_rate']=0; //instead of charging the registrants provincial tax on tournanents outside Canada, charge no tax. $tourney['tax']=$tourney['entry_fee']*$tourney['tax_rate']; $tourney['sur_tax']=$tourney['nonmember_surcharge']*$tourney['tax_rate']; $tourney['label'].=" {$tourney['start_date']}"; if ($tourney['end_date']) $tourney['label'].=" - {$tourney['end_date']}"; if ($tourney['entries']>=$tourney['max_registrants']) $tourney['label']="Waiting List: ".$tourney['label']; $tournament[$i]=$tourney; $tournament_taxes+=$tourney['tax']; $tournaments+=$tourney['entry_fee']; if (($member_type===0 || ($member_type==='Mini' && $tourney['kids_event']==0)) && (!$_POST['membership'] || ($_POST['membership']=='Mini' && $tourney['kids_event']==0))) { $tournament_taxes+=$tourney['sur_tax']; $tournaments+=$tourney['nonmember_surcharge']; } $provs[$tourney['province']]=1; /* if ($tourney['province']=='NB' || $tourney['province']=='NS' || $tourney['province']=='PE' || $tourney['province']=='NL') { $atl_count++; $atl_price+=$tourney['entry_fee']; $atl_tax+=$tourney['tax']; } */ $i++; } } if ($_POST['code']) { $r=mysqliQuery("SELECT p.id, p.discount, p.tournaments_id, p.memberships_id, p.province FROM promo_codes as p WHERE p.label='%s' AND p.active=1 AND p.start_date <= CURDATE() AND (p.end_date='0000-00-00' OR p.end_date>=CURDATE()) AND (p.max=0 || p.max>(SELECT count(*) FROM transactions WHERE promo_codes_id=p.id AND status='Paid')) AND (SELECT count(*) FROM transactions WHERE promo_codes_id=p.id AND status='Paid' AND athletes_id='{$_SESSION['id']}')=0 LIMIT 1",$_POST['code']); if (mysqli_num_rows($r)>0) { $code=mysqli_fetch_assoc($r); if ($_POST['tournaments'][$code['tournaments_id']] || $provs[$code['province']] || ($mem['id'] && $mem['id']==$code['memberships_id']) || (!$code['province'] && !$code['memberships_id'] && !$code['tournaments_id'])) { $promo_discount=$code['discount']; $_SESSION['promo_code']=$_POST['code']; $iq=mysqliInsert("transactions",array('datetime'=>$datetime,'status'=>'Processing','athletes_id'=>$_SESSION['id'],'transaction_code'=>$transaction_code,'admin_items_id'=>18,'item_name'=>"Discount for Promo Code {$_POST['code']}",'price'=>-$code['discount'],'tax'=>$code['discount']*$taxrate*-1,'total'=>($code['discount']+$code['discount']*$taxrate)*-1,'promo_codes_id'=>$code['id'],'label'=>"Discount for Promo Code {$_POST['code']} for {$_SESSION['label']} at $datetime")); } } } $credits=credits($_SESSION['id']); if ($_POST['membership']) { if ($_POST['membership']=='Junior') $nonmember_credits=nonmember_credits($_SESSION['id']); else $nonmember_credits=0; $mini_fee_credit=mini_fee_credit($_SESSION['id']); } /* if ($atl_count>=4) { $atl_discount=round($atl_price/$atl_count,2); $tournaments-=$atl_discount; $tournament_taxes-=round($atl_tax/$atl_count,2); $atl_discount=$atl_discount/$atl_count; } */ $subtotal=$price+$products+$tournaments-$promo_discount; $taxes=($price-$promo_discount)*$taxrate+$tournament_taxes+$product_taxes; $total=$subtotal+$taxes-$credits-$nonmember_credits-$mini_fee_credit; if ($_POST['membership']) { $iq=mysqliInsert("transactions",array('datetime'=>$datetime,'status'=>'Processing','athletes_id'=>$_SESSION['id'],'transaction_code'=>$transaction_code,'memberships_id'=>$mem['id'],'item_name'=>$mem['label'],'price'=>$price,'tax'=>$price*$taxrate,'total'=>$price+$price*$taxrate,'notes'=>$_POST['notes'],'label'=>"{$mem['label']} for {$_SESSION['first_name']} {$_SESSION['last_name']} ({$_SESSION['DOB']}) at $datetime")); } if ($product) foreach($product as $p) { $iq=mysqliInsert("transactions",array('datetime'=>$datetime,'status'=>'Processing','athletes_id'=>$_SESSION['id'],'transaction_code'=>$transaction_code,'products_id'=>$p['id'],'item_name'=>$p['label'],'price'=>$p['price'],'tax'=>$p['tax'],'total'=>$p['price']+$p['tax'],'options'=>$p['options'],'notes'=>$_POST['notes'],'label'=>"{$p['label']} for {$_SESSION['label']} at $datetime")); } if ($tournament) foreach($tournament as $t) { if ($atl_discount) { $perc=$atl_discount/$t['entry_fee']; $t['tax']=$t['tax']-$t['tax']*$perc; $t['entry_fee']-=$atl_discount; } if ($t['nonmember_surcharge']>0 && ($member_type===0 || ($member_type==='Mini' && $t['kids_event']==0)) && (!$_POST['membership'] || ($_POST['membership']=='Mini' && $t['kids_event']==0))) { $iq=mysqliInsert("transactions",array('datetime'=>$datetime,'status'=>'Processing','athletes_id'=>$_SESSION['id'],'transaction_code'=>$transaction_code,'admin_items_id'=>24,'item_name'=>'Non-Member Surcharge','price'=>$t['nonmember_surcharge'],'tax'=>$t['sur_tax'],'total'=>$t['nonmember_surcharge']+$t['sur_tax'],'label'=>"Nonmember Surcharge for {$_SESSION['label']} at $datetime")); } $iq=mysqliInsert("transactions",array('datetime'=>$datetime,'status'=>'Processing','athletes_id'=>$_SESSION['id'],'transaction_code'=>$transaction_code,'tournaments_id'=>$t['id'],'item_name'=>$t['label'],'price'=>$t['entry_fee'],'tax'=>$t['tax'],'total'=>$t['entry_fee']+$t['tax'],'notes'=>$_POST['notes'],'label'=>"{$t['label']} for {$_SESSION['label']} at $datetime")); } $email2send='S';//0Mini1S-MI-T if ($price==$mem['early_bird_price'] && $mem['early_bird_price']!=$mem['price']) $email2send.='-E'; if ($_POST['membership']=='Junior') $email2send.='-M'; else if ($_POST['membership']=='Mini') $email2send.='-MI'; if ($credits<0) $email2send.='-A'; if ($nonmember_credits!=0 || $mini_fee_credit!=0) $email2send.='-C'; //if (strtotime($_SESSION['DOB']) <= strtotime('-19 years')) $email2send.='-CO'; if ($tournament) { $email2send.='-T'; if ($member_type!=='Junior' && $_POST['membership']!='Junior' && $junior) $email2send.='-NT'; if (!$member_type && !$_POST['membership']) $email2send.='-R'; } /* $collegiate = strtotime($_SESSION['DOB']) <= strtotime('-19 years'); if ($member_type!='Junior' && !$junior && ($member_type=='Mini' || $mini)) { //they've paid the mini tour reg fee and/or registered for a mini tour event, and didn't register for a Junior event or Junior membership $email2send="mini_tour"; } else if ($member_type) { if ($collegiate) $email2send="collegiate_addon_tournaments"; else $email2send="addon_tournaments"; } else if ($_POST['membership']) { if ($price==$mem['early_bird_price']) { if ($tournaments) $email2send="early_bird_plus_tournaments"; else $email2send="early_bird_membership_only"; } else { if ($collegiate) $email2send="collegiate_membership"; else $email2send="regular_membership"; } } else if ($multiday==1) { if ($collegiate) $email2send="collegiate_tournaments_only"; else $email2send="tournaments_only"; } else if ($tournament) { $email2send="1day_tournaments_only"; } else { $email2send="payment_on_account"; } */ if ($total<=0) { ?>

Redirecting to confirmation page. Please be patient.

You will now be redirected to the payment page...