File: /home/awaldron/public_html/archive/teampay/application/controllers/payment.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Payment extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->library('tank_auth');
$this->load->model('payment_model');
}
function index()
{
// Initialize page variables
$data = $this->tank_auth->auth_init();
$post = $this->input->post();
// Form Validation
$this->form_validation->set_rules('player_id', 'Player', 'trim|required|xss_clean');
$this->form_validation->set_rules('pay_type', 'Payment Type', 'trim|required|xss_clean');
$this->form_validation->set_rules('payment_amt', 'Payment Amount', 'trim|required|xss_clean|is_numeric');
if ($this->form_validation->run()) { // validation ok
$post['payment_date'] = datetime();
$post['payment_amt'] = preg_replace("/[^0-9\.]/","", $post['payment_amt']);
$post['payment_amt'] = number_format( $post['payment_amt'], 2 );
unset($post['playerowes']);
if ($post['pay_type'] == 1) {
unset($post['pay_type']);
$post['is_cash'] = 1;
$post['payment_fee'] = 0;
$post['payment_revenue'] = 0;
$post['payment_total'] = $post['payment_amt'];
$this->payment_model->pay_cash($post);
redirect('/team/'.$post['team_id']);
}
} else {
$data['navon'] = 'my_teams';
$data['page_title'] = 'Submit Payment Error';
$data['icon_title'] = 'fa-plus-dollar';
$data['message'] = array('Oops, something went wrong with your payment. You probably didn\'t fill out a required field. Click the back button and give it another shot.');
$this->load->view('_header.php', $data);
$this->load->view('auth/general_message', $data);
$this->load->view('_footer.php', $data);
}
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */