File "home.php"
Full Path: /home/ichhrkpd/public_html/application/examples/home.php
File size: 98.96 KB
MIME-type: text/x-php
Charset: utf-8
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends GSController {
function __construct() {
parent::__construct ();
//$this->CheckSession(true);
}
public function index() {
$pdata = array();
$notice_data = array();
$this->load->model("database/Mcommon_notice");
$this->Mcommon_notice->status('A');
$notice_data = $this->Mcommon_notice->SelectAll("","id","desc");
if(empty($notice_data)){
$notice_data = array();
}
$pdata['notice_data'] = $notice_data;
//GPrint($notice_data);die;
$content_all = array();
$this->load->model("database/Mcontent");
$this->Mcontent->cid(1);
if($this->Mcontent->Select()){
$content_all = $this->Mcontent;
}
if(empty($content_all)){
$content_all = array();
}
$pdata['content_all'] = $content_all;
$events_data = array();
$this->load->model("database/Mevents");
$this->Mevents=new Mevents();
$events_data = $this->Mevents->SelectAll("","ev_id","desc");
//GPrint($events_data);die;
if(empty($events_data)){
$events_data = array();
}
$pdata['events_data'] = $events_data;
$img_data = array();
$this->load->model("database/Mimages");
$this->Mimages = new Mimages();
$this->Mimages->status('A');
$img_data = $this->Mimages->selectAll("","img_id","desc");
if(empty($img_data)){
$img_data = array();
}
$pdata['img_data'] = $img_data;
//GPrint($img_data);die;
$pdata['LoadViews'] = "home";
$this->LoadView($pdata);
}
public function single_notice(){
$pdata = array();
$uriData = $this->GetUriArray();
$allowed = array('id');
foreach ($uriData as $key=>$value){
if(!in_array($key,$allowed)){
redirect("page/error404");
}
}
$notice_id = $uriData['id'];
$this->load->model("database/Mcommon_notice");
$this->Mcommon_notice->id($notice_id);
if($this->Mcommon_notice->select()){
$pdata['notice_data'] = $this->Mcommon_notice;
}else{
redirect("page/error404");
}
//GPrint($pdata);die;
$pdata['LoadViews'] = "single_notice";
$this->LoadView($pdata);
}
public function single_event(){
$pdata = array();
$uriData = $this->GetUriArray();
$allowed = array('ev_id');
foreach ($uriData as $key=>$value){
if(!in_array($key,$allowed)){
redirect("page/error404");
}
}
$event_id = $uriData['ev_id'];
$this->load->model("database/Mevents");
$this->Mevents->ev_id($event_id);
if($this->Mevents->select()){
$pdata['event_data'] = $this->Mevents;
}else{
redirect("page/error404");
}
$pdata['LoadViews'] = "single_event";
$this->LoadView($pdata);
}
public function about(){
$pdata = array();
$pdata['LoadViews'] = "about";
$this->LoadView($pdata);
}
public function pp(){
}
function Do_direct_payment(){
//$this->CheckSession(true);
$utype = $this->session->GetCurrentUserType();
$employerTypeArr = array('S'=>'State & Federal Govt','C'=>'Corporation & Businesses','N'=>'Nonprofit & Local','O'=>'Open');
$pData = array();
$this->load->model("database/Memployer");
$this->load->model("database/Mracers");
if(IsPostBack){
$racerArr = $this->input->post("racerArr", true);
$total_amount = $this->input->post("total_amount", true);
$card_type = $this->input->post("card_type", true);
$card_number = $this->input->post("card_number", true);
$expiration_year = $this->input->post("expiration_year", true);
$expiration_month = $this->input->post("expiration_month", true);
$cvv = $this->input->post("cvv", true);
$first_name = $this->input->post("first_name", true);
$last_name = $this->input->post("last_name", true);
$address_1 = $this->input->post("address_1", true);
$address_2 = $this->input->post("address_2", true);
$city = $this->input->post("city", true);
$state = $this->input->post("state", true);
$zip = $this->input->post("zip", true);
$form_email = $this->input->post("form_email", true);
$expiration = $expiration_month.$expiration_year;
foreach ($racerArr as $ra){
$this->Mracers = new Mracers();
$this->Mracers->rid($ra);
if($this->Mracers->Select()){
if($this->Mracers->is_paid == 'Y'){
$this->session->set_flashdata('message', array('url' => 'home','msg' => 'A problem has been occurred while submitting your data. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
}else{
$this->session->set_flashdata('message', array('url' => 'home','msg' => 'A problem has been occurred while submitting your data. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
}
}else{
redirect("home");die;
}
if($utype == 'SG'){
$single_data = $this->session->GetSingleData();
$employer_id = $single_data->eid;
$tid = $single_data->tid;
$session_email = $single_data->email;
}else{
$multiple_data = $this->session->GetMultipleData();
$employer_id = $multiple_data->eid;
$org_id = $multiple_data->organizer_id;
$session_email = $multiple_data->organizer_email;
}
$this->Memployer->eid($employer_id);
if($this->Memployer->Select()){
$pData['employerInfo']['employer_name'] = $this->Memployer->employer_name;
$pData['employerInfo']['employer_type'] = $employerTypeArr[$this->Memployer->employer_type];
$pData['employerInfo']['employer_address'] = $this->Memployer->employer_address;
$pData['employerInfo']['employer_city'] = $this->Memployer->employer_city;
$pData['employerInfo']['employer_state'] = $this->Memployer->employer_state;
$pData['employerInfo']['employer_zip'] = $this->Memployer->employer_zip;
}else{
redirect("home");die;
}
//Below Portion is for Paypal STARTS heer ************
$this->load->helper('url');
// Load PayPal library
$this->config->load('paypal');
$config = array(
'Sandbox' => $this->config->item('Sandbox'), // Sandbox / testing mode option.
'APIUsername' => $this->config->item('APIUsername'), // PayPal API username of the API caller
'APIPassword' => $this->config->item('APIPassword'), // PayPal API password of the API caller
'APISignature' => $this->config->item('APISignature'), // PayPal API signature of the API caller
'APISubject' => '', // PayPal API subject (email address of 3rd party user that has granted API permission for your app)
'APIVersion' => $this->config->item('APIVersion') // API version you'd like to use for your call. You can set a default version in the class and leave this blank if you want.
);
// Show Errors
if($config['Sandbox'])
{
error_reporting(E_ALL);
ini_set('display_errors', '1');
}
$this->load->library('paypal/Paypal_pro', $config);
$DPFields = array(
'paymentaction' => 'Sale', // How you want to obtain payment. Authorization indidicates the payment is a basic auth subject to settlement with Auth & Capture. Sale indicates that this is a final sale for which you are requesting payment. Default is Sale.
'ipaddress' => $_SERVER['REMOTE_ADDR'], // Required. IP address of the payer's browser.
'returnfmfdetails' => '1' // Flag to determine whether you want the results returned by FMF. 1 or 0. Default is 0.
);
$CCDetails = array(
'creditcardtype' => "$card_type", // Required. Type of credit card. Visa, MasterCard, Discover, Amex, Maestro, Solo. If Maestro or Solo, the currency code must be GBP. In addition, either start date or issue number must be specified.
'acct' => "$card_number", // Required. Credit card number. No spaces or punctuation.
'expdate' => "$expiration", // Required. Credit card expiration date. Format is MMYYYY
'cvv2' => "$cvv", // Requirements determined by your PayPal account settings. Security digits for credit card.
'startdate' => '', // Month and year that Maestro or Solo card was issued. MMYYYY
'issuenumber' => '' // Issue number of Maestro or Solo card. Two numeric digits max.
);
$PayerInfo = array(
'email' => "$form_email", // Email address of payer.
'payerid' => '', // Unique PayPal customer ID for payer.
'payerstatus' => '', // Status of payer. Values are verified or unverified
'business' => '' // Payer's business name.
);
$PayerName = array(
'salutation' => 'Mr. / Mrs.', // Payer's salutation. 20 char max.
'firstname' => "$first_name", // Payer's first name. 25 char max.
'middlename' => '', // Payer's middle name. 25 char max.
'lastname' => "$last_name", // Payer's last name. 25 char max.
'suffix' => '' // Payer's suffix. 12 char max.
);
$BillingAddress = array(
'street' => "$address_1", // Required. First street address.
'street2' => "$address_2", // Second street address.
'city' => "$city", // Required. Name of City.
'state' => "$state", // Required. Name of State or Province.
'countrycode' => 'US', // Required. Country code.
'zip' => "$zip", // Required. Postal code of payer.
'phonenum' => '' // Phone Number of payer. 20 char max.
);
$PaymentDetails = array(
'amt' => "$total_amount", // Required. Total amount of order, including shipping, handling, and tax.
'currencycode' => 'USD', // Required. Three-letter currency code. Default is USD.
'itemamt' => '', // Required if you include itemized cart details. (L_AMTn, etc.) Subtotal of items not including S&H, or tax.
'shippingamt' => '', // Total shipping costs for the order. If you specify shippingamt, you must also specify itemamt.
'shipdiscamt' => '', // Shipping discount for the order, specified as a negative number.
'handlingamt' => '', // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt.
'taxamt' => '', // Required if you specify itemized cart tax details. Sum of tax for all items on the order. Total sales tax.
'desc' => 'VCCCSAR ENTRY FEE', // Description of the order the customer is purchasing. 127 char max.
'custom' => '', // Free-form field for your own use. 256 char max.
'invnum' => '', // Your own invoice or tracking number
'notifyurl' => '' // URL for receiving Instant Payment Notifications. This overrides what your profile is set to use.
);
$Secure3D = array(
'authstatus3d' => '',
'mpivendor3ds' => '',
'cavv' => '',
'eci3ds' => '',
'xid' => ''
);
$PayPalRequestData = array(
'DPFields' => $DPFields,
'CCDetails' => $CCDetails,
'PayerInfo' => $PayerInfo,
'PayerName' => $PayerName,
'BillingAddress' => $BillingAddress,
'PaymentDetails' => $PaymentDetails,
'Secure3D' => $Secure3D
);
$PayPalResult = $this->paypal_pro->DoDirectPayment($PayPalRequestData);
//GPrint($PayPalResult['ACK']);die; false &&
if(false && !$this->paypal_pro->APICallSuccessful($PayPalResult['ACK'])){
$errors = array('Errors'=>$PayPalResult['ERRORS']);
//GPrint($errors);die;
//$this->load->view('paypal/samples/error',$errors);
$errMsg = "";
if (is_array($errors['Errors']) || is_object($errors['Errors'])){
foreach ($errors['Errors'] as $err){
$errMsg .= '<div class="well"><b>Error Code : </b> '.$err["L_ERRORCODE"].' <br><strong>'.$err["L_SHORTMESSAGE"].' ! </strong>'.$err["L_LONGMESSAGE"].'</div>';
}
}else{
$errMsg = "<p>A problem has been occurred while submitting your data. Please try again.</p>";
}
$this->session->set_flashdata('message', array('url' => 'home',
'msg' => ''.$errMsg.'',
'msg_type' => 'err'));
redirect("home/payment_message");die;
}else{
// Successful call. Load view or whatever you need to do here.
$paypal_response_data = array('PayPalResult'=>$PayPalResult);
//$this->load->view('paypal/samples/do_direct_payment',$data);
$this->load->model("database/Mpaypal_responses");
$this->load->model("database/Mracers");
$this->load->model("database/Mpay_history");
$sample_response = 'a:10:{s:9:"TIMESTAMP";s:20:"2017-02-27T09:08:54Z";s:13:"CORRELATIONID";s:13:"5fc14151c591f";s:3:"ACK";s:7:"Success";s:7:"VERSION";s:4:"76.0";s:5:"BUILD";s:8:"25237094";s:3:"AMT";s:5:"25.00";s:12:"CURRENCYCODE";s:3:"USD";s:7:"AVSCODE";s:1:"N";s:9:"CVV2MATCH";s:1:"M";s:13:"TRANSACTIONID";s:17:"11C74371KE570401P";}';
$sample_payment_txn = "AagfdTsgfksRT";
$this->Mpaypal_responses = new Mpaypal_responses();
$this->Mpaypal_responses->response($sample_response);
$this->Mpaypal_responses->payment_txn($sample_payment_txn);
$this->Mpaypal_responses->amount($total_amount);
$this->Mpaypal_responses->Save();
foreach ($racerArr as $ra){
$this->Mracers = new Mracers();
$this->Mracers->rid($ra);
$this->Mracers->is_paid('Y');
$this->Mracers->payment_txn($sample_payment_txn);
$this->Mracers->Update();
}
$this->Mpay_history = new Mpay_history();
$this->Mpay_history->payment_txn($sample_payment_txn);
if($utype == 'SG'){
$this->Mpay_history->tid($tid);
}else{
$this->Mpay_history->organizer_id($org_id);
}
$this->Mpay_history->racer_ids(implode(',',$racerArr));
$this->Mpay_history->amount($total_amount);
$this->Mpay_history->card_type($card_type);
$this->Mpay_history->card_number($card_number);
$this->Mpay_history->first_name($first_name);
$this->Mpay_history->last_name($last_name);
$this->Mpay_history->Save();
$billing_info = array();
$billing_info['amount'] = $total_amount;
$billing_info['payment_txn'] = $sample_payment_txn;
$billing_info['name'] = $first_name. " " . $last_name;
$billing_info['type'] = $card_type;
$billing_info['address'] = $address_1;
$billing_info['city'] = $city .',';
$billing_info['state'] = $state .',';
$billing_info['zip'] = $zip;
/*
<b>Billing Info:</b>
<br>Paid Amount: $'.'$billing_info['amount']'. (No Refunds)
<br>Confirmation Number: $billing_info['payment_txn']
<br>Name on Card: urldecode(@firstName) urldecode(@lastName)
<br> Card Type: $billing_info['name']
<br>$billing_info['address']
<br>$billing_info['city'], $billing_info['state'] $billing_info['zip']
*/
$mainData = array();
$racerAcceptArr = array(1,2,3);
//$query = "SELECT r.first_name, r.last_name, r.member_id, r.email, r.tid as r_tid, r.phone, t.team_name, t.code, t.race_type, t.tid FROM racers AS r LEFT JOIN teams AS t ON r.tid = t.tid ORDER BY r.tid;";
//$racerInfo = "SELECT * FROM racers WHERE rid IN (1,2,31,32,33);";
$teams_info_query = "SELECT r.tid, t.team_name, t.race_type, t.code FROM racers AS r LEFT JOIN teams AS t ON r.tid = t.tid WHERE r.rid IN (".implode(',',$racerArr).") GROUP BY r.tid;";
$teams_info_records = $this->db->query($teams_info_query);
$teams_info = $teams_info_records->result();
//GPrint($teams_info);
foreach ($teams_info as $tinfo){
$mainData[$tinfo->tid]['team_name'] = $tinfo->team_name;
$mainData[$tinfo->tid]['code'] = $tinfo->code;
$mainData[$tinfo->tid]['race_type'] = $tinfo->race_type == "R" ? "Running" : "Walking";
$this->Mracers = new Mracers();
$this->Mracers->tid($tinfo->tid);
$racerData = $this->Mracers->SelectAll("","","",3);//parameter 3 is LIMIT 3
$mainData[$tinfo->tid]['member_info'][1]['member_id'] = "Team Captain Info";
$mainData[$tinfo->tid]['member_info'][1]['first_name'] = "";
$mainData[$tinfo->tid]['member_info'][1]['last_name'] = "";
$mainData[$tinfo->tid]['member_info'][1]['email'] = "";
$mainData[$tinfo->tid]['member_info'][1]['phone'] = "";
$mainData[$tinfo->tid]['member_info'][1]['is_paid'] = "Unpaid";
$mainData[$tinfo->tid]['member_info'][2]['member_id'] = "Member 2 Info";
$mainData[$tinfo->tid]['member_info'][2]['first_name'] = "";
$mainData[$tinfo->tid]['member_info'][2]['last_name'] = "";
$mainData[$tinfo->tid]['member_info'][2]['email'] = "";
$mainData[$tinfo->tid]['member_info'][2]['phone'] = "";
$mainData[$tinfo->tid]['member_info'][2]['is_paid'] = "Unpaid";
$mainData[$tinfo->tid]['member_info'][3]['member_id'] = "Member 3 Info";
$mainData[$tinfo->tid]['member_info'][3]['first_name'] = "";
$mainData[$tinfo->tid]['member_info'][3]['last_name'] = "";
$mainData[$tinfo->tid]['member_info'][3]['email'] = "";
$mainData[$tinfo->tid]['member_info'][3]['phone'] = "";
$mainData[$tinfo->tid]['member_info'][3]['is_paid'] = "Unpaid";
if (is_array($racerData) || is_object($racerData)){
foreach($racerData as $rd){
if(!in_array($rd->member_id, $racerAcceptArr)){
continue;
}
$mainData[$tinfo->tid]['member_info'][$rd->member_id]['member_id'] = $rd->member_id ==1 ? ($rd->member_id == 2 ? 'Member 2 Info' : 'Team Captain Info') : ($rd->member_id == 3 ? 'Member 3 Info' : 'Member 2 Info');
$mainData[$tinfo->tid]['member_info'][$rd->member_id]['first_name'] = $rd->first_name;
$mainData[$tinfo->tid]['member_info'][$rd->member_id]['last_name'] = $rd->last_name;
$mainData[$tinfo->tid]['member_info'][$rd->member_id]['email'] = $rd->email;
$mainData[$tinfo->tid]['member_info'][$rd->member_id]['phone'] = $rd->phone;
$mainData[$tinfo->tid]['member_info'][$rd->member_id]['is_paid'] = $rd->is_paid == 'Y' ? 'Paid' : 'Unpaid';
}
}
}
$this->email_body_payment($pData , $mainData ,$session_email,$billing_info);
$this->session->set_flashdata('message', array('url' => 'home',
'msg' => '<div class="well">Your credit card was charged: $'.$total_amount.'<br />
Your confirmation ID: '.$sample_payment_txn.'<br />
A confirmation e-mail has been sent to: '.$session_email.'<br /><br />
If you do not receive an email within the next 5 minutes,
please check your Spam/Junk Mail folder.</div>',
'msg_type' => 'suc'));
redirect("home/payment_message");die;
}
die;
}
function Do_direct_payment_test(){
//Below Portion is for Paypal
$this->load->helper('url');
// Load PayPal library
$this->config->load('paypal');
$config = array(
'Sandbox' => $this->config->item('Sandbox'), // Sandbox / testing mode option.
'APIUsername' => $this->config->item('APIUsername'), // PayPal API username of the API caller
'APIPassword' => $this->config->item('APIPassword'), // PayPal API password of the API caller
'APISignature' => $this->config->item('APISignature'), // PayPal API signature of the API caller
'APISubject' => '', // PayPal API subject (email address of 3rd party user that has granted API permission for your app)
'APIVersion' => $this->config->item('APIVersion') // API version you'd like to use for your call. You can set a default version in the class and leave this blank if you want.
);
// Show Errors
if($config['Sandbox'])
{
error_reporting(E_ALL);
ini_set('display_errors', '1');
}
$this->load->library('paypal/Paypal_pro', $config);
$DPFields = array(
'paymentaction' => 'Sale', // How you want to obtain payment. Authorization indidicates the payment is a basic auth subject to settlement with Auth & Capture. Sale indicates that this is a final sale for which you are requesting payment. Default is Sale.
'ipaddress' => $_SERVER['REMOTE_ADDR'], // Required. IP address of the payer's browser.
'returnfmfdetails' => '1' // Flag to determine whether you want the results returned by FMF. 1 or 0. Default is 0.
);
$CCDetails = array(
'creditcardtype' => 'MasterCard', // Required. Type of credit card. Visa, MasterCard, Discover, Amex, Maestro, Solo. If Maestro or Solo, the currency code must be GBP. In addition, either start date or issue number must be specified.
'acct' => '5204247750001471', // Required. Credit card number. No spaces or punctuation.
'expdate' => '112022', // Required. Credit card expiration date. Format is MMYYYY
'cvv2' => '111', // Requirements determined by your PayPal account settings. Security digits for credit card.
'startdate' => '', // Month and year that Maestro or Solo card was issued. MMYYYY
'issuenumber' => '' // Issue number of Maestro or Solo card. Two numeric digits max.
);
$PayerInfo = array(
'email' => 'test@domain.com', // Email address of payer.
'payerid' => '', // Unique PayPal customer ID for payer.
'payerstatus' => '', // Status of payer. Values are verified or unverified
'business' => 'Testers, LLC' // Payer's business name.
);
$PayerName = array(
'salutation' => 'Mr.', // Payer's salutation. 20 char max.
'firstname' => 'Tester', // Payer's first name. 25 char max.
'middlename' => '', // Payer's middle name. 25 char max.
'lastname' => 'Testerson', // Payer's last name. 25 char max.
'suffix' => '' // Payer's suffix. 12 char max.
);
$BillingAddress = array(
'street' => '123 Test Ave.', // Required. First street address.
'street2' => '', // Second street address.
'city' => 'Kansas City', // Required. Name of City.
'state' => 'MO', // Required. Name of State or Province.
'countrycode' => 'US', // Required. Country code.
'zip' => '64111', // Required. Postal code of payer.
'phonenum' => '555-555-5555' // Phone Number of payer. 20 char max.
);
$PaymentDetails = array(
'amt' => '1.00', // Required. Total amount of order, including shipping, handling, and tax.
'currencycode' => 'USD', // Required. Three-letter currency code. Default is USD.
'itemamt' => '', // Required if you include itemized cart details. (L_AMTn, etc.) Subtotal of items not including S&H, or tax.
'shippingamt' => '', // Total shipping costs for the order. If you specify shippingamt, you must also specify itemamt.
'shipdiscamt' => '', // Shipping discount for the order, specified as a negative number.
'handlingamt' => '', // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt.
'taxamt' => '', // Required if you specify itemized cart tax details. Sum of tax for all items on the order. Total sales tax.
'desc' => 'VCCCSAR ENTRY FEE', // Description of the order the customer is purchasing. 127 char max.
'custom' => '', // Free-form field for your own use. 256 char max.
'invnum' => '', // Your own invoice or tracking number
'notifyurl' => '' // URL for receiving Instant Payment Notifications. This overrides what your profile is set to use.
);
$Secure3D = array(
'authstatus3d' => '',
'mpivendor3ds' => '',
'cavv' => '',
'eci3ds' => '',
'xid' => ''
);
$PayPalRequestData = array(
'DPFields' => $DPFields,
'CCDetails' => $CCDetails,
'PayerInfo' => $PayerInfo,
'PayerName' => $PayerName,
'BillingAddress' => $BillingAddress,
'PaymentDetails' => $PaymentDetails,
'Secure3D' => $Secure3D
);
$PayPalResult = $this->paypal_pro->DoDirectPayment($PayPalRequestData);
if(!$this->paypal_pro->APICallSuccessful($PayPalResult['ACK']))
{
$errors = array('Errors'=>$PayPalResult['ERRORS']);
$this->load->view('paypal/samples/error',$errors);
}
else
{
// Successful call. Load view or whatever you need to do here.
$data = array('PayPalResult'=>$PayPalResult);
$this->load->view('paypal/samples/do_direct_payment',$data);
}
}
function Do_direct_payment_bk(){
$this->CheckSession(true);
$utype = $this->session->GetCurrentUserType();
$employerTypeArr = array('S'=>'State & Federal Govt','C'=>'Corporation & Businesses','N'=>'Nonprofit & Local','O'=>'Open');
$pData = array();
$this->load->model("database/Memployer");
$this->load->model("database/Mracers");
if(IsPostBack){
$racerArr = $this->input->post("racerArr", true);
$total_amount = $this->input->post("total_amount", true);
}else{
redirect("home");die;
}
if($utype == 'SG'){
}
$racerArr = array(1,17,18,19,28,30);
$mainData = array();
//$query = "SELECT r.first_name, r.last_name, r.member_id, r.email, r.tid as r_tid, r.phone, t.team_name, t.code, t.race_type, t.tid FROM racers AS r LEFT JOIN teams AS t ON r.tid = t.tid ORDER BY r.tid;";
//$racerInfo = "SELECT * FROM racers WHERE rid IN (1,2,31,32,33);";
$teams_info_query = "SELECT r.tid, t.team_name, t.race_type, t.code FROM racers AS r LEFT JOIN teams AS t ON r.tid = t.tid WHERE r.rid IN (".implode(',',$racerArr).") GROUP BY r.tid;";
$teams_info_records = $this->db->query($teams_info_query);
$teams_info = $teams_info_records->result();
//GPrint($teams_info);
$this->load->model("database/Mracers");
foreach ($teams_info as $tinfo){
$mainData[$tinfo->tid]['team_name'] = $tinfo->team_name;
$mainData[$tinfo->tid]['code'] = $tinfo->code;
$mainData[$tinfo->tid]['race_type'] = $tinfo->race_type == "R" ? "Running" : "Walking";
$this->Mracers = new Mracers();
$this->Mracers->tid($tinfo->tid);
$racerData = $this->Mracers->SelectAll("","","",3);//parameter 3 is LIMIT 3
$mainData[$tinfo->tid]['member_info'][1]['first_name'] = "";
$mainData[$tinfo->tid]['member_info'][1]['last_name'] = "";
$mainData[$tinfo->tid]['member_info'][1]['email'] = "";
$mainData[$tinfo->tid]['member_info'][1]['phone'] = "";
$mainData[$tinfo->tid]['member_info'][1]['is_paid'] = "Unpaid";
$mainData[$tinfo->tid]['member_info'][2]['first_name'] = "";
$mainData[$tinfo->tid]['member_info'][2]['last_name'] = "";
$mainData[$tinfo->tid]['member_info'][2]['email'] = "";
$mainData[$tinfo->tid]['member_info'][2]['phone'] = "";
$mainData[$tinfo->tid]['member_info'][2]['is_paid'] = "Unpaid";
$mainData[$tinfo->tid]['member_info'][3]['first_name'] = "";
$mainData[$tinfo->tid]['member_info'][3]['last_name'] = "";
$mainData[$tinfo->tid]['member_info'][3]['email'] = "";
$mainData[$tinfo->tid]['member_info'][3]['phone'] = "";
$mainData[$tinfo->tid]['member_info'][3]['is_paid'] = "Unpaid";
foreach($racerData as $rd){
$mainData[$tinfo->tid]['member_info'][$rd->member_id]['first_name'] = $rd->first_name;
$mainData[$tinfo->tid]['member_info'][$rd->member_id]['last_name'] = $rd->last_name;
$mainData[$tinfo->tid]['member_info'][$rd->member_id]['email'] = $rd->email;
$mainData[$tinfo->tid]['member_info'][$rd->member_id]['phone'] = $rd->phone;
$mainData[$tinfo->tid]['member_info'][$rd->member_id]['is_paid'] = $rd->is_paid == 'Y' ? 'Paid' : 'Unpaid';
}
}
//
foreach ($mainData as $md){
echo "<br>Team info: <br> ".$md['team_name'] . "<br> code: " .$md['code'] . "<br>Tpye: " . $md['race_type'] ."<br><br>";
foreach ($md['member_info'] as $mi){
echo "".$mi['first_name'] ." ". $mi['last_name'];
echo "<br>".$mi['email'] ." <br> ". $mi['phone'] ." <br> ". $mi['is_paid']." <br> ";
}
}
GPrint($mainData);
die;
$team_data = $tid = $this->session->GetSingleData();
$team_id = $team_data->tid;
$employer_id = $team_data->eid;
$pData['teamInfo']['team_name'] = $team_data->team_name;
$pData['teamInfo']['team_type'] = $team_data->race_type == 'R' ? 'Running' : 'Walking';
$this->Memployer->eid($employer_id);
if($this->Memployer->Select()){
$pData['employerInfo']['employer_name'] = $this->Memployer->employer_name;
$pData['employerInfo']['employer_type'] = $employerTypeArr[$this->Memployer->employer_type];
$pData['employerInfo']['employer_address'] = $this->Memployer->employer_address;
$pData['employerInfo']['employer_city'] = $this->Memployer->employer_city;
$pData['employerInfo']['employer_state'] = $this->Memployer->employer_state;
$pData['employerInfo']['employer_zip'] = $this->Memployer->employer_zip;
}else{
redirect("home");die;
}
$pData['memberInfo'][1]['first_name'] = '-';
$pData['memberInfo'][1]['last_name'] = '-';
$pData['memberInfo'][1]['email'] = '-';
$pData['memberInfo'][1]['phone'] = '-';
$pData['memberInfo'][1]['is_paid'] = 'N';
$pData['memberInfo'][2]['first_name'] = '-';
$pData['memberInfo'][2]['last_name'] = '-';
$pData['memberInfo'][2]['email'] = '-';
$pData['memberInfo'][2]['phone'] = '-';
$pData['memberInfo'][2]['is_paid'] = 'N';
$pData['memberInfo'][3]['first_name'] = '-';
$pData['memberInfo'][3]['last_name'] = '-';
$pData['memberInfo'][3]['email'] = '-';
$pData['memberInfo'][3]['phone'] = '-';
$pData['memberInfo'][3]['is_paid'] = 'N';
foreach ($racerArr as $r){
$this->Mracers = new Mracers();
$this->Mracers->rid($r);
if($this->Mracers->Select()){
$pData['memberInfo'][$this->Mracers->member_id]['first_name'] = $this->Mracers->first_name;
$pData['memberInfo'][$this->Mracers->member_id]['last_name'] = $this->Mracers->last_name;
$pData['memberInfo'][$this->Mracers->member_id]['email'] = $this->Mracers->email;
$pData['memberInfo'][$this->Mracers->member_id]['phone'] = $this->Mracers->phone;
$pData['memberInfo'][$this->Mracers->member_id]['is_paid'] = $this->Mracers->is_paid == 'Y' ? 'Paid' : 'Unpaid';
}
}
$this->email_body_payment($pData);
//GPrint($this->Memployer);
GPrint($racerArr);
GPrint($total_amount);
GPrint($team_data);
GPrint($pData);
die;
//Below Portion is for Paypal
$this->load->helper('url');
// Load PayPal library
$this->config->load('paypal');
$config = array(
'Sandbox' => $this->config->item('Sandbox'), // Sandbox / testing mode option.
'APIUsername' => $this->config->item('APIUsername'), // PayPal API username of the API caller
'APIPassword' => $this->config->item('APIPassword'), // PayPal API password of the API caller
'APISignature' => $this->config->item('APISignature'), // PayPal API signature of the API caller
'APISubject' => '', // PayPal API subject (email address of 3rd party user that has granted API permission for your app)
'APIVersion' => $this->config->item('APIVersion') // API version you'd like to use for your call. You can set a default version in the class and leave this blank if you want.
);
// Show Errors
if($config['Sandbox'])
{
error_reporting(E_ALL);
ini_set('display_errors', '1');
}
$this->load->library('paypal/Paypal_pro', $config);
$DPFields = array(
'paymentaction' => 'Sale', // How you want to obtain payment. Authorization indidicates the payment is a basic auth subject to settlement with Auth & Capture. Sale indicates that this is a final sale for which you are requesting payment. Default is Sale.
'ipaddress' => $_SERVER['REMOTE_ADDR'], // Required. IP address of the payer's browser.
'returnfmfdetails' => '1' // Flag to determine whether you want the results returned by FMF. 1 or 0. Default is 0.
);
$CCDetails = array(
'creditcardtype' => 'Visa', // Required. Type of credit card. Visa, MasterCard, Discover, Amex, Maestro, Solo. If Maestro or Solo, the currency code must be GBP. In addition, either start date or issue number must be specified.
'acct' => '4900000000000086', // Required. Credit card number. No spaces or punctuation.
'expdate' => '062018', // Required. Credit card expiration date. Format is MMYYYY
'cvv2' => '123', // Requirements determined by your PayPal account settings. Security digits for credit card.
'startdate' => '', // Month and year that Maestro or Solo card was issued. MMYYYY
'issuenumber' => '' // Issue number of Maestro or Solo card. Two numeric digits max.
);
$PayerInfo = array(
'email' => 'test@domain.com', // Email address of payer.
'payerid' => '', // Unique PayPal customer ID for payer.
'payerstatus' => '', // Status of payer. Values are verified or unverified
'business' => 'Testers, LLC' // Payer's business name.
);
$PayerName = array(
'salutation' => 'Mr.', // Payer's salutation. 20 char max.
'firstname' => 'Tester', // Payer's first name. 25 char max.
'middlename' => '', // Payer's middle name. 25 char max.
'lastname' => 'Testerson', // Payer's last name. 25 char max.
'suffix' => '' // Payer's suffix. 12 char max.
);
$BillingAddress = array(
'street' => '123 Test Ave.', // Required. First street address.
'street2' => '', // Second street address.
'city' => 'Kansas City', // Required. Name of City.
'state' => 'MO', // Required. Name of State or Province.
'countrycode' => 'US', // Required. Country code.
'zip' => '64111', // Required. Postal code of payer.
'phonenum' => '555-555-5555' // Phone Number of payer. 20 char max.
);
$PaymentDetails = array(
'amt' => '1.00', // Required. Total amount of order, including shipping, handling, and tax.
'currencycode' => 'USD', // Required. Three-letter currency code. Default is USD.
'itemamt' => '', // Required if you include itemized cart details. (L_AMTn, etc.) Subtotal of items not including S&H, or tax.
'shippingamt' => '', // Total shipping costs for the order. If you specify shippingamt, you must also specify itemamt.
'shipdiscamt' => '', // Shipping discount for the order, specified as a negative number.
'handlingamt' => '', // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt.
'taxamt' => '', // Required if you specify itemized cart tax details. Sum of tax for all items on the order. Total sales tax.
'desc' => 'VCCCSAR ENTRY FEE', // Description of the order the customer is purchasing. 127 char max.
'custom' => '', // Free-form field for your own use. 256 char max.
'invnum' => '', // Your own invoice or tracking number
'notifyurl' => '' // URL for receiving Instant Payment Notifications. This overrides what your profile is set to use.
);
$Secure3D = array(
'authstatus3d' => '',
'mpivendor3ds' => '',
'cavv' => '',
'eci3ds' => '',
'xid' => ''
);
$PayPalRequestData = array(
'DPFields' => $DPFields,
'CCDetails' => $CCDetails,
'PayerInfo' => $PayerInfo,
'PayerName' => $PayerName,
'BillingAddress' => $BillingAddress,
'PaymentDetails' => $PaymentDetails,
'Secure3D' => $Secure3D
);
$PayPalResult = $this->paypal_pro->DoDirectPayment($PayPalRequestData);
if(!$this->paypal_pro->APICallSuccessful($PayPalResult['ACK']))
{
$errors = array('Errors'=>$PayPalResult['ERRORS']);
$this->load->view('paypal/samples/error',$errors);
}
else
{
// Successful call. Load view or whatever you need to do here.
$data = array('PayPalResult'=>$PayPalResult);
$this->load->view('paypal/samples/do_direct_payment',$data);
}
}
public function single_team(){
$uriData = $this->GetUriArray();
$tabArr = array('1','2','3','4');
$tab_id = '1';
if(isset($uriData['tab'])){
if(in_array($uriData['tab'], $tabArr)){
$tab_id = $uriData['tab'];
}
}
$pdata = array();
$pdata['tab_id'] = $tab_id;
$pdata['LoadViews'] = "single_team";
$this->LoadView($pdata);
}
public function volunteer(){
$pdata = array();
$pdata['LoadViews'] = "volunteer";
$this->LoadView($pdata);
}
public function sponsor(){
$pdata = array();
$pdata['LoadViews'] = "sponsor";
$this->LoadView($pdata);
}
public function result(){
$pdata = array();
$pdata['LoadViews'] = "result";
$this->LoadView($pdata);
}
public function reg_runner(){
$pdata = array();
$query = "SELECT `racers`.*, `t`.`team_name`, `t`.`race_type`, `e`.`employer_name`, `e`.`employer_type` FROM (`racers`)
LEFT JOIN `teams` AS t ON `t`.`tid`=`racers`.`tid`
LEFT JOIN `employer` AS e ON `e`.`eid`=`t`.`eid` WHERE `racers`.`is_paid` = 'Y' AND t.race_type = 'R'";
$records = $this->db->query($query);
$data = $records->result();
$pdata['data'] = $data;
$pdata['heading'] = "Registered Runners";
$pdata['LoadViews'] = "reg_runner_walker";
$this->LoadView($pdata);
}
public function reg_walker(){
$pdata = array();
$query = "SELECT `racers`.*, `t`.`team_name`, `t`.`race_type`, `e`.`employer_name`, `e`.`employer_type` FROM (`racers`)
LEFT JOIN `teams` AS t ON `t`.`tid`=`racers`.`tid`
LEFT JOIN `employer` AS e ON `e`.`eid`=`t`.`eid` WHERE `racers`.`is_paid` = 'Y' AND t.race_type = 'W'";
$records = $this->db->query($query);
$data = $records->result();
$pdata['data'] = $data;
$pdata['heading'] = "Registered Walkers";
$pdata['LoadViews'] = "reg_runner_walker";
$this->LoadView($pdata);
}
public function contact(){
$pdata = array();
if(IsPostBack){
$name = $this->input->post("name", true);
$from_email = $this->input->post("email", true);
$category = $this->input->post("category", true);
$subject = $this->input->post("subject", true);
$message = $this->input->post("message", true);
$msg = "<div>"."Category:".$category."<br><br>".$message."</div>";
$query = "SELECT * FROM `reg_ctr` WHERE id = '1'" ;
$records = $this->db->query($query);
$data = $records->result();
$to_email = $data[0]->contact_email;
$sub="";
if($this->email_body_contact($to_email="",$name="", $subject="", $msg="",$from_email)){
$this->session->set_flashdata('message', array('url' => 'home/contact','msg' => 'Your message has been sent.Thank you!','msg_type' => 'suc'));
}else{
$this->session->set_flashdata('message', array('url' => 'home','msg' => 'A problem has been occurred while submitting your data. Please try again.','msg_type' => 'err'));
}
redirect("home/only_message");die;
}
$pdata['LoadViews'] = "contact";
$this->LoadView($pdata);
}
public function add_volunteer(){
$first_name = $this->input->post("first_name", true);
$last_name = $this->input->post("last_name", true);
$address = $this->input->post("address", true);
$city = $this->input->post("city", true);
$state = $this->input->post("state", true);
$zip = $this->input->post("zip", true);
$home_phone = $this->input->post("home_phone", true);
$work_phone = $this->input->post("work_phone", true);
$cell_phone = $this->input->post("cell_phone", true);
$email = $this->input->post("email", true);
$employer_name = $this->input->post("employer_name", true);
$race_type_if_participate = $this->input->post("race_type_if_participate", true);
$age_range = $this->input->post("age_range", true);
$from_time = $this->input->post("from_time", true);
$to_time = $this->input->post("to_time", true);
$is_prev_volunteer = $this->input->post("is_prev_volunteer", true);
$emergency_name = $this->input->post("emergency_name", true);
$emergency_phone = $this->input->post("emergency_phone", true);
$reference = $this->input->post("reference", true);
$comments = $this->input->post("comments", true);
$this->load->model("database/Mvolunteers");
$this->Mvolunteers->first_name($first_name);
$this->Mvolunteers->last_name($last_name);
$this->Mvolunteers->address($address);
$this->Mvolunteers->city($city);
$this->Mvolunteers->state($state);
$this->Mvolunteers->zip($zip);
$this->Mvolunteers->first_name($first_name);
$this->Mvolunteers->home_phone($home_phone);
$this->Mvolunteers->work_phone($work_phone);
$this->Mvolunteers->cell_phone($cell_phone);
$this->Mvolunteers->email($email);
$this->Mvolunteers->employer_name($employer_name);
$this->Mvolunteers->race_type_if_participate($race_type_if_participate);
$this->Mvolunteers->age_range($age_range);
$this->Mvolunteers->from_time($from_time);
$this->Mvolunteers->to_time($to_time);
$this->Mvolunteers->is_prev_volunteer($is_prev_volunteer);
$this->Mvolunteers->emergency_name($emergency_name);
$this->Mvolunteers->emergency_phone($emergency_phone);
$this->Mvolunteers->reference($reference);
$this->Mvolunteers->comments($comments);
$this->Mvolunteers->ip($_SERVER['REMOTE_ADDR']);
if($this->Mvolunteers->Save()){
$this->email_body_volunteer($email,$first_name,$last_name);
$this->session->set_flashdata('message', array('url' => 'home/volunteer','msg' => 'Thank you for your interest. The Race Volunteer Coordinator will get in touch with you soon ','msg_type' => 'suc'));
}else{
$this->session->set_flashdata('message', array('url' => 'home/volunteer','msg' => 'A problem has been occurred while submitting your data. Please try again.','msg_type' => 'err'));
}
redirect("home/only_message");die;
}
public function multiple_team_reg(){
$uriData = $this->GetUriArray();
$tabArr = array('1','2','3','4');
$tab_id = '1';
if(isset($uriData['tab'])){
if(in_array($uriData['tab'], $tabArr)){
$tab_id = $uriData['tab'];
}
}
$pdata = array();
$pdata['tab_id'] = $tab_id;
$pdata['LoadViews'] = "multiple_team_reg";
$this->LoadView($pdata);
}
public function org_login(){
$this->load->model("database/Morganizers");
$pdata = array();
$pdata['info'] = 'N';
$errMsg = "";
$uriData = $this->GetUriArray();
if(isset($uriData['suc']) && $uriData['suc'] == "ok"){
$pdata['info'] = 'Y';
}
if(IsPostBack){
$email = trim($_POST['organizer_email']);
$password = trim($_POST['password']);
if ($this->Morganizers->authenticate($email, $password)) {
redirect("home/multiple_team_home");
} else {
$errMsg = "User Email and Password combination is incorrect.";
}
}
$pdata['errMsg'] = $errMsg;
$pdata['LoadViews'] = "org_login";
$this->LoadView($pdata);
}
public function contact_us(){
redirect("home/contact");die;
}
public function change_race_type(){
if(!$this->CheckSession()) {
redirect("home");die;
}
$race_type = $_REQUEST["race_type"];
$tid = $this->session->GetSingleData()->tid;
$this->load->model("database/Mteams");
$this->Mteams->tid($tid);
$this->Mteams->race_type($race_type);
if($this->Mteams->Update()){
redirect("home/single_team_home");die;
}
redirect("home/single_team_home");die;
}
public function only_message(){
$data = $this->session->flashdata('message');
$pdata = array();
$pdata['msg_type'] = $data['msg_type'];
$pdata['msg'] = $data['msg'];
$pdata['redirectUrl'] = site_url($data['url']);
$pdata['title'] = "Error message";
$pdata['sub_title'] = "";
$pdata['LoadViews'] = "only_message";
$this->GetDefaultConfiguration($pdata);
$this->LoadPanel($pdata);
}
public function payment_message(){
$data = $this->session->flashdata('message');
$pdata = array();
$pdata['msg_type'] = $data['msg_type'];
$pdata['msg'] = $data['msg'];
$pdata['redirectUrl'] = site_url($data['url']);
$pdata['title'] = "Error message";
$pdata['sub_title'] = "";
$pdata['LoadViews'] = "payment_message";
$this->GetDefaultConfiguration($pdata);
$this->LoadPanel($pdata);
}
public function add_edit_member(){
$waiver_code = $this->generateRandomString(16);
$team_code = "";
$utype = $this->session->GetCurrentUserType();//SG for single MP for Multiple
$this->load->model("database/Mracers");
if($utype == 'SG'){
$tid = $this->session->GetSingleData()->tid;
}else{
$tid = $this->input->post("team_id", true);
}
$this->load->model("database/Mteams");
$this->Mteams->tid($tid);
if($this->Mteams->Select()){
$team_code = $this->Mteams->code;
}
$first_name = $this->input->post("first_name", true);
$last_name = $this->input->post("last_name", true);
$email = $this->input->post("email", true);
$sex = $this->input->post("sex", true);
$age = $this->input->post("age", true);
$phone = $this->input->post("phone", true);
$town = $this->input->post("town", true);
$isEdit = $this->input->post("isEdit", true);
$racer_id = $this->input->post("racer_id", true);
$member_id = $this->input->post("member_id", true);
if($isEdit == "Y"){
$this->Mracers->rid($racer_id);
$this->Mracers->first_name($first_name);
$this->Mracers->last_name($last_name);
$this->Mracers->email($email);
$this->Mracers->sex($sex);
$this->Mracers->age($age);
$this->Mracers->phone($phone);
$this->Mracers->town($town);
if($this->Mracers->Update(true)){
if($utype == 'SG'){
redirect("home/single_team_home");die;
}else{
redirect("home/multiple_team_home/tab/3");die;
}
}else{
if($utype == 'SG'){
$this->session->set_flashdata('message', array('url' => 'home/single_team_home','msg' => 'No change has found to update.','msg_type' => 'info'));
}else{
$this->session->set_flashdata('message', array('url' => 'home/multiple_team_home/tab/3','msg' => 'No change has found to update.','msg_type' => 'info'));
}
redirect("home/only_message");die;
}
}
if($isEdit == "N"){
$this->Mracers = new Mracers();
$this->Mracers->tid($tid);
$this->Mracers->member_id($member_id);
$this->Mracers->waiver_code($waiver_code);
$this->Mracers->first_name($first_name);
$this->Mracers->last_name($last_name);
$this->Mracers->email($email);
$this->Mracers->sex($sex);
$this->Mracers->age($age);
$this->Mracers->phone($phone);
$this->Mracers->town($town);
if($this->Mracers->Save()){
$this->email_body_waiver($email,$first_name,$last_name,$team_code,$waiver_code);
if($utype == 'SG'){
$this->session->set_flashdata('message', array('url' => "home/single_team_home/suc/ok",'msg' => 'You heve successfully created the Team Member. Just check your mailbox! You are now automatically redirected to Team Home page.','msg_type' => 'suc'));
}else{
$this->session->set_flashdata('message', array('url' => "home/multiple_team_home/tab/3/suc/ok",'msg' => 'You heve successfully created the Team Member. Just check your mailbox! You are now automatically redirected to Team Home page.','msg_type' => 'suc'));
}
redirect("home/only_message");die;
}else{
if($utype == 'SG'){
$this->session->set_flashdata('message', array('url' => 'home/single_team_home','msg' => 'A problem has been occurred while submitting your data. Please try again.','msg_type' => 'err'));
}else{
$this->session->set_flashdata('message', array('url' => 'home/multiple_team_home/tab/3','msg' => 'A problem has been occurred while submitting your data. Please try again.','msg_type' => 'err'));
}
redirect("home/only_message");die;
}
}
}
public function delete_member() {
//$this->CheckSession(true);
$rid = $_REQUEST["rid"];
$query1 = "DELETE FROM racers WHERE rid = $rid AND is_paid = 'N' LIMIT 1";
$records1 = $this->db->query($query1);
echo json_encode("s");
}
public function payment(){
//$this->CheckSession(true);
//GPrint($_POST['paymember']);die;
$pdata = array();
if(IsPostBack){
$racerArr = $_POST['paymember'];
}else{
redirect("home");die;
}
$currrent_amount = 25;
/*
$date_after = "2018-01-07 00:00:00";
$query = "SELECT * FROM `reg_ctr` WHERE id = '1'" ;
$records = $this->db->query($query);
$data = $records->result();
$date_after = $data[0]->date_after;
$new_amount = $data[0]->amount;
$current_datetime = date('Y-m-d H:i:s');
if($current_datetime > $date_after){
$currrent_amount = $new_amount;
}else{
//echo "Current datetime is LESS than date after!!<br>";
}
//GPrint($currrent_amount);die;
*/
$number_racer = count($racerArr);
$currrent_amount = $this->getCurrentAmount();
$total_amount = $number_racer * $currrent_amount;
$pdata['racerArr'] = $racerArr;
$pdata['number_racer'] = $number_racer;
$pdata['total_amount'] = $total_amount;
$pdata['LoadViews'] = "payment_form";
$this->LoadView($pdata);
}
public function send_test(){
$this->load->library("phpmailer_library");
$objMail = $this->phpmailer_library->load();
GPrint($objMail);
}
public function email_body_waiver($toemail="",$firstname="",$lastname="",$team_code="",$waiver_code=""){
////localhost/CorporateCup/home/accept_waiver_code/w_code/fgfgfg
//http://localhost/CorporateCup/home/single_team/tab/3
$subject = "ACTION NEEDED: Sign the Waiver & Release of Liability - VT Corp Cup Challenge & State Agency Race";
$messages="
<div style='width:100%;'>
<br><br>
<div style='width:700px;margin:0 auto;background-color:#f8f8f8'>
<div style='width:640px;background-color:#262626;height:110px;margin:0 auto;'>
<img src='http://vcccsar.org/assets_new/logo.png' />
</div>
<br>
<div style='width:640px;background-color:#f8f8f8;border-bottom:1px solid #b6b6b6;margin:0 auto;'>
<p style='font-size:14px;color:#000'>
Dear ".$firstname." ".$lastname."<br><br>Thank you for participating
in the 34th Annual Vermont Corporate Cup Challenge and State Agency Race
on Thursday, May 11th. You are receiving this e-mail
because you are the Team Captain.<br><br>Team Code:<b style='color:red;'> ".$team_code." </b><br><br>
The following link will allow you to edit/update your team registration:<br><br>
<a href='www.vcccsar.org/home/release_of_liability/w_code/".$waiver_code."'>
www.vcccsar.org/home/release_of_liability/w_code/".$waiver_code."
</a>
</p>
<br>
<p>
If the link above did not work, please visit http://www.vcccsar.org/home/single_team/tab/3 ,
click the Waiver, and copy & paste the following code:<b style='color:red;'> ".$waiver_code." </b>
</p>
<br>
<p>Please save this e-mail for future reference.</p><br>
<p>Thank you,<br>Corporate Cup Staff</p>
</div>
<div style='width:640px;margin:0 auto;'>
<br>
<b>THIS IS AN AUTOMATED RESPONSE.</b><br>
<b style='color:red;'>***DO NOT RESPOND TO THIS EMAIL****</b><br>
<p>
<b>Please note:</b> This e-mail message was sent from a notification-only address that cannot
accept incoming e-mail. Please do not reply to this message.
</p>
</div>
</div>
</div>
";
if($this->send_mail($toemail,$messages,$subject)){
return true;
}else{
redirect("home");die;
}
}
public function email_body_contact($toemail="",$name="", $sub="", $msg="", $form){
return true;
$this->load->model("gsystem/GSEmail");
$subject = $sub;
$messages="
<div style='width:100%;'>
<br><br>
<div style='width:700px;margin:0 auto;background-color:#f8f8f8'>
<div style='width:640px;background-color:#262626;height:110px;margin:0 auto;'>
<img src='http://vcccsar.org/assets_new/logo.png' />
</div>
<br>
<div style='width:640px;background-color:#f8f8f8;border-bottom:1px solid #b6b6b6;margin:0 auto;'>
<p style='font-size:14px;color:#000'>
Dear Admin, <br><br>$msg
</p>
<br>
<br>
<p>Regards,<br>$name Davis</p>
</div>
</div>
</div>
";
$config['protocol'] = 'sendmail';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from($form, $name);
$this->email->to($toemail);
$this->email->subject('VT Corporate Cup PM App');
$this->email->message($messages);
$mailStatus = $this->email->send();
if ($mailStatus) {
return true;
} else {
return false;
}
}
public function email_body_volunteer($toemail="",$firstname="",$lastname=""){
$subject = "New Volunteer Sign up";
$messages="
<div style='width:100%;'>
<br><br>
<div style='width:700px;margin:0 auto;background-color:#f8f8f8'>
<div style='width:640px;background-color:#262626;height:110px;margin:0 auto;'>
<img src='http://vcccsar.org/assets_new/logo.png' />
</div>
<br>
<div style='width:640px;background-color:#f8f8f8;border-bottom:1px solid #b6b6b6;margin:0 auto;'>
<p style='font-size:14px;color:#000'>
Dear ".$firstname." ".$lastname."<br><br>On behalf of the Vermont Corporate Cup Challenge and State Agency Race
committee and the Vermont Governor's Council on Physical Fitness and Sports, we would like to personally thank you
for your interest in assisting us. This event could not continue to have the success it has had without the help
from the many wonderful volunteers who donate their time.
<br><br>Our volunteer coordinator will contact you soon. Thank you again for your interest.
</p>
<br>
<br>
<p>Race Director,<br>Leslie Davis</p>
</div>
<div style='width:640px;margin:0 auto;'>
<br>
<b>THIS IS AN AUTOMATED RESPONSE.</b><br>
<b style='color:red;'>***DO NOT RESPOND TO THIS EMAIL****</b><br>
<p>
<b>Please note:</b> This e-mail message was sent from a notification-only address that cannot
accept incoming e-mail. Please do not reply to this message.
</p>
</div>
</div>
</div>
";
if($this->send_mail($toemail,$messages,$subject)){
return true;
}else{
redirect("home");die;
}
}
public function email_body_payment($pData=array() , $mainData=array() , $toemail, $billing_info=array()){
$subject = "VT Corp Cup Challenge & State Agency Race Confirmation Receipt";
$messages="
<div style='width:100%;'>
<br><br>
<div style='width:700px;margin:0 auto;background-color:#f8f8f8; color:#888'>
<div style='width:640px;background-color:#262626;height:110px;margin:0 auto;'>
<img src='http://vcccsar.org/assets_new/logo.png' />
</div>
<br>
<div style='width:640px;background-color:#f8f8f8;border-bottom:1px solid #b6b6b6;margin:0 auto;'>
<h3>Thank You from the VCCCSAR Team!</h3>
<hr>
<b>Registration Confirmation</b><br>
<p>
Thank you for registering for the 35th annual Vermont Corporate Cup Challenge and State Agency Race
to be held on to be held on Thursday, May 11th. Below is your race confirmation information. Please print this page for your records.
</p>
<hr>
<p>
<b>Company Info.</b>
<br>".$pData['employerInfo']['employer_name']."
<br>".$pData['employerInfo']['employer_type']."
<br>".$pData['employerInfo']['employer_address']."
<br>".$pData['employerInfo']['employer_city'].", ".$pData['employerInfo']['employer_state']." ".$pData['employerInfo']['employer_zip']."
</p>
<hr>";
foreach ($mainData as $md){
$messages.="<p>
<b>Team Info.</b>
<br>Team name: ".$md['team_name']."
<br>Team code: ".$md['code']."
<br>Your team will be: ".$md['race_type'] ."
</p>
<table bordercolor='#ddd' style='color:#888; width: 100%;' border='1' cellpadding='10'><tbody><tr>";
foreach ($md['member_info'] as $mi){
$messages.="<td width='33%'>
<b>".$mi['member_id']."</b>
<br>".$mi['first_name']." ".$mi['last_name']."
<br>Email: ".$mi['email']."
<br>Phone: ".$mi['phone']."
<br>Status: <b>".$mi['is_paid']."</b>
</td>";
}
$messages.="</tr></tbody></table>";
}
$messages.="<p>
<b>Billing Info:</b>
<br>Paid Amount: $". $billing_info['amount']." (No Refunds)
<br>Confirmation Number: ".$billing_info['payment_txn']."
<br>Name on Card: ".$billing_info['name']."
<br> Card Type: ".$billing_info['type']."
<br>".$billing_info['address']."
<br>".$billing_info['city']. $billing_info['state']. $billing_info['zip']."
<br>Your credit card statement will show a charge from <b>'VT CORP CUP'</b> for this payment.
</p>
<hr>
<p>
<b>Need Help? </b>
<br>If you need to change your team information, please login to:
<a href='https://www.vcccsar.org/registration'> https://www.vcccsar.org/registration</a> to make these modifications.
<br>If you have additional questions or comments, you can contact us at: <a href='mailto:info@vcccsar.org'>info@vcccsar.org</a>.
<br>We look forward to seeing you on race day!
</p>
<h3>The VCCCSAR Team</h3>
</div>
<div style='width:640px;margin:0 auto;'>
<br>
<b>THIS IS AN AUTOMATED RESPONSE.</b><br>
<b style='color:red;'>***DO NOT RESPOND TO THIS EMAIL****</b><br>
<p>
<b>Please note:</b> This e-mail message was sent from a notification-only address that cannot
accept incoming e-mail. Please do not reply to this message.
</p>
</div>
</div>
</div>
";
//echo $messages;die;
if($this->send_mail($toemail,$messages,$subject)){
return true;
}else{
//redirect("home");die;
}
return true;
}
public function email_body_payment_bk($pData=array() , $mainData=array()){
////localhost/CorporateCup/home/accept_waiver_code/w_code/fgfgfg
//http://localhost/CorporateCup/home/single_team/tab/3
GPrint($pData);
GPrint($mainData);
die;
$subject = "VT Corp Cup Challenge & State Agency Race Confirmation Receipt";
$messages="
<div style='width:100%;'>
<br><br>
<div style='width:700px;margin:0 auto;background-color:#f8f8f8; color:#888'>
<div style='width:640px;background-color:#262626;height:110px;margin:0 auto;'>
<img src='http://vcccsar.org/assets_new/logo.png' />
</div>
<br>
<div style='width:640px;background-color:#f8f8f8;border-bottom:1px solid #b6b6b6;margin:0 auto;'>
<h3>Thank You from the VCCCSAR Team!</h3>
<hr>
<b>Registration Confirmation</b><br>
<p>
Thank you for registering for the 35th annual Vermont Corporate Cup Challenge and State Agency Race
to be held on to be held on Thursday, May 11th. Below is your race confirmation information. Please print this page for your records.
</p>
<hr>
<p>
<b>Company Info.</b>
<br>".$pData['employerInfo']['employer_name']."
<br>".$pData['employerInfo']['employer_type']."
<br>".$pData['employerInfo']['employer_address']."
<br>".$pData['employerInfo']['employer_city'].", ".$pData['employerInfo']['employer_state']." ".$pData['employerInfo']['employer_zip']."
</p>
<hr>
<p>
<b>Team Info.</b>
<br>Team name: ".$pData['teamInfo']['team_name']."
<br>Your team will be: ".$pData['teamInfo']['team_type']."
</p>
<table bordercolor='#ddd' style='color:#888;' border='1' cellpadding='10'>
<tbody>
<tr>
<td width='33%'>
<b>Team Captain Info:</b>
<br>".$pData['memberInfo'][1]['first_name']." ".$pData['memberInfo'][1]['last_name']."
<br>Email: ".$pData['memberInfo'][1]['email']."
<br>Phone: ".$pData['memberInfo'][1]['phone']."
<br>Status: <b>".$pData['memberInfo'][1]['is_paid']."</b>
</td>
<td width='33%'>
<b>Member 2 Info:</b>
<br>".$pData['memberInfo'][2]['first_name']." ".$pData['memberInfo'][2]['last_name']."
<br>Email: ".$pData['memberInfo'][2]['email']."
<br>Phone: ".$pData['memberInfo'][2]['phone']."
<br>Status: <b>".$pData['memberInfo'][2]['is_paid']."</b>
</td>
<td width='33%'>
<b>Member 3 Info:</b>
<br>".$pData['memberInfo'][3]['first_name']." ".$pData['memberInfo'][3]['last_name']."
<br>Email: ".$pData['memberInfo'][3]['email']."
<br>Phone: ".$pData['memberInfo'][3]['phone']."
<br>Status: <b>".$pData['memberInfo'][3]['is_paid']."</b>
</td>
</tr>
</tbody>
</table>
<p>
<b>Billing Info:</b>
<br>Paid Amount: $'.'&amount'. (No Refunds)
<br>Confirmation Number: @transactionID
<br>Name on Card: urldecode(@firstName) urldecode(@lastName)
<br> Card Type: urldecode(@creditCardType)
<br>urldecode(@address)
<br>urldecode(@city), 2state 2zip
<br>Your credit card statement will show a charge from <b>'VT CORP CUP'</b> for this payment.
</p>
<hr>
<p>
<b>Need Help? </b>
<br>If you need to change your team information, please login to:
<a href='https://www.vcccsar.org/registration'> https://www.vcccsar.org/registration</a> to make these modifications.
<br>If you have additional questions or comments, you can contact us at: <a href='mailto:info@vcccsar.org'>info@vcccsar.org</a>.
<br>We look forward to seeing you on race day!
</p>
<h3>The VCCCSAR Team</h3>
</div>
<div style='width:640px;margin:0 auto;'>
<br>
<b>THIS IS AN AUTOMATED RESPONSE.</b><br>
<b style='color:red;'>***DO NOT RESPOND TO THIS EMAIL****</b><br>
<p>
<b>Please note:</b> This e-mail message was sent from a notification-only address that cannot
accept incoming e-mail. Please do not reply to this message.
</p>
</div>
</div>
</div>
";
echo $messages;
die;
if($this->send_mail($toemail,$messages,$subject)){
return true;
}else{
redirect("home");die;
}
}
public function email_body_team_creation($toemail="",$firstname="",$lastname="",$code=""){
$subject = "Vermont Corporate Cup Registration Confirmation";
$messages="
<div style='width:100%;'>
<br><br>
<div style='width:700px;margin:0 auto;background-color:#f8f8f8'>
<div style='width:640px;background-color:#262626;height:110px;margin:0 auto;'>
<img src='http://vcccsar.org/assets_new/logo.png' />
</div>
<br>
<div style='width:640px;background-color:#f8f8f8;border-bottom:1px solid #b6b6b6;margin:0 auto;'>
<p style='font-size:14px;color:#000'>
Dear ".$firstname." ".$lastname."<br><br>Thank you for participating
in the 34th Annual Vermont Corporate Cup Challenge and State Agency Race
on Thursday, May 11th. You are receiving this e-mail
because you are the Team Captain.<br><br>Team Code: <b style='color:red;'>".$code."</b>
<br><br>
The following link will allow you to edit/update your team registration:
<br><br>
<a href='www.vcccsar.org/home/single_team/tab/2'>
www.vcccsar.org/home/single_team/tab/2
</a>
</p>
<p>Please save this e-mail for future reference.</p>
<br>
<p>Thank you,<br>Corporate Cup Staff</p>
<br>
</div>
<div style='width:640px;margin:0 auto;'>
<br>
<b>THIS IS AN AUTOMATED RESPONSE.</b><br>
<b style='color:red;'>***DO NOT RESPOND TO THIS EMAIL****</b><br>
<p>
<b>Please Note:</b> This e-mail message was sent from a notification-only address that cannot
accept incoming e-mail. Please do not reply to this message.
</p>
</div>
</div>
</div>
";
if($this->send_mail($toemail,$messages,$subject)){
return true;
}else{
redirect("home");die;
}
}
public function email_body_organizer_creation($organizer_email="",$organizer_name=""){
//$organizer_email = "walid.islam77@gmail.com";
$this->load->library("GSEncryption");
$obj=new stdClass();
$obj->time=strtotime("+15 MINUTES");
$obj->email_id=$organizer_email;
$str=json_encode($obj);
$encrypt_email = GSEncryption::GSGlobalEncrypt($str);
$subject = "Organizer Account Registration";
$messages="
<div style='width:100%;'>
<br><br>
<div style='width:700px;margin:0 auto;background-color:#f8f8f8'>
<div style='width:640px;background-color:#262626;height:110px;margin:0 auto;'>
<img src='http://vcccsar.org/assets_new/logo.png' />
</div>
<br>
<div style='width:640px;background-color:#f8f8f8;border-bottom:1px solid #b6b6b6;margin:0 auto;'>
<p style='font-size:14px;color:#000'>
Dear ".$organizer_name."<br><br>
Thank you for registering as an Organizer for the Vermont Corporate Cup Challenge and State Agency Race.
<br><br>
The following link will allow you to activate your account:
<br><br>
<a href='www.vcccsar.org/home/org_activate/activate/$encrypt_email'>
www.vcccsar.org/home/org_activate/activate/$encrypt_email
</a>
</p>
<p>Please save this e-mail for future reference.</p>
<br>
<p>Thank you,<br>Corporate Cup Staff</p>
<br>
</div>
<div style='width:640px;margin:0 auto;'>
<br>
<b>THIS IS AN AUTOMATED RESPONSE.</b><br>
<b style='color:red;'>***DO NOT RESPOND TO THIS EMAIL****</b><br>
<p>
<b>Please Note:</b> This e-mail message was sent from a notification-only address that cannot
accept incoming e-mail. Please do not reply to this message.
</p>
</div>
</div>
</div>
";
if($this->send_mail($organizer_email,$messages,$subject)){
return true;
}else{
redirect("home");die;
}
}
function send_mail($toemail="",$messages="",$subject=""){
return true;
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '30';
$config['smtp_user'] = 'registration@vcccsar.org';
$config['smtp_pass'] = '8pcp5PVpuCc7bnFga';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$email_counter = 1;
$query = "SELECT * FROM `reg_ctr` WHERE id = '1'" ;
$records = $this->db->query($query);
$data = $records->result();
$email_counter = $data[0]->email_counter;
if($email_counter == 1){
$config['smtp_user'] = "registration@vcccsar.org";
$config['smtp_pass'] = "8pcp5PVpuCc7bnFga";
$from = "registration@vcccsar.org";
$uquery = "UPDATE reg_ctr set email_counter = 2 WHERE ID = 1;" ;
$result = $this->db->query($uquery);
}
if($email_counter == 2){
$config['smtp_user'] = "registrations-noreply@vcccsar.org";
$config['smtp_pass'] = "8;{y^y2W45r*q9{}1";
$from = "registrations-noreply@vcccsar.org";
$uquery = "UPDATE reg_ctr set email_counter = 3 WHERE ID = 1;" ;
$result = $this->db->query($uquery);
}
if($email_counter == 3){
$config['smtp_user'] = "registrations-noreply-1@vcccsar.org";
$config['smtp_pass'] = "8;{y^y2W45r*q9{}1";
$from = "registrations-noreply-1@vcccsar.org";
$uquery = "UPDATE reg_ctr set email_counter = 1 WHERE ID = 1;" ;
$result = $this->db->query($uquery);
}
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from($from, 'Vermont Corporate Cup Challenge');
$this->email->to($toemail);
$this->email->subject($subject);
$this->email->message($messages);
$this->email->send();
//echo $this->email->print_debugger();
return true;
}
public function getCurrentAmount(){
$date_after = "2017-12-16 00:00:00";
$amount1 = 25;
$new_amount = "";
$query = "SELECT * FROM `reg_ctr` WHERE id = '1'" ;
$records = $this->db->query($query);
$reg_data = $records->result();
if(!empty($reg_data)){
$new_amount = $reg_data[0]->amount;
$date_after = $reg_data[0]->date_after;
}
$current_datetime = date('Y-m-d H:i:s');
if($current_datetime > $date_after){
$amount1 = $new_amount;
}else{
//echo "Current datetime is LESS than date after!!<br>";
}
return $amount1;
}
public function team_claim(){
$uriData = $this->GetUriArray();
$utype = $this->session->GetCurrentUserType();
if($utype == 'MP'){
$multiple_ses_data = $this->session->GetMultipleData();
if(isset($uriData['tid'])){
$tid = $uriData['tid'];
$this->load->model("database/Mteams");
$this->Mteams->tid($tid);
if($this->Mteams->Select()){
$eid = $this->Mteams->eid;
}else{
redirect('home');
}
$session_eid = $this->session->GetMultipleData()->eid;
if($session_eid == $eid){
$this->Mteams = new Mteams();
$this->Mteams->tid($tid);
$this->Mteams->organizer_id($multiple_ses_data->organizer_id);
$this->Mteams->is_claim('Y');
$this->Mteams->Update();
redirect('home/multiple_team_home/tab/2');
}else{
redirect('home');
}
}else{
redirect('home');
}
}else{
redirect('home');
}
}
public function registration_info(){
$pdata = array();
$pdata['LoadViews'] = "registration_info";
$this->LoadView($pdata);
}
public function race_rules_info(){
$pdata = array();
$pdata['LoadViews'] = "race_rules_info";
$this->LoadView($pdata);
}
public function privacy_policy(){
$pdata = array();
$pdata['LoadViews'] = "privacy_policy";
$this->LoadView($pdata);
}
public function terms_service(){
$pdata = array();
$pdata['LoadViews'] = "terms_service";
$this->LoadView($pdata);
}
public function race_day_logistics(){
$pdata = array();
$pdata['LoadViews'] = "race_day_logistics";
$this->LoadView($pdata);
}
public function race_walking(){
$pdata = array();
$pdata['LoadViews'] = "race_walking";
$this->LoadView($pdata);
}
public function course_map(){
$pdata = array();
$pdata['LoadViews'] = "course_map";
$this->LoadView($pdata);
}
public function race_committee(){
$pdata = array();
$pdata['LoadViews'] = "race_committee";
$this->LoadView($pdata);
}
public function multiple_team_home(){
$uriData = $this->GetUriArray();
$tabArr = array('1','2','3','4');
$tab_id = '1';
$pdata = array();
$combo_data = array();
$pdata['info'] = 'N';
if(isset($uriData['suc']) && $uriData['suc'] == "ok"){
$pdata['info'] = 'Y';
}
if(isset($uriData['tab'])){
if(in_array($uriData['tab'], $tabArr)){
$tab_id = $uriData['tab'];
}
}
$amount1 = $this->getCurrentAmount();
$pdata['amount'] = $amount1;
$captain = new stdClass();
$runner_two = new stdClass();
$runner_three = new stdClass();
$captain->found = "N";
$captain->rid = "";
$captain->first_name = "--";
$captain->last_name = "--";
$captain->age = "--";
$captain->sex = "--";
$captain->is_accepted = "";
$captain->is_paid = "";
$runner_two->found = "N";
$runner_two->rid = "";
$runner_two->first_name = "--";
$runner_two->last_name = "--";
$runner_two->age = "--";
$runner_two->sex = "--";
$runner_two->is_accepted = "";
$runner_two->is_paid = "";
$runner_three->found = "N";
$runner_three->rid = "";
$runner_three->first_name = "--";
$runner_three->last_name = "--";
$runner_three->age = "--";
$runner_three->sex = "--";
$runner_three->is_accepted = "";
$runner_three->is_paid = "";
$multiple_ses_data = $this->session->GetMultipleData();
$organizer_id = $multiple_ses_data->organizer_id;
$this->load->model("database/Memployer");
$this->Memployer->eid($multiple_ses_data->eid);
if($this->Memployer->Select()){
$pdata['empObj'] = $this->Memployer;//unused
}else{
redirect("home");
}
//Invalid code or team is not associate to your employer. You will be automatically redirected to Team's page.
//Data process for VIEW/EDIT or Pay for teams
$this->load->model("database/Mteams");
$this->load->model("database/Mracers");
$this->Mteams->organizer_id($organizer_id);
$teams_data = $this->Mteams->SelectAll();
$this->Mteams = new Mteams();
$this->Mteams->eid($multiple_ses_data->eid);
$this->Mteams->is_claim('N');
$this->Mteams->organizer_id();
$this->Mteams->organizer_id('organizer_id IS NULL',false);
$claimed_teams_data = $this->Mteams->SelectAll();
$pdata['claimed_teams_data'] = $claimed_teams_data;
//echo GSModel::GetTotalQueries();
//GPrint($teams_data);die;
if (is_array($teams_data) || is_object($teams_data)){
foreach ($teams_data as $team){
$this->Mracers->tid($team->tid);
$racer_data = $this->Mracers->SelectAll();
$num_racer = count($racer_data);
$num_paid = 0;
if (is_array($racer_data) || is_object($racer_data)){
foreach ($racer_data as $rd){
if($num_racer > 0){
if($rd->is_paid == 'Y'){
$num_paid++;
}
}
if($rd->member_id == 1){
$captain->found = "Y";
$captain->rid = $rd->rid;
$captain->first_name = $rd->first_name;
$captain->last_name = $rd->last_name;
$captain->age = $rd->age;
$captain->sex = $rd->sex;
$captain->is_accepted = $rd->is_accepted;
$captain->is_paid = $rd->is_paid;
}elseif($rd->member_id == 2){
$runner_two->found = "Y";
$runner_two->rid = $rd->rid;
$runner_two->first_name = $rd->first_name;
$runner_two->last_name = $rd->last_name;
$runner_two->age = $rd->age;
$runner_two->sex = $rd->sex;
$runner_two->is_accepted = $rd->is_accepted;
$runner_two->is_paid = $rd->is_paid;
}elseif($rd->member_id == 3){
$runner_three->found = "Y";
$runner_three->rid = $rd->rid;
$runner_three->first_name = $rd->first_name;
$runner_three->last_name = $rd->last_name;
$runner_three->age = $rd->age;
$runner_three->sex = $rd->sex;
$runner_three->is_accepted = $rd->is_accepted;
$runner_three->is_paid = $rd->is_paid;
}
}
}
$combo_data[$team->tid]['team_info'] = $team;
$combo_data[$team->tid]['captain'] = $captain;
$combo_data[$team->tid]['runner_two'] = $runner_two;
$combo_data[$team->tid]['runner_three'] = $runner_three;
$combo_data[$team->tid]['pay_count'] = " ".$num_paid . "/" . $num_racer;
$captain = new stdClass();
$runner_two = new stdClass();
$runner_three = new stdClass();
$captain->found = "N";
$captain->rid = "";
$captain->first_name = "--";
$captain->last_name = "--";
$captain->age = "--";
$captain->sex = "--";
$captain->is_accepted = "";
$captain->is_paid = "";
$runner_two->found = "N";
$runner_two->rid = "";
$runner_two->first_name = "--";
$runner_two->last_name = "--";
$runner_two->age = "--";
$runner_two->sex = "--";
$runner_two->is_accepted = "";
$runner_two->is_paid = "";
$runner_three->found = "N";
$runner_three->rid = "";
$runner_three->first_name = "--";
$runner_three->last_name = "--";
$runner_three->age = "--";
$runner_three->sex = "--";
$runner_three->is_accepted = "";
$runner_three->is_paid = "";
}
}
//GPrint($combo_data);die;
/*
foreach ($combo_data as $combo){
$num_racer = count($combo['racer_info']);
$num_paid = 0;
if($num_racer > 0){
foreach ($combo['racer_info'] as $p){
if($p->is_paid == 'Y'){
$num_paid++;
}
}
}
//echo $combo['team_info']->team_name . " || Code:" . $combo['team_info']->code;
// echo " #Racer: " .$num_racer . " #paid: " . $num_paid . "<br>";
if (is_array($combo['racer_info']) || is_object($combo['racer_info'])){
foreach ($combo['racer_info'] as $rcr){
//echo $rcr->first_name . " || Waiver Code:" . $rcr->waiver_code . "<br>";
}
}
//echo "<br>";
}
//die;
//GPrint($combo_data);die;
*/
$pdata['combo_data'] = $combo_data;
$pdata['organizer_id'] = $organizer_id;
$pdata['tab_id'] = $tab_id;
$this->Mracers = new Mracers();
$pdata['racerObj'] = $this->Mracers;
$pdata['LoadViews'] = "multiple_team_home";
$this->LoadView($pdata);
}
public function single_team_home(){
if(!$this->CheckSession()) {
redirect("home");die;
}
$pdata = array();
$pdata['info'] = 'N';
$uriData = $this->GetUriArray();
if(isset($uriData['suc']) && $uriData['suc'] == "ok"){
$pdata['info'] = 'Y';
}
$amount1 = $this->getCurrentAmount();
$pdata['amount'] = $amount1;
$captain = new stdClass();
$runner_two = new stdClass();
$runner_three = new stdClass();
$captain->found = "N";
$captain->rid = "";
$captain->first_name = "--";
$captain->last_name = "--";
$captain->age = "--";
$captain->sex = "--";
$captain->is_accepted = "";
$captain->is_paid = "";
$runner_two->found = "N";
$runner_two->rid = "";
$runner_two->first_name = "--";
$runner_two->last_name = "--";
$runner_two->age = "--";
$runner_two->sex = "--";
$runner_two->is_accepted = "";
$runner_two->is_paid = "";
$runner_three->found = "N";
$runner_three->rid = "";
$runner_three->first_name = "--";
$runner_three->last_name = "--";
$runner_three->age = "--";
$runner_three->sex = "--";
$runner_three->is_accepted = "";
$runner_three->is_paid = "";
$tid = $this->session->GetSingleData()->tid;
$this->load->model("database/Mteams");
$this->load->model("database/Mracers");
$this->Mteams->tid($tid);
if($this->Mteams->Select()){
$pdata['team_name'] = $this->Mteams->team_name;
$pdata['race_type'] = $this->Mteams->race_type;
$pdata['code'] = $this->Mteams->code;
}else{
redirect("home");die;
}
$this->Mracers->tid($this->Mteams->tid);
$racer_data = $this->Mracers->SelectAll();
//GPrint($racer_data);
if (is_array($racer_data) || is_object($racer_data)){
foreach ($racer_data as $rd){
if($rd->member_id == 1){
$captain->found = "Y";
$captain->rid = $rd->rid;
$captain->first_name = $rd->first_name;
$captain->last_name = $rd->last_name;
$captain->age = $rd->age;
$captain->sex = $rd->sex;
$captain->is_accepted = $rd->is_accepted;
$captain->is_paid = $rd->is_paid;
}elseif($rd->member_id == 2){
$runner_two->found = "Y";
$runner_two->rid = $rd->rid;
$runner_two->first_name = $rd->first_name;
$runner_two->last_name = $rd->last_name;
$runner_two->age = $rd->age;
$runner_two->sex = $rd->sex;
$runner_two->is_accepted = $rd->is_accepted;
$runner_two->is_paid = $rd->is_paid;
}elseif($rd->member_id == 3){
$runner_three->found = "Y";
$runner_three->rid = $rd->rid;
$runner_three->first_name = $rd->first_name;
$runner_three->last_name = $rd->last_name;
$runner_three->age = $rd->age;
$runner_three->sex = $rd->sex;
$runner_three->is_accepted = $rd->is_accepted;
$runner_three->is_paid = $rd->is_paid;
}
}
}
//GPrint($runner_three);GPrint($runner_two);GPrint($captain);
$pdata['captain'] = $captain;
$pdata['runner_two'] = $runner_two;
$pdata['runner_three'] = $runner_three;
$this->Mracers = new Mracers();
$pdata['racerObj'] = $this->Mracers;
$pdata['LoadViews'] = "single_team_home";
$this->LoadView($pdata);
}
public function getRacerData() {
//$this->CheckSession(true);
$rid = $_REQUEST["rid"];
$query = "SELECT * FROM racers WHERE rid = $rid";
$records = $this->db->query($query);
echo json_encode($records->result());
}
public function getEmployer_name(){
//$search = "aa";
$search = $_REQUEST["keyword"];
$records = array();
$this->load->model("database/Memployer");
$this->Memployer->employer_name("employer_name LIKE '%$search%'",false);
if(!empty($search)){
$records = $this->Memployer->SelectAll();
//echo GSModel::GetTotalQueries();
//GPrint($records);die;
//<li onclick="onClick=" selectemployer(="" aaabb)="">aaabb</li>
//<li onclick="selectEmployer(aaabb)">aaabb</li>,employer_type,employer_address,employer_city,employer_state,employer_zip
//json_encode()<li class="list-group-item" onclick="selectEmployer(" 'aaee',="" 's',="" 'dgfgf',="" 'gfgf',="" 'vt',="" '55555'="" )="">aaee<i class="fa fa-mouse-pointer pull-right" aria-hidden="true"></i>
if(!empty($records)){
echo "<ul id='country-list' class='list-group'>";
foreach ($records as $empObj){
echo "<li class='list-group-item'
onClick=selectEmployer('$empObj->eid')>"
.$empObj->employer_name.
"<i class='fa fa-mouse-pointer pull-right' aria-hidden='true'></i>
</li>";
/*
echo "<li class='list-group-item'
onClick=selectEmployer('$empObj->employer_name','$empObj->employer_type','$empObj->employer_address','$empObj->employer_city','$empObj->employer_state','$empObj->employer_zip')>"
.$empObj->employer_name.
"<i class='fa fa-mouse-pointer pull-right' aria-hidden='true'></i>
</li>";
*/
}
echo "</ul>";
}
}
}
public function getEmployerDetails() {
$eid = $_REQUEST["eid"];
$query = "SELECT * FROM employer WHERE eid = $eid";
$records = $this->db->query($query);
echo json_encode($records->result());
}
//checkTeamName//checkTeamEmail
public function checkTeamName() {
//$tn = "sarwaru";
$tn = $_REQUEST["tn"];
$query = "SELECT * FROM teams WHERE team_name = '$tn'";
$records = $this->db->query($query);
//echo json_encode($records->result());
if(empty($records->result())){
echo "N";
}else{
echo "Y";
}
}
public function checkTeamEmail() {
//$temail = "walid.islam77@gmail.commm";
$temail = $_REQUEST["temail"];
$query = "SELECT * FROM teams WHERE email = '$temail'";
$records = $this->db->query($query);
//echo json_encode($records->result());
if(empty($records->result())){
echo "N";
}else{
echo "Y";
}
}
public function checkOrgEmail() {
//$temail = "walid.islam77@gmail.commm";
$oemail = $_REQUEST["oemail"];
$query = "SELECT * FROM organizers WHERE organizer_email = '$oemail'";
$records = $this->db->query($query);
//echo json_encode($records->result());
if(empty($records->result())){
echo "N";
}else{
echo "Y";
}
}
public function checkRacerEmail() {
//$remail = "ar@gmail.com";
//$racer_pk = "";
$remail = $_REQUEST["remail"];
$racer_pk = $_REQUEST["racer_pk"];
$query = "SELECT * FROM racers WHERE email = '$remail' AND rid != '$racer_pk'";
$records = $this->db->query($query);
//echo json_encode($records->result());
if(empty($records->result())){
echo "N";
}else{
echo "Y";
}
}
public function last(){
$this->load->model("database/Memployer");
$id = $this->Memployer->LastInsertedId();
echo $this->generateRandomString(16);
}
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
public function add_organizer() {
$this->load->model("database/Memployer");
$this->load->model("database/Morganizers");
if(IsPostBack){
//EMPLOYER INFORMATION
$isNewEmployer = $this->input->post("isNewEmployer", true);
$employer_name = $this->input->post("employer_name", true);
$employer_type = $this->input->post("employer_type", true);
$employer_address = $this->input->post("employer_address", true);
$employer_city = $this->input->post("employer_city", true);
$employer_state = $this->input->post("employer_state", true);
$employer_zip = $this->input->post("employer_zip", true);
//TEAM INFORMATION
$organizer_name = $this->input->post("organizer_name", true);
$organizer_email = $this->input->post("organizer_email", true);
$password = $this->input->post("password", true);
if($isNewEmployer == 'N'){
//Inserting Employer information
$this->Memployer->employer_name($employer_name);
$this->Memployer->employer_type($employer_type);
$this->Memployer->employer_address($employer_address);
$this->Memployer->employer_city($employer_city);
$this->Memployer->employer_state($employer_state);
$this->Memployer->employer_zip($employer_zip);
if($this->Memployer->Save()){
$eid = $this->Memployer->LastInsertedId();
}else{
$this->session->set_flashdata('message', array('url' => 'home/single_team','msg' => 'Oops!! Something went wrong there. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
//Inserting Organizer information
$this->Morganizers->eid($eid);
$this->Morganizers->organizer_name($organizer_name);
$this->Morganizers->organizer_email($organizer_email);
$this->Morganizers->password($password);
if($this->Morganizers->Save()){
redirect("home/org_login/suc/ok");die;
}else{
$this->session->set_flashdata('message', array('url' => 'home/multiple_team_reg','msg' => 'Oops!! Something went wrong there. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
}else{
//Inserting Team information / 2017-12-08 17:08:05/date("Y-m-d H:i:s")2017-12-21 00:00:00
$this->Morganizers->eid($isNewEmployer);
$this->Morganizers->organizer_name($organizer_name);
$this->Morganizers->organizer_email($organizer_email);
$this->Morganizers->password($password);
if($this->Morganizers->Save()){
redirect("home/org_login/suc/ok");die;
}else{
$this->session->set_flashdata('message', array('url' => 'home/multiple_team_reg','msg' => 'Oops!! Something went wrong there. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
}
}
}
public function add_teams() {
$this->load->model("database/Memployer");
$this->load->model("database/Mteams");
$code = $this->generateRandomString(16);
if(IsPostBack){
//EMPLOYER INFORMATION
$isNewEmployer = $this->input->post("isNewEmployer", true);
$employer_name = $this->input->post("employer_name", true);
$employer_type = $this->input->post("employer_type", true);
$employer_address = $this->input->post("employer_address", true);
$employer_city = $this->input->post("employer_city", true);
$employer_state = $this->input->post("employer_state", true);
$employer_zip = $this->input->post("employer_zip", true);
//TEAM INFORMATION
$race_type = $this->input->post("race_type", true);
$team_name = $this->input->post("team_name", true);
$first_name = $this->input->post("first_name", true);
$last_name = $this->input->post("last_name", true);
$email = $this->input->post("email", true);
if($isNewEmployer == 'N'){
//Inserting Employer information
$this->Memployer->employer_name($employer_name);
$this->Memployer->employer_type($employer_type);
$this->Memployer->employer_address($employer_address);
$this->Memployer->employer_city($employer_city);
$this->Memployer->employer_state($employer_state);
$this->Memployer->employer_zip($employer_zip);
if($this->Memployer->Save()){
$eid = $this->Memployer->LastInsertedId();
}else{
$this->session->set_flashdata('message', array('url' => 'home/single_team','msg' => 'Oops!! Something went wrong there. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
//Inserting Team information
$this->Mteams->eid($eid);
$this->Mteams->race_type($race_type);
$this->Mteams->team_name($team_name);
$this->Mteams->first_name($first_name);
$this->Mteams->last_name($last_name);
$this->Mteams->email($email);
$this->Mteams->code($code);
$this->Mteams->creation_date(date("Y-m-d H:i:s"));
if($this->Mteams->Save()){
$this->email_body_team_creation($email,$first_name,$last_name,$code);//single_team_auto_login
$this->session->set_flashdata('message', array('url' => "home/single_team_auto_login/team_code/$code",'msg' => 'You heve successfully created the Team. Just check your Mailbox! You are now automatically redirected to Team Home page.','msg_type' => 'suc'));
redirect("home/only_message");die;
}else{
$this->session->set_flashdata('message', array('url' => 'home/single_team','msg' => 'Oops!! Something went wrong there. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
}else{
//Inserting Team information / 2017-12-08 17:08:05/date("Y-m-d H:i:s")2017-12-21 00:00:00
$this->Mteams->eid($isNewEmployer);
$this->Mteams->race_type($race_type);
$this->Mteams->team_name($team_name);
$this->Mteams->first_name($first_name);
$this->Mteams->last_name($last_name);
$this->Mteams->email($email);
$this->Mteams->code($code);
$this->Mteams->creation_date(date("Y-m-d H:i:s"));
if($this->Mteams->Save()){
$this->email_body_team_creation($email,$first_name,$last_name,$code);//single_team_auto_login
$this->session->set_flashdata('message', array('url' => "home/single_team_auto_login/team_code/$code",'msg' => 'You heve successfully created the Team. Please check your Mailbox. You are now automatically redirected to Team Home page.','msg_type' => 'suc'));
redirect("home/only_message");die;
}else{
$this->session->set_flashdata('message', array('url' => 'home/single_team','msg' => 'Oops!! Something went wrong there. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
}
}
}
public function add_teams_multiple() {
$this->load->model("database/Mteams");
$code = $this->generateRandomString(16);
if(IsPostBack){
$emp_id = $this->input->post("emp_id", true);
$organizer_id = $this->input->post("organizer_id", true);
$race_type = $this->input->post("race_type", true);
$team_name = $this->input->post("team_name", true);
$first_name = $this->input->post("first_name", true);
$last_name = $this->input->post("last_name", true);
$email = $this->input->post("email", true);
$this->Mteams->eid($emp_id);
$this->Mteams->organizer_id($organizer_id);
$this->Mteams->race_type($race_type);
$this->Mteams->team_name($team_name);
$this->Mteams->first_name($first_name);
$this->Mteams->last_name($last_name);
$this->Mteams->email($email);
$this->Mteams->code($code);
$this->Mteams->creation_date(date("Y-m-d H:i:s"));
if($this->Mteams->Save()){
//No need to send email
//$this->email_body_team_creation($email,$first_name,$last_name,$code);
$this->session->set_flashdata('message', array('url' => "home/multiple_team_home",'msg' => 'You heve successfully created the Team. Please check your Mailbox. You are now automatically redirected to Team Home page.','msg_type' => 'suc'));
redirect("home/only_message");die;
}else{
$this->session->set_flashdata('message', array('url' => 'home/multiple_team_home','msg' => 'Oops!! Something went wrong there. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
}
}
public function single_team_login(){
$pdata = array();
$uriData = $this->GetUriArray();
$tab_id = 'e';
if(isset($uriData['type'])){
$tab_id = $uriData['type'];
}
$this->load->model("database/Mteams");
if(IsPostBack){
$team_code = trim($_POST['team_code_edit']);
if ($this->Mteams->authenticate($team_code)) {
redirect("home/single_team_home");
} else {
if($tab_id == 'e'){
$this->session->set_flashdata('message', array('url' => 'home/single_team/tab/2','msg' => 'You have entered wrong team code. Please try again.','msg_type' => 'err'));
}else {
$this->session->set_flashdata('message', array('url' => 'home/single_team/tab/4','msg' => 'You have entered wrong team code. Please try again.','msg_type' => 'err'));
}
redirect("home/only_message");die;
}
}
$pdata['LoadViews'] = "single_team_home";
$this->LoadView($pdata);
}
public function single_team_auto_login(){
$uriData = $this->GetUriArray();
$team_code = '';
//localhost/CorporateCup/home/single_team_auto_login/team_code/8oMUNE3gGfJG01ML
if(isset($uriData['team_code'])){
$team_code = $uriData['team_code'];
}
$this->load->model("database/Mteams");
$team_code = trim($team_code);
if ($this->Mteams->authenticate($team_code)) {
redirect("home/single_team_home");
} else {
//$this->session->set_flashdata('message', array('url' => 'home/single_team/tab/2','msg' => 'You have entered wrong team code. Please try again.','msg_type' => 'err'));
redirect("home/single_team");die;
}
}
public function release_of_liability(){
//http://localhost/CorporateCup/home/release_of_liability/w_code/VGno7SWQs1SOM6N0
$pdata = array();
$uriData = $this->GetUriArray();
$utype = $this->session->GetCurrentUserType();
$w_code = "";
$pdata['first_name'] = "";
$pdata['last_name'] = "";
$pdata['rid'] = "";
$pdata['date_time'] = date("Y-m-d H:i:s");
$pdata['ip_add'] = $_SERVER['REMOTE_ADDR'];
if(IsPostBack){
$w_code = $this->input->post("w_code", true);
}elseif(isset($uriData['w_code'])){
$w_code = $uriData['w_code'];
}else{
redirect("home");die;
}
$this->load->model("database/Mracers");
$this->Mracers->waiver_code($w_code);
if($this->Mracers->Select()){
if($this->Mracers->is_accepted == 'N'){
$pdata['first_name'] = $this->Mracers->first_name;
$pdata['last_name'] = $this->Mracers->last_name;
$pdata['rid'] = $this->Mracers->rid;
} else {
if($utype == 'SG'){
$this->session->set_flashdata('message', array('url' => 'home/single_team_home','msg' => 'You have already signed the waiver.','msg_type' => 'info'));
redirect("home/only_message");die;
}else{
$this->session->set_flashdata('message', array('url' => 'home/single_team/tab/2','msg' => 'You have already signed the waiver.','msg_type' => 'info'));
redirect("home/only_message");die;
}
}
} else {
$this->session->set_flashdata('message', array('url' => 'home/single_team/tab/3','msg' => 'You have entered wrong waiver code. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
$pdata['LoadViews'] = "waiver_form";
$this->LoadView($pdata);
}
public function accept_waiver_code() {
$utype = $this->session->GetCurrentUserType();
$rid = "";
$e_sign = "";
if(IsPostBack){
$rid = $this->input->post("rid", true);
$e_sign = $this->input->post("e_sign", true);
}else{
$this->session->set_flashdata('message', array('url' => 'home/single_team/tab/3','msg' => 'Oops!! Something went wrong there. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
$this->load->model("database/Mracers");
$this->Mracers = new Mracers();
$this->Mracers->rid($rid);
$this->Mracers->e_sign($e_sign);
$this->Mracers->e_sign_ip($_SERVER['REMOTE_ADDR']);
$this->Mracers->e_sign_date(date("Y-m-d H:i:s"));
$this->Mracers->is_accepted('Y');
if($this->Mracers->Update()){
if($utype == 'SG'){
$this->session->set_flashdata('message', array('url' => 'home/single_team_home','msg' => 'You have successfully signed the waiver.','msg_type' => 'suc'));
redirect("home/only_message");die;
}else{
$this->session->set_flashdata('message', array('url' => 'home/single_team/tab/2','msg' => 'You have successfully signed the waiver.','msg_type' => 'suc'));
redirect("home/only_message");die;
}
}else{
$this->session->set_flashdata('message', array('url' => 'home/single_team/tab/3','msg' => 'Oops!! Something went wrong there. Please try again.','msg_type' => 'err'));
redirect("home/only_message");die;
}
}
public function logout() {
$utype = $this->session->GetCurrentUserType();
$this->session->UnsetAllUserData();
redirect("home");die;
}
public function CheckSession($autoRedirect=false){
$utype = $this->session->GetCurrentUserType();
if($utype=="SG"){
return true;
} elseif($utype=="VT") {
return true;
}elseif($utype=="MP") {
return true;
}
else {
if($autoRedirect) {
redirect("task/admin");
}
}
}
public function forgot_password() {
$this->load->model("database/Morganizers");
$og = new Morganizers();
if(IsPostBack){
$email = $this->input->post("email", true);
$og->organizer_email($email);
if($og->Select()){
$this->SendForgotPasswordLink($email, $og->organizer_id);
$this->session->set_flashdata('message', array('url' => 'home/org_login','msg' => 'A reset link has been emailed successfully. If you do not receive an email within the next 5 minutes, please check your Spam/Junk Mail folder.','msg_type' => 'suc'));
}else{
$this->session->set_flashdata('message', array('url' => 'home/org_login','msg' => 'Oops!! Invalid Email ID. Please try again.','msg_type' => 'err'));
}
}
redirect("home/only_message");die;
}
public function confirmation(){
$this->load->library("GSEncryption");
$message = "";
$pdata = array();
$isExpired = false;
$this->load->model("database/Morganizers");
$og = new Morganizers();
//http://localhost/CorporateCup/home/confirmation/u/d4cd9696353aa4895620658a186db653289446275b6b5524a85c414b8eedc55efd34653d9f07b64aff9df16b16cfbf3a400abb835e786e3ba8c8a668def00b05
$uriData = $this->GetUriArray();
$param = GSEncryption::GSGlobalDecrypt($uriData['u']);
$param = json_decode($param);
//GPrint($uriData['u']);
$curr_url = "home/confirmation/u/".$uriData['u'];
if(IsPostBack){
$np = $this->input->post("password", true);
$og->organizer_id($param->org_id);
$og->password($np);
if($og->Update()){
$this->session->set_flashdata('message', array('url' => 'home/org_login','msg' => 'Password reset successfull!','msg_type' => 'suc'));
}else{
$this->session->set_flashdata('message', array('url' => $curr_url,'msg' => 'Unable to reset your password! Please Try again.','msg_type' => 'err'));
}
redirect("home/only_message");die;
}
$pdata['LoadViews'] = "pass_reset_form";
$this->LoadView($pdata);
}
function SendForgotPasswordLink($email, $org_id){
$this->load->library("GSEncryption");
//$this->load->model("gsystem/GSEmail");
if(!empty($email)){
ob_start();
$obj=new stdClass();
$obj->time=strtotime("+15 MINUTES");
$obj->email_id=$email;
$obj->org_id = $org_id;
$str=json_encode($obj);
$linkparam = GSEncryption::GSGlobalEncrypt($str);
?>
<h1>Your password reset request has been received.</h1>
<p>To confirm your request ,please click the link bellow:<br/>
<a href="<?php echo base_url("home/confirmation/u/".$linkparam);?>"><?php echo base_url("home/confirmation/u/".$linkparam);?></a>
</p>
<?php
$subject = 'Forgot Password link from VCCCSAR';
$emailtext = ob_get_clean();
//GPrint($emailtext);die;
if($this->send_mail($email,$emailtext,$subject)){
return true;
}else{
//redirect("home");die;
}
}
}
public function LoginPanel($rData) {
$this->load->view("login",$rData);
}
private function LoadView($rData) {
$this->load->view("common_view",$rData);
}
private function LoadPanel($rData){
$this->load->view("userBody",$rData);
}
}
?>