Advertisement
Guest User

Controller Class

a guest
Jan 3rd, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.25 KB | None | 0 0
  1. <?
  2.  
  3. public function SendMoney()
  4. {
  5.     $User = $this->user_model->RowDateUser($this->session->UserId);
  6.     if($this->input->post('cryptid'))
  7.     {
  8.         if($this->input->post('cryptid') && $this->input->post('user') && $this->input->post('amount') && $this->input->post('pin'))
  9.         {
  10.             if((int)$this->input->post('cryptid') >= 1 or (int)$this->input->post('cryptid') <= 3)
  11.             {
  12.                 switch((int)$this->input->post('cryptid'))
  13.                 {
  14.                     case 1: $MinAmount = $this->config->item('MinAmountSendBitcoin'); $Val = 'BTC'; $SendBalance = 'BalanceBtc'; break;
  15.                     case 2: $MinAmount = $this->config->item('MinAmountSendUsd'); $Val = 'USD'; $SendBalance = 'BalanceUsd'; break;
  16.                     case 3: $MinAmount = $this->config->item('MinAmountSendDogecoin'); $Val = 'DOGE'; $SendBalance = 'BalanceDoge'; break;
  17.                 }
  18.                
  19.                 if($this->input->post('amount') >= $MinAmount)
  20.                 {
  21.                     if($User[0]['PlatPass'] == $this->input->post('pin'))
  22.                     {
  23.                         if($this->user_model->CheckExistUser($this->input->post('user')))
  24.                         {
  25.                             if($User[0][$SendBalance] >= $this->input->post('amount'))
  26.                             {
  27.                                 if($this->user_model->SendMoneyFromUser($this->input->post('user'), $this->input->post('amount'), $SendBalance, $Val))
  28.                                 {
  29.                                     $this->session->set_flashdata('error', '<div class="alert alert-success">Вы успешно отправили ' . $this->input->post('amount') . ' ' . $Val . ' пользователю #' . $this->input->post('user') . '</div>');
  30.                                     redirect(base_url() . 'cabinet/SendMoney'); exit;
  31.                                 }
  32.                                 else
  33.                                 {
  34.                                     $this->session->set_flashdata('error', '<div class="alert alert-danger">Произошла ошибка при переводе средств! Попробуйте позже!</div>');
  35.                                     redirect(base_url() . 'cabinet/SendMoney'); exit;
  36.                                 }
  37.                             }
  38.                             else
  39.                             {
  40.                                 $this->session->set_flashdata('error', '<div class="alert alert-danger">Недостаточно средств на балансе</div>');
  41.                                 redirect(base_url() . 'cabinet/SendMoney'); exit;
  42.                             }
  43.                         }
  44.                         else
  45.                         {
  46.                             $this->session->set_flashdata('error', '<div class="alert alert-danger">Указанного пользователя не существует</div>');
  47.                             redirect(base_url() . 'cabinet/SendMoney'); exit;
  48.                         }
  49.                     }
  50.                     else
  51.                     {
  52.                         $this->session->set_flashdata('error', '<div class="alert alert-danger">Не верный платежный пароль</div>');
  53.                         redirect(base_url() . 'cabinet/SendMoney'); exit;
  54.                     }
  55.                 }
  56.                 else
  57.                 {
  58.                     $this->session->set_flashdata('error', '<div class="alert alert-danger">Минимум для перевода ' . $MinAmount . ' ' . $Val. '</div>');
  59.                     redirect(base_url() . 'cabinet/SendMoney'); exit;
  60.                 }
  61.             }
  62.             else
  63.             {
  64.                 $this->session->set_flashdata('error', '<div class="alert alert-danger">Укажите валюту перевода</div>');
  65.                 redirect(base_url() . 'cabinet/SendMoney'); exit;
  66.             }
  67.         }
  68.         else
  69.         {
  70.             $this->session->set_flashdata('error', '<div class="alert alert-danger">Все поля обязательны к заполнению</div>');
  71.             redirect(base_url() . 'cabinet/SendMoney'); exit;
  72.         }
  73.     }
  74.    
  75.    
  76.     $this->load->view('account/cabinet/sendmoney');
  77. }
  78.  
  79. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement