name; $event_start_date = Carbon::parse($challengeDetail->start_date); $event_end_date = Carbon::parse($challengeDetail->end_date); $actual_end_date = Carbon::parse($challengeDetail->end_date)->addDay(1); $reg_end_date = Carbon::createFromFormat('Y-m-d H:i:s', '2016-05-27 00:00:00'); // Redirect to index when registration period ends if(Carbon::now() >= $reg_end_date) { header("Location: ".$GLOBAL_HOSTHTTP_URL."/togo920/index.php"); exit; } ## Redirect if not Login if (!isInSession()) { header ("Location: ".$GLOBAL_HOSTHTTP_URL."/members/login.php?cb=".urlencode($THISURL->getUrl())); exit; } $user = new User(getSessionUserid()); if ($user->isBanned()) { header ("Location: ".$GLOBAL_HOSTHTTP_URL."/common/logout.php"); exit; } $cuser = ChallengeUser::where('cid', $challengeDetail->cid)->where('userid', getSessionUserid())->getOne(); if($cuser) { header("Location: ".$GLOBAL_HOSTHTTP_URL."/togo920/thank-you.php"); exit; } // $togo810_users = ChallengeUser::where('cid', 1)->orderBy('first_name', 'asc')->get(); $registration_limit = 1000; $challenge_users = ChallengeUser::where('cid', $challengeDetail->cid)->get(); $waiting = count($challenge_users) > $registration_limit ? true : false; $populate = false; $user_waiting = ChallengeSignupWaitingList::where('userid', getSessionUserid())->where('cid', $challengeDetail->cid)->get(); if(count($user_waiting) > 0) { $populate = true; if($waiting) { header ("Location: ".$GLOBAL_HOSTHTTP_URL."/togo920/registration_waiting_list.php"); exit; } } $now=date('Y-m-d H:i:s'); //to replace mysql NOW() $t810_user = ChallengeUser::where('cid', 1)->where('userid', getSessionUserid())->getOne(); //Process Form if(isset($_POST['Submit'])) { $dob = Carbon::parse($_POST['dob']); $membership = $_POST['membership']; if($waiting) { //PUT TO WAITING LIST $ChallengeSignup = new ChallengeSignupWaitingList; } else { //SIGNUP $ChallengeSignup = new ChallengeSignup; } //Check for form validation //populate $ChallengeSignup $ChallengeSignup->cid = $challengeDetail->cid; //2 Togo920 $ChallengeSignup->userid = getSessionUserid(); $ChallengeSignup->first_name = $_POST['first_name']; $ChallengeSignup->last_name = $_POST['last_name']; $ChallengeSignup->gender = $_POST['gender']; $ChallengeSignup->email = $_POST['email']; $ChallengeSignup->mobile = $_POST['mobile']; $ChallengeSignup->address = $_POST['address']; $ChallengeSignup->city = $_POST['city']; $ChallengeSignup->country = $_POST['country']; $ChallengeSignup->postal_code = $_POST['postal_code']; $ChallengeSignup->jersey_size = $_POST['jersey_size']; $ChallengeSignup->axa = isset($_POST['axa']) ? 1 : 0; $ChallengeSignup->nric = isset($_POST['nric']) ? $_POST['nric'] : ""; $ChallengeSignup->dob = $dob->format('Y-m-d'); $ChallengeSignup->date_created = $now; $ChallengeSignup->date_modified = $now; if($membership != '') { if($membership == 'Club Rainbow') { $ChallengeSignup->membership = $_POST['membership']; $ChallengeSignup->club_rainbow_name = $_POST['club_rainbow_name']; $ChallengeSignup->nric = $_POST['nric']; $price = 45; } else if($membership == 'TOGO810') { $ChallengeSignup->membership = $_POST['membership']; $price = 45; } else { $ChallengeSignup->membership = $_POST['membership']; $ChallengeSignup->matriculation_no = $_POST['matriculation_no']; $ChallengeSignup->matriculation_year = $_POST['matriculation_year']; $price = 39; } } else { $price = 48; } $sid = $ChallengeSignup->save(); if(!$sid>0) { sendErrorEmail('Togo920 Registration Error', 'Signup insertion error'); } if($waiting) { $message = $ChallengeSignup->first_name . ' ' . $ChallengeSignup->last_name . ' has been put on the waiting list.'; $header = "MIME-Version: 1.0\n"; $header .= "Content-type: text/html; charset=\"iso-8859-1\"\n"; $header .= "Bcc: marvin.baga@oneshift.com\r\n"; $header .= "From: togo920@togoparts.com \n"; $header .= "X-Sender: \n"; $header .= "X-Mailer: PHP\n"; //mailer $header .= "X-Priority: 3\n"; $header .= "Return-Path: \n"; @mail('togo920@togoparts.com', 'TOGO920 Waiting List Signup', $message, $header); header ("Location: ".$GLOBAL_HOSTHTTP_URL."/togo920/registration_waiting_list.php"); exit; } //PayPal log $paypalLog = new PayPalLog; $paypalLog->item = $challengeDetail->name; $paypalLog->currency = 'SGD'; $paypalLog->amount = $price; $paypalLog->userid = getSessionUserid(); $paypalLog->reference = ''; //store paypal receipt_ID, empty first $paypalLog->status = 0; $paypalLog->transactiondate = $now; //now $paypalLog->transactiondate_rtn = $now; //now $paypalLog->date_created = $now; //now $paypal_log_id = $paypalLog->save(); //insert first to get the id to passback to signup //echo('ppid='.$paypal_log_id.'
'); if(!$paypal_log_id>0) { error_log('Paypal Log insertion error'); sendErrorEmail('Togo920 Registration Error', 'Paypal Log insertion error'); //exit; } //https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/ $ppAmount = $price; //test users if(getSessionUserid()==31788) { //$ppAmount=0.5; } $paypalParams = '?cmd=_xclick'; $paypalParams .= '&business='.urlencode($togoparts_reciever_email); $paypalParams .= '&item_name='.urlencode($challengeDetail->name); $paypalParams .= '&item_number='.urlencode($challengeDetail->name); $paypalParams .= '&amount='.urlencode($ppAmount); $paypalParams .= '¬ify_url='.urlencode($CHALLENGE_NOTIFY_URL); $paypalParams .= '&return='.urlencode($CHALLENGE_SUCCESS_URL); $paypalParams .= '&cancel_return='.urlencode($CHALLENGE_CANCEL_URL); $paypalParams .= '&cpp_header_image='.urlencode($CHALLENGE_HEADER_IMG); $paypalParams .= '&custom='.urlencode($paypal_log_id); $paypalParams .= '&rm=2'; //Return method - the buyer's browser is redirected to the return URL by using the POST method, and all payment variables are included $paypalParams .= '&city=Singapore'; $paypalParams .= '&country=SG'; $paypalParams .= '&cpp_headerback_color='.urlencode('#FFFFFF'); $paypalParams .= '&cpp_headerborder_color='.urlencode('#FFFFFF'); $paypalParams .= '&display=1'; $paypalParams .= '&image_url='.urlencode('http://www.togoparts.com/images/togoparts_logo_pp_150x150.gif'); $paypalParams .= '&shipping=0.00'; $paypalParams .= '&no_shipping=1'; $paypalParams .= '&no_note=1'; $paypalParams .= '¤cy_code=SGD'; $paypalParams .= '&tax=0.00'; $paypalParams .= '&lc=SG'; $paypalParams .= '&bn=PP-BuyNowBF'; $payPalSubmit = $paypal_url.$paypalParams; //Update paypal_log wiht message - get params $ppMessage = 'GET VARS: '.$paypalParams; $updateArray = array('message'=>$ppMessage); $db->where('id', $paypal_log_id); $db->update('paypal_log', $updateArray); //Update signup with paypal_id to prepare for IPN notifiy $updateArray = array('paypal_log_id'=>$paypal_log_id); $db->where('sid', $sid); $db->update('challenge_signup', $updateArray); //echo($payPalSubmit); exit; header("Location: ".$payPalSubmit); exit; } ## Fill in the following for SEO $canonical_url = 'http://www.togoparts.com/pages/index.php'; $WEBPAGE_TITLE = "TOGO920 Registration | ".$GLOBAL_PORTAL_NAME; $meta_description = "Register for the TOGO920 Challenge"; $meta_keywords = ""; $canonical_url = ""; //for canonical meta rel tag if applicable $noSitetakeover = true; ?>
Togoparts.com

Registration

You have participated in #TOGO810. You automatically get a discounted rate of $45. Welcome back to challenging yourself in 2016!
Participating Fee is $48. If you have participated in #TOGO810, you will get a special rate of $45.
getEmail(); ?>
View Sizing Chart

Terms & Conditions

Completion of the entry form confirms the Participants' agreement to abide by the Rules & Regulations of the Togoparts920.

Read the Rules & Regulations here.

Liability and Disclaimers

I fully understand and acknowledge the risks involved in my participation in the Event and I accept full responsibility and assume all such risks.
You have to agree to our terms and conditions.
*/ ?>
We have reached our limit of participants. You may register your interest to be in our priority waiting list, and we will notify you if we increase the number of participants.