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 Process extends CI_Controller {
- public function index() {
- redirect(site_url() . 'home');
- }
- public function process_pm_transaction() {
- $RECORD_PAYEE_ACCOUNT = $this->db->get('pm_settings')->row()->PAYEE_ACCOUNT;
- $GET_PAYEE_ACCOUNT = filter($this->input->post('PAYEE_ACCOUNT'));
- if ($RECORD_PAYEE_ACCOUNT == $GET_PAYEE_ACCOUNT) {
- $GET_PAYMENT_ID = filter($this->input->post('PAYMENT_ID'));
- $GET_PAYMENT_AMOUNT = filter($this->input->post('PAYMENT_AMOUNT'));
- $GET_PAYMENT_UNITS = filter($this->input->post('PAYMENT_UNITS'));
- $GET_PAYMENT_BATCH_NUM = filter($this->input->post('PAYMENT_BATCH_NUM'));
- $GET_PAYER_ACCOUNT = filter($this->input->post('PAYER_ACCOUNT'));
- $GET_TIMESTAMPGMT = filter($this->input->post('TIMESTAMPGMT'));
- $GET_V2_HASH = filter($this->input->post('V2_HASH'));
- $GENERATED_ALTERNATE_PASSPHRASE_HASH = strtoupper(md5($this->db->get('pm_settings')->row()->ALTERNATE_PASSPHRASE));
- $GENERATED_V2_HASH = strtoupper(md5($GENERATE_V2_HASH_STRING));
- //PAYMENT_ID:PAYEE_ACCOUNT:PAYMENT_AMOUNT:PAYMENT_UNITS:PAYMENT_BATCH_NUM:PAYER_ACCOUNT:AlternateMerchantPassphraseHash:TIMESTAMPGMT
- $GENERATE_V2_HASH_STRING = $GET_PAYMENT_ID . ":" . $GET_PAYEE_ACCOUNT . ":" . $GET_PAYMENT_AMOUNT . ":" . $GET_PAYMENT_UNITS . ":" . $GET_PAYMENT_BATCH_NUM . ":" . $GET_PAYER_ACCOUNT . ":" . $GENERATED_ALTERNATE_PASSPHRASE_HASH . ":" . $GET_TIMESTAMPGMT;
- $GENERATED_V2_HASH = strtoupper(md5($GENERATE_V2_HASH_STRING));
- if ($GET_V2_HASH == $GENERATED_V2_HASH) {
- $this->db->where('V2_HASH', $GENERATED_V2_HASH);
- if ($this->db->get('pm_transactions')->num_rows() == 0) {
- $insert_data = array();
- $insert_data['PAYMENT_ID'] = $GET_PAYMENT_ID;
- $insert_data['PAYEE_ACCOUNT'] = $GET_PAYEE_ACCOUNT;
- $insert_data['PAYMENT_AMOUNT'] = $GET_PAYMENT_AMOUNT;
- $insert_data['PAYMENT_UNITS'] = $GET_PAYMENT_UNITS;
- $insert_data['PAYMENT_BATCH_NUM'] = $GET_PAYMENT_BATCH_NUM;
- $insert_data['PAYER_ACCOUNT'] = $GET_PAYER_ACCOUNT;
- $insert_data['TIMESTAMPGMT'] = $GET_TIMESTAMPGMT;
- $insert_data['V2_HASH'] = $GET_V2_HASH;
- if ($this->db->insert('pm_transactions', $insert_data)) {
- $data = array('status' => 'SUCCESS');
- echo json_encode($data);
- }
- } else {
- $data = array('status' => 'EXISTENSE');
- echo json_encode($data);
- }
- } else {
- $data = array('status' => 'FAILED');
- echo json_encode($data);
- }
- } else {
- $data = array('status' => 'ERROR');
- echo json_encode($data);
- }
- }
- public function process_btc_transaction() {
- $invoice_id = $this->input->get('invoice_id');
- $set_secret = $this->db->get('setting')->row()->btc_secret;
- $get_secret = $this->input->get('secret');
- $value_in_satoshi = $this->input->get('value');
- $value_in_btc = $value_in_satoshi / 100000000; //received btc value
- $value_in_usd = btcToUsd($value_in_btc);
- $transaction_hash = $_GET['transaction_hash'];
- $confirmation = $this->input->get('confirmations');
- if ($get_secret == $set_secret) {
- $insert_data = array();
- $insert_data['invoice_id'] = $invoice_id;
- $insert_data['secret'] = $secret;
- $insert_data['btc_amount'] = $value_in_btc;
- $insert_data['usd_amount'] = $value_in_usd;
- $insert_data['trx_hash'] = $transaction_hash;
- $insert_data['confirmation'] = $confirmation;
- if ($confirmation >= 4) {
- if ($this->db->insert('btc_transactions', $insert_data)) {
- echo "*ok*";
- }
- }
- }
- }
- public function generate_file() {
- if ($this->session->userdata('set_download') == 1) {
- $this->session->unset_userdata('set_download');
- if ($this->session->userdata('check_download') == 1) {
- $this->session->unset_userdata('check_download');
- //process btc file generate process
- $item = $this->session->userdata('item');
- $type = $item;
- $quantity = $this->session->userdata('quantity');
- if ($type == "cpanel") {
- $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
- $data = $this->db->order_by('rand()')->get('cpanels')->result();
- $content = "//Cpanel List from SpamZone" . "\\\ " . "\n" . "Format: url|username|password" . "\n";
- $handle = fopen($file_name, "a");
- fwrite($handle, $content);
- fclose($handle);
- $x = 0;
- while ($x <= $quantity - 1) {
- $string = trim($data[$x]->string);
- $id = trim($data[$x]->id);
- if (check_cp($string)) {
- $handle = fopen($file_name, "a");
- $content = $string . "\n";
- fwrite($handle, $content);
- fclose($handle);
- $this->db->where('id', $id);
- $this->db->delete('cpanels');
- $total_sold = $this->db->get('total_sold')->row()->cpanel + 1;
- $update_total = array("cpanel" => $total_sold);
- $this->db->update('total_sold', $update_total);
- $data = $this->db->order_by('rand()')->get('cpanels')->result();
- $x += 1;
- } else {
- $this->db->where('id', $id);
- $this->db->delete('cpanels');
- $data = $this->db->order_by('rand()')->get('cpanels')->result();
- }
- }
- $data = array(
- "status" => "complete",
- "type" => "Cpanel",
- "file_name" => $this->session->userdata('file_name')
- );
- echo json_encode($data);
- session_write_close();
- exit();
- } elseif ($type == "mailer") {
- $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
- $data = $this->db->order_by('rand()')->get('mailers')->result();
- $mailer_id = $this->db->get('setting')->row()->mailer_id;
- $content = "//Mailer List from SpamZone" . "\\\ " . "\n" . "Format: url" . "\n";
- $handle = fopen($file_name, "a");
- fwrite($handle, $content);
- fclose($handle);
- $x = 0;
- while ($x <= $quantity - 1) {
- $string = trim($data[$x]->string);
- $id = trim($data[$x]->id);
- if (check_url($string, $mailer_id)) {
- $handle = fopen($file_name, "a");
- $content = $string . "\n";
- fwrite($handle, $content);
- fclose($handle);
- $this->db->where('id', $data[$x]->id);
- $this->db->delete('mailers');
- $total_sold = $this->db->get('total_sold')->row()->mailer + 1;
- $update_total = array("mailer" => $total_sold);
- $this->db->update('total_sold', $update_total);
- $data = $this->db->order_by('rand()')->get('mailers')->result();
- $x += 1;
- } else {
- $this->db->where('id', $data[$x]->id);
- $this->db->delete('mailers');
- $data = $this->db->order_by('rand()')->get('mailers')->result();
- }
- }
- $data = array(
- "status" => "complete",
- "type" => "Cpanel",
- "file_name" => $this->session->userdata('file_name')
- );
- echo json_encode($data);
- session_write_close();
- exit();
- } elseif ($type == "shell") {
- $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
- $data = $this->db->order_by('rand()')->get('shells')->result();
- $shell_id = $this->db->get('setting')->row()->shell_id;
- $content = "//Shell List from SpamZone" . "\\\ " . "\n" . "Format: url" . "\n";
- $handle = fopen($file_name, "a");
- fwrite($handle, $content);
- fclose($handle);
- $x = 0;
- while ($x <= $quantity - 1) {
- $string = trim($data[$x]->string);
- $id = trim($data[$x]->id);
- if (check_url($string, $shell_id)) {
- $handle = fopen($file_name, "a");
- $content = $string . "\n";
- fwrite($handle, $content);
- fclose($handle);
- $this->db->where('id', $id);
- $this->db->delete('shells');
- $total_sold = $this->db->get('total_sold')->row()->shell + 1;
- $update_total = array("shell" => $total_sold);
- $this->db->update('total_sold', $update_total);
- $data = $this->db->order_by('rand()')->get('shells')->result();
- $x += 1;
- } else {
- $this->db->where('id', $id);
- $this->db->delete('shells');
- $data = $this->db->order_by('rand()')->get('shells')->result();
- }
- }
- $data = array(
- "status" => "complete",
- "type" => "Cpanel",
- "file_name" => $this->session->userdata('file_name')
- );
- echo json_encode($data);
- session_write_close();
- exit();
- }
- } else {
- //process perfectmoney file generate process
- $item = $this->session->userdata('item');
- $item_price = $this->db->get('pricing')->row()->$item;
- $total_price = $item_price * $this->session->userdata('quantity');
- $payment_id = $this->session->userdata('payment_id');
- $payee_account = $this->db->get('pm_settings')->row()->PAYEE_ACCOUNT;
- $this->db->where('PAYEE_ACCOUNT', $payee_account);
- $this->db->where('PAYMENT_ID', $payment_id);
- $this->db->where('PAYMENT_AMOUNT', $total_price);
- $this->db->where('PAYMENT_UNITS', 'USD');
- if ($this->db->get('pm_transactions')->num_rows() == 1) {
- $type = $item;
- $quantity = $this->session->userdata('quantity');
- if ($type == "cpanel") {
- $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
- $data = $this->db->order_by('rand()')->get('cpanels')->result();
- $content = "//Cpanel List from SpamZone" . "\\\ " . "\n" . "Format: url|username|password" . "\n";
- $handle = fopen($file_name, "a");
- fwrite($handle, $content);
- fclose($handle);
- $x = 0;
- while ($x <= $quantity - 1) {
- $string = trim($data[$x]->string);
- $id = trim($data[$x]->id);
- if (check_cp($string)) {
- $handle = fopen($file_name, "a");
- $content = $string . "\n";
- fwrite($handle, $content);
- fclose($handle);
- $this->db->where('id', $id);
- $this->db->delete('cpanels');
- $total_sold = $this->db->get('total_sold')->row()->cpanel + 1;
- $update_total = array("cpanel" => $total_sold);
- $this->db->update('total_sold', $update_total);
- $data = $this->db->order_by('rand()')->get('cpanels')->result();
- $x += 1;
- } else {
- $this->db->where('id', $id);
- $this->db->delete('cpanels');
- $data = $this->db->order_by('rand()')->get('cpanels')->result();
- }
- }
- $data = array(
- "status" => "complete",
- "type" => "Cpanel",
- "file_name" => $this->session->userdata('file_name')
- );
- echo json_encode($data);
- session_write_close();
- exit();
- } elseif ($type == "mailer") {
- $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
- $data = $this->db->order_by('rand()')->get('mailers')->result();
- $mailer_id = $this->db->get('setting')->row()->mailer_id;
- $content = "//Mailer List from SpamZone" . "\\\ " . "\n" . "Format: url" . "\n";
- $handle = fopen($file_name, "a");
- fwrite($handle, $content);
- fclose($handle);
- $x = 0;
- while ($x <= $quantity - 1) {
- $string = trim($data[$x]->string);
- $id = trim($data[$x]->id);
- if (check_url($string, $mailer_id)) {
- $handle = fopen($file_name, "a");
- $content = $string . "\n";
- fwrite($handle, $content);
- fclose($handle);
- $this->db->where('id', $data[$x]->id);
- $this->db->delete('mailers');
- $total_sold = $this->db->get('total_sold')->row()->mailer + 1;
- $update_total = array("mailer" => $total_sold);
- $this->db->update('total_sold', $update_total);
- $data = $this->db->order_by('rand()')->get('mailers')->result();
- $x += 1;
- } else {
- $this->db->where('id', $data[$x]->id);
- $this->db->delete('mailers');
- $data = $this->db->order_by('rand()')->get('mailers')->result();
- }
- }
- $data = array(
- "status" => "complete",
- "type" => "Cpanel",
- "file_name" => $this->session->userdata('file_name')
- );
- echo json_encode($data);
- session_write_close();
- exit();
- } elseif ($type == "shell") {
- $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
- $data = $this->db->order_by('rand()')->get('shells')->result();
- $shell_id = $this->db->get('setting')->row()->shell_id;
- $content = "//Shell List from SpamZone" . "\\\ " . "\n" . "Format: url" . "\n";
- $handle = fopen($file_name, "a");
- fwrite($handle, $content);
- fclose($handle);
- $x = 0;
- while ($x <= $quantity - 1) {
- $string = trim($data[$x]->string);
- $id = trim($data[$x]->id);
- if (check_url($string, $shell_id)) {
- $handle = fopen($file_name, "a");
- $content = $string . "\n";
- fwrite($handle, $content);
- fclose($handle);
- $this->db->where('id', $id);
- $this->db->delete('shells');
- $total_sold = $this->db->get('total_sold')->row()->shell + 1;
- $update_total = array("shell" => $total_sold);
- $this->db->update('total_sold', $update_total);
- $data = $this->db->order_by('rand()')->get('shells')->result();
- $x += 1;
- } else {
- $this->db->where('id', $id);
- $this->db->delete('shells');
- $data = $this->db->order_by('rand()')->get('shells')->result();
- }
- }
- $data = array(
- "status" => "complete",
- "type" => "Cpanel",
- "file_name" => $this->session->userdata('file_name')
- );
- echo json_encode($data);
- session_write_close();
- exit();
- }
- }
- }
- }
- }
- public function download_file($file) {
- $file_name = generate_file_create_path() . "/" . $file . ".txt";
- header('Content-Description: File Transfer');
- header('Content-Type: application/octet-stream');
- header('Content-Disposition: attachment; filename="' . basename($file_name) . '"');
- header('Expires: 0');
- header('Cache-Control: must-revalidate');
- header('Pragma: public');
- header('Content-Length: ' . filesize($file_name));
- readfile($file_name);
- exit();
- }
- //curl --data '{"key":"c97ffb0c-9021-446b-8a82-fea919de6ac4","addr":"183qrMGHzMstARRh2rVoRepAd919sGgMHb","callback":"https://spamzone.pm/process/process_btc_transaction","onNotification":"DELETE", "op":"RECEIVE", "confs": 5}' https://api.blockchain.info/v2/receive/balance_update
- //https://api.blockchain.info/v2/receive/balance_update
- //curl "https://api.blockchain.info/v2/receive/callback_log?callback=https%3A%2F%2Fmystore.com%3Finvoice_id%3D05892112%26secret%3DZzsMLGKe162CfA5EcG6j&key=[yourkeyhere]"
- public function test() {
- $my_xpub = $this->db->get('setting')->row()->btc_xpub;
- $my_api_key = $this->db->get('setting')->row()->btc_api;
- echo $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;
- echo $gap_check_response;
- }
- public function test1() {
- if (!empty($this->input->post('confs'))) {
- echo $this->input->post('confs');
- } else {
- echo "Error";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement