Are you a regular stikked user? Signup so you can keep track of your pastes!
  1.     function success() {
  2.         // This is where you would probably want to thank the user for their order
  3.         // or what have you.  The order information at this point is in POST
  4.         // variables.  However, you don't want to "process" the order until you
  5.         // get validation from the IPN.  That's where you would have the code to
  6.         // email an admin, update the database with payment status, activate a
  7.         // membership, etc.
  8.  
  9.         // You could also simply re-direct them to another page, or your own
  10.         // order status page which presents the user with the status of their
  11.         // order based on a database (which can be modified with the IPN code
  12.         // below).
  13.  
  14.         $this->load->library('DX_Auth');
  15.  
  16.         $data['page_title'] = 'Meridian School - Summer';
  17.  
  18.         $login_results =  $this->dx_auth->is_logged_in();
  19.  
  20.         $data['login_results'] = $login_results;
  21.  
  22.         if ( $login_results ) {
  23.  
  24.             $this->load->model('Persons');
  25.             $this->load->model('Classes');
  26.  
  27.             $lid = $this->dx_auth->get_user_id();
  28.             $pid = $this->Persons->get_person_by_login($lid);
  29.             $data['parent'] = $pid;
  30.  
  31.             $mid = $this->Persons->get_person_member($pid);
  32.             $data['member'] = $mid;
  33.  
  34.             $this->cart->destroy();
  35.  
  36.         } else {
  37.  
  38.             redirect('summer', 'location');
  39.         }
  40.  
  41.         $this->load->view('common/header', $data);
  42.  
  43.         $ret_data = $_POST;
  44.  
  45.         $info = array();
  46.         $info['kid_classes'] = array();
  47.  
  48.         $i = 0;
  49.         $j = 0;
  50.         foreach ($ret_data as $key => $value ) {
  51.  
  52.             switch ($key) {
  53.                 case 'custom':
  54.                     $info['custom'] = $value;
  55.                     break;
  56.  
  57.                 case (!(strcmp(substr($key, 0, -1), 'item_number'))):
  58.                     $info['kid_classes'][$i] = explode('_',$value);
  59.  
  60.                     if (count($info['kid_classes'][$i]) > 2)
  61.                         $this->Classes->update_member_class(
  62.                             $info['kid_classes'][$i][0],
  63.                             $mid,
  64.                             $info['kid_classes'][$i][3],
  65.                             ENROLL_QUEUED);
  66.  
  67.                     $i++;
  68.                     break;
  69.  
  70.                 case (!(strcmp(substr($key, 0, -1), 'item_name'))):
  71.                     $info['class_name'][$j] = $value;
  72.                     $j++;
  73.                     break;
  74.             }
  75.         }
  76.  
  77.         $info['i'] = $i;
  78.         $info['j'] = $j;
  79.         $data['pp_info'] = $info;
  80.  
  81.         $onum = $ret_data['transaction_subject'].'-'.$ret_data['item_number1'];
  82.         $fn = $ret_data['first_name'];
  83.         $ln = $ret_data['last_name'];
  84.         $addr = $ret_data['address_street'];
  85.         $city = $ret_data['address_city'];
  86.         $state = $ret_data['address_state'];
  87.         $zip = $ret_data['address_zip'];
  88.         $recv_email =  $ret_data['payer_email'];
  89.  
  90.         $body = '
  91.  
  92. Thank you for registering in the Meridian School Summer Quest Program.
  93. Below are the details of what programs you are currently registered in.
  94. Keep this for your own records.
  95.  
  96. Registration Summary:
  97.  
  98. Order Number '.$onum.'
  99.  
  100. Name '.$fn.' '.$ln.'
  101.  
  102.  
  103. Address '.$addr.', '.$city.', '.$state.', '.$zip.'
  104.  
  105. E-mail '.$recv_email.'
  106.  
  107. Registration Completed Date '.date('m/d/Y').' at '.date('g:i A').';
  108.  
  109. $body .= "\n\nProgram:";
  110.  
  111.        $kids = $this->Persons->get_member_child_summary($mid);
  112.  
  113.        if ($kids->num_rows() > 0) {
  114.            foreach($kids->result() as $kid) {
  115.  
  116.                $nm = $kid->A_FirstName.' '.$kid->A_LastName;
  117. $body .= "\n    ".$nm.'  Age:'.intval($kid->I_Age);
  118.  
  119.                $kids_classes = $this->Persons->get_child_class_summary($mid, $kid->I_Person);
  120.                if ($kids_classes->num_rows() > 0) {
  121.                    foreach($kids_classes->result() as $kid_class) {
  122.  
  123.                        switch ($kid_class->I_Status) {
  124.                            case 1:
  125.                                $stat = '<span>*Pending*</span>';
  126.                                break;
  127.  
  128.                            case 2:
  129.                                $stat = '<span>*Queued*</span>';
  130.                                break;
  131.  
  132.                            case 3:
  133.                                $stat = '';
  134.                                break;
  135.                        }
  136.  
  137.                        $o = '';
  138.                        $op = 0;
  139.                        swtich ($kid_class->I_Status){
  140.                            case 0:
  141.                                $o = '';
  142.                                $op = 0;
  143.                                break;
  144.                            case 1:
  145.                                $o = ' With Extended Care Option: AM $'.EXTENDED_CARE_AM;
  146.                                $op = EXTENDED_CARE_AM;
  147.                                break;
  148.                            case 2:
  149.                                $o = ' With Extended Care Option: PM $'.EXTENDED_CARE_PM;
  150.                                $op = EXTENDED_CARE_PM;
  151.                                break;
  152.                            case 3:
  153.                                $o = ' With Extended Care Option: Both(AM/PM) $'.EXTENDED_CARE_BOTH;
  154.                                $op = EXTENDED_CARE_BOTH;
  155.                                break;
  156.                        }
  157.                        $price = $kid_class->A_Price + $op;
  158.  
  159. $body .= "\n            ".$stat.' '.$kid_class->A_Name.' '.$o;
  160. $body .= "\n             ".$kid_class->A_Date;
  161. $body .= "\n             ".$price."\n";
  162.                    }
  163.                }
  164. $body .= "\n";
  165.            }
  166.        }
  167. $body .= "\nRegistration Fee ($25)\n";
  168. $body .= "\n----- Total: $".$ret_data['payment_gross']."\n";
  169. $body .= "\n\n".' We look forward to seeing you this Summer! '."\n\n\n";
  170. $body .= "If you have any questions or concerns please E-mail Doug Coppinger
  171. (email dcoppinger@meridianschool.edu), or call the school at (206) 632-7154.\n\n";
  172. $body .= "________________________________\n";
  173. $body .= "Meridian School | 4649 Sunnyside Ave N, Ste 242 Seattle, WA 98103 | Local: (206) 632-7154 | Toll Free: 1-866-767-1328 | FAX: 206-633-1864\n";
  174.  
  175.            $this->load->library('email');
  176.            $this->email->to($this->paypal_lib->ipn_data['payer_email']);
  177.            $this->email->cc('tweakgames@gmail.com');
  178.            $this->email->bcc('bwoodall@bwoodall.org');
  179.            $this->email->from('dcoppinger@meridianschool.edu');
  180.            $this->email->subject('Meridian School Summer Quest Program: Confirmation');
  181.            $this->email->message($body);
  182.            $this->email->send();
  183.  
  184.  
  185.        $this->load->view('paypal/success', $data);
  186.  
  187.        $this->load->view('common/footer', $data);
  188.    }
  189.  

Reply to "Untitled"

Here you can reply to the paste above

Create a snipurl

Make Private

Feeling clever? Set some advanced options.