Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Action extends CI_Controller {
- public function index() {
- redirect(site_url() . 'home');
- }
- public function login() {
- if ($this->session->userdata('logged_in') === true AND ! empty($this->session->userdata('csrf_token'))) {
- redirect(site_url() . 'home');
- } else {
- $user = filter($this->input->post('user'));
- $pass = sha1($this->input->post('pass'));
- $this->db->where('user', $user);
- $this->db->where('pass', $pass);
- if ($this->db->get('users')->num_rows() == 1) {
- $this->session->set_userdata('logged_in', true);
- $this->session->set_userdata('user', $user);
- $this->session->set_userdata('csrf_token', sha1(md5(time())));
- }
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function logout() {
- if ($this->session->userdata('logged_in')) {
- $this->session->sess_destroy();
- }
- redirect(site_url() . '3xPanelShit');
- }
- public function add_cpanel() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $string = $this->input->post('string');
- $cArr = explode("\n", $string);
- foreach ($cArr as $c) {
- $data = array('string' => $c);
- if ($this->db->insert('cpanels', $data)) {
- $status = 1;
- }
- }
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function edit_cpanel() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $string = $this->input->post('string');
- $data = array('string' => $string);
- $this->db->where('id', filter($this->input->post('id')));
- $this->db->update('cpanels', $data);
- $status = 1;
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function delete_cpanel() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $string = $this->input->post('string');
- $this->db->where('id', filter($this->input->post('id')));
- $this->db->delete('cpanels');
- $status = 1;
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function add_mailer() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $string = $this->input->post('string');
- $cArr = explode("\n", $string);
- foreach ($cArr as $c) {
- $data = array('string' => $c);
- if ($this->db->insert('mailers', $data)) {
- $status = 1;
- }
- }
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function edit_mailer() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $string = $this->input->post('string');
- $data = array('string' => $string);
- $this->db->where('id', filter($this->input->post('id')));
- $this->db->update('mailers', $data);
- $status = 1;
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function delete_mailer() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $string = $this->input->post('string');
- $this->db->where('id', filter($this->input->post('id')));
- $this->db->delete('mailers');
- $status = 1;
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function add_shell() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $string = $this->input->post('string');
- $cArr = explode("\n", $string);
- foreach ($cArr as $c) {
- $data = array('string' => $c);
- if ($this->db->insert('shells', $data)) {
- $status = 1;
- }
- }
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function edit_shell() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $string = $this->input->post('string');
- $data = array('string' => $string);
- $this->db->where('id', filter($this->input->post('id')));
- $this->db->update('shells', $data);
- $status = 1;
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function delete_shell() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $string = $this->input->post('string');
- $this->db->where('id', filter($this->input->post('id')));
- $this->db->delete('shells');
- $status = 1;
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function update_pricing() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $data = array(
- 'cpanel' => filter($this->input->post('cpanel')),
- 'mailer' => filter($this->input->post('mailer')),
- 'shell' => filter($this->input->post('shell')),
- );
- $this->db->update('pricing', $data);
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function update_pm_setting() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $data = array(
- 'PAYEE_ACCOUNT' => filter($this->input->post('account')),
- 'ALTERNATE_PASSPHRASE' => filter($this->input->post('passphrase')),
- 'DISPLAY_NAME' => filter($this->input->post('display'))
- );
- $this->db->update('pm_settings', $data);
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function update_btc_setting() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $data = array(
- 'btc_secret' => filter($this->input->post('secret')),
- 'btc_api' => filter($this->input->post('api')),
- 'btc_xpub' => filter($this->input->post('xpub'))
- );
- $this->db->update('setting', $data);
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function update_system_setting() {
- if ($this->input->post('csrf_token') == $this->session->userdata('csrf_token') AND $this->session->userdata('logged_in') === true) {
- $data = array(
- 'icq_id' => filter($this->input->post('icq')),
- 'shell_id' => filter($this->input->post('shell')),
- 'mailer_id' => filter($this->input->post('mailer')),
- 'video_embed_content' => $this->input->post('vdc'),
- 'box1_title' => filter($this->input->post('b1t')),
- 'box1_content' => $this->input->post('b1c'),
- 'box2_title' => filter($this->input->post('b2t')),
- 'box2_content' => $this->input->post('b2c'),
- 'box3_title' => filter($this->input->post('b3t')),
- 'box3_content' => $this->input->post('b3c'),
- );
- $this->db->update('setting', $data);
- redirect(site_url() . '3xPanelShit');
- }
- }
- public function get_price() {
- $item = filter($this->input->post('item'));
- if (!empty($item) AND ( $item == "cpanel" OR $item == "mailer" OR $item == "shell")) {
- $price = $this->db->get('pricing')->row()->$item;
- if ($item == "cpanel") {
- $stock = $this->db->get("cpanels")->num_rows();
- } elseif ($item == "mailer") {
- $stock = $this->db->get("mailers")->num_rows();
- } elseif ($item == "shell") {
- $stock = $this->db->get("shells")->num_rows();
- }
- $data = array(
- "price" => $price,
- "btcprice" => usdToBtc($price),
- "stock" => $stock
- );
- echo json_encode($data);
- } else {
- $data = array(
- "price" => 0,
- "btcprice" => usdToBtc($price),
- "stock" => 0
- );
- echo json_encode($data);
- }
- }
- public function confirm_item() {
- $item = filter($this->input->post('item'));
- $quantity = filter($this->input->post('quantity'));
- if (is_numeric($quantity) AND ( $item == "cpanel" OR $item == "mailer" OR $item == "shell")) {
- $this->load->helper('string');
- $payment_id = random_string('alnum', 22);
- $secret = sha1(md5(time()));
- $this->session->set_userdata('item', $item);
- $this->session->set_userdata('quantity', $quantity);
- $this->session->set_userdata('selection', 'true');
- $this->session->set_userdata('payment_id', $payment_id);
- $this->session->set_userdata('file_name', sha1(time()));
- $this->session->set_userdata('payment_method', 'pm');
- $this->session->set_userdata('secret', $secret);
- $data = array(
- "status" => 1,
- "payment_id" => $payment_id
- );
- echo json_encode($data);
- } else {
- $data = array(
- "status" => 0
- );
- echo json_encode($data);
- }
- }
- public function cancel_item() {
- $this->session->unset_userdata('item');
- $this->session->unset_userdata('quantity');
- $this->session->unset_userdata('selection');
- $this->session->unset_userdata('payment_id');
- $this->session->unset_userdata('file_name');
- $this->session->unset_userdata('payment_method');
- $this->session->unset_userdata('secret');
- $data = array(
- "status" => 1
- );
- echo json_encode($data);
- }
- public function set_btc_payment_method() {
- $this->session->unset_userdata('payment_method');
- $this->session->set_userdata('payment_method', 'btc');
- if ($this->session->userdata('selection') == "true") {
- $secret = $this->db->get('setting')->row()->btc_secret;
- $invoice_id = $this->session->userdata('payment_id');
- $my_xpub = $this->db->get('setting')->row()->btc_xpub;
- $my_api_key = $this->db->get('setting')->row()->btc_api;
- $my_callback_url = site_url() . 'process/process_btc_transaction?secret=' . $secret . '&invoice_id=' . $invoice_id;
- $gap_check_url = "https://api.blockchain.info/v2/receive/checkgap?xpub=" . $my_xpub . "&key=" . $my_api_key;
- $gap_check_response = file_get_contents($gap_check_url);
- $gap_limit = (int) json_decode($gap_check_response)->gap + 2;
- $root_url = 'https://api.blockchain.info/v2/receive';
- $parameters = 'xpub=' . $my_xpub . '&callback=' . urlencode($my_callback_url) . '&key=' . $my_api_key . '&gap_limit=' . $gap_limit;
- $response = file_get_contents($root_url . '?' . $parameters);
- $data = json_decode($response);
- $address = $data->address;
- $item = $this->session->userdata('item');
- $item_price = $this->db->get('pricing')->row()->$item;
- $total_price = usdToBtc($item_price * $this->session->userdata('quantity'));
- $this->session->set_userdata('btc_address', $address);
- $this->session->set_userdata('btc_amount', $total_price);
- $this->session->set_userdata('usd_amount', $item_price * $this->session->userdata('quantity'));
- if (!empty($address)) {
- //process address monitor
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://api.blockchain.info/v2/receive/balance_update");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POST, true);
- $data = array(
- 'key' => $my_api_key,
- 'addr' => $address,
- 'callback' => $my_callback_url,
- 'onNotification' => 'DELETE',
- 'op' => 'RECEIVE',
- 'confs' => '4'
- );
- $json_data = json_encode($data);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
- curl_close($ch);
- //end processing address monitor
- $data = array(
- "status" => 1,
- "address" => $address,
- "amount" => $total_price
- );
- echo json_encode($data);
- } else {
- $data = array(
- "status" => 0,
- "data" => $data
- );
- echo json_encode($data);
- }
- } else {
- $data = array(
- "status" => 0
- );
- echo json_encode($data);
- }
- }
- public function check_btc_payment() {
- $btc_address = $this->session->userdata('btc_address');
- $url = "https://blockchain.info/q/addressbalance/" . $btc_address;
- $response = file_get_contents($url);
- $value_in_btc = $response / 100000000; //received btc value
- $value_in_usd = btcToUsd($value_in_btc);
- if ($this->session->userdata('selection') == "true" AND $this->session->userdata('payment_method') == "btc") {
- if ($value_in_usd > ($this->session->userdata('usd_amount') * 0.98)) {
- $this->session->set_userdata('btc_payment_verified', 1);
- $data = array(
- "status" => 1
- );
- echo json_encode($data);
- } else {
- $data = array(
- "status" => 0
- );
- echo json_encode($data);
- }
- } else {
- $data = array(
- "status" => false
- );
- echo json_encode($data);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement