Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.51 KB | None | 0 0
  1. <?php
  2.  
  3. defined('BASEPATH') OR exit('No direct script access allowed');
  4.  
  5. class Process extends CI_Controller {
  6.  
  7. public function index() {
  8. redirect(site_url() . 'home');
  9. }
  10.  
  11. public function process_pm_transaction() {
  12. $RECORD_PAYEE_ACCOUNT = $this->db->get('pm_settings')->row()->PAYEE_ACCOUNT;
  13. $GET_PAYEE_ACCOUNT = filter($this->input->post('PAYEE_ACCOUNT'));
  14. if ($RECORD_PAYEE_ACCOUNT == $GET_PAYEE_ACCOUNT) {
  15. $GET_PAYMENT_ID = filter($this->input->post('PAYMENT_ID'));
  16. $GET_PAYMENT_AMOUNT = filter($this->input->post('PAYMENT_AMOUNT'));
  17. $GET_PAYMENT_UNITS = filter($this->input->post('PAYMENT_UNITS'));
  18. $GET_PAYMENT_BATCH_NUM = filter($this->input->post('PAYMENT_BATCH_NUM'));
  19. $GET_PAYER_ACCOUNT = filter($this->input->post('PAYER_ACCOUNT'));
  20. $GET_TIMESTAMPGMT = filter($this->input->post('TIMESTAMPGMT'));
  21. $GET_V2_HASH = filter($this->input->post('V2_HASH'));
  22. $GENERATED_ALTERNATE_PASSPHRASE_HASH = strtoupper(md5($this->db->get('pm_settings')->row()->ALTERNATE_PASSPHRASE));
  23. $GENERATED_V2_HASH = strtoupper(md5($GENERATE_V2_HASH_STRING));
  24. //PAYMENT_ID:PAYEE_ACCOUNT:PAYMENT_AMOUNT:PAYMENT_UNITS:PAYMENT_BATCH_NUM:PAYER_ACCOUNT:AlternateMerchantPassphraseHash:TIMESTAMPGMT
  25. $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;
  26. $GENERATED_V2_HASH = strtoupper(md5($GENERATE_V2_HASH_STRING));
  27. if ($GET_V2_HASH == $GENERATED_V2_HASH) {
  28. $this->db->where('V2_HASH', $GENERATED_V2_HASH);
  29. if ($this->db->get('pm_transactions')->num_rows() == 0) {
  30. $insert_data = array();
  31. $insert_data['PAYMENT_ID'] = $GET_PAYMENT_ID;
  32. $insert_data['PAYEE_ACCOUNT'] = $GET_PAYEE_ACCOUNT;
  33. $insert_data['PAYMENT_AMOUNT'] = $GET_PAYMENT_AMOUNT;
  34. $insert_data['PAYMENT_UNITS'] = $GET_PAYMENT_UNITS;
  35. $insert_data['PAYMENT_BATCH_NUM'] = $GET_PAYMENT_BATCH_NUM;
  36. $insert_data['PAYER_ACCOUNT'] = $GET_PAYER_ACCOUNT;
  37. $insert_data['TIMESTAMPGMT'] = $GET_TIMESTAMPGMT;
  38. $insert_data['V2_HASH'] = $GET_V2_HASH;
  39. if ($this->db->insert('pm_transactions', $insert_data)) {
  40. $data = array('status' => 'SUCCESS');
  41. echo json_encode($data);
  42. }
  43. } else {
  44. $data = array('status' => 'EXISTENSE');
  45. echo json_encode($data);
  46. }
  47. } else {
  48. $data = array('status' => 'FAILED');
  49. echo json_encode($data);
  50. }
  51. } else {
  52. $data = array('status' => 'ERROR');
  53. echo json_encode($data);
  54. }
  55. }
  56.  
  57. public function process_btc_transaction() {
  58. $invoice_id = $this->input->get('invoice_id');
  59. $set_secret = $this->db->get('setting')->row()->btc_secret;
  60. $get_secret = $this->input->get('secret');
  61. $value_in_satoshi = $this->input->get('value');
  62. $value_in_btc = $value_in_satoshi / 100000000; //received btc value
  63. $value_in_usd = btcToUsd($value_in_btc);
  64. $transaction_hash = $_GET['transaction_hash'];
  65. $confirmation = $this->input->get('confirmations');
  66. if ($get_secret == $set_secret) {
  67. $insert_data = array();
  68. $insert_data['invoice_id'] = $invoice_id;
  69. $insert_data['secret'] = $secret;
  70. $insert_data['btc_amount'] = $value_in_btc;
  71. $insert_data['usd_amount'] = $value_in_usd;
  72. $insert_data['trx_hash'] = $transaction_hash;
  73. $insert_data['confirmation'] = $confirmation;
  74. if ($confirmation >= 4) {
  75. if ($this->db->insert('btc_transactions', $insert_data)) {
  76. echo "*ok*";
  77. }
  78. }
  79. }
  80. }
  81.  
  82. public function generate_file() {
  83. if ($this->session->userdata('set_download') == 1) {
  84. $this->session->unset_userdata('set_download');
  85. if ($this->session->userdata('check_download') == 1) {
  86. $this->session->unset_userdata('check_download');
  87. //process btc file generate process
  88. $item = $this->session->userdata('item');
  89. $type = $item;
  90. $quantity = $this->session->userdata('quantity');
  91. if ($type == "cpanel") {
  92. $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
  93. $data = $this->db->order_by('rand()')->get('cpanels')->result();
  94. $content = "//Cpanel List from SpamZone" . "\\\ " . "\n" . "Format: url|username|password" . "\n";
  95. $handle = fopen($file_name, "a");
  96. fwrite($handle, $content);
  97. fclose($handle);
  98. $x = 0;
  99. while ($x <= $quantity - 1) {
  100. $string = trim($data[$x]->string);
  101. $id = trim($data[$x]->id);
  102. if (check_cp($string)) {
  103. $handle = fopen($file_name, "a");
  104. $content = $string . "\n";
  105. fwrite($handle, $content);
  106. fclose($handle);
  107. $this->db->where('id', $id);
  108. $this->db->delete('cpanels');
  109. $total_sold = $this->db->get('total_sold')->row()->cpanel + 1;
  110. $update_total = array("cpanel" => $total_sold);
  111. $this->db->update('total_sold', $update_total);
  112. $data = $this->db->order_by('rand()')->get('cpanels')->result();
  113. $x += 1;
  114. } else {
  115. $this->db->where('id', $id);
  116. $this->db->delete('cpanels');
  117. $data = $this->db->order_by('rand()')->get('cpanels')->result();
  118. }
  119. }
  120. $data = array(
  121. "status" => "complete",
  122. "type" => "Cpanel",
  123. "file_name" => $this->session->userdata('file_name')
  124. );
  125. echo json_encode($data);
  126. session_write_close();
  127. exit();
  128. } elseif ($type == "mailer") {
  129. $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
  130. $data = $this->db->order_by('rand()')->get('mailers')->result();
  131. $mailer_id = $this->db->get('setting')->row()->mailer_id;
  132. $content = "//Mailer List from SpamZone" . "\\\ " . "\n" . "Format: url" . "\n";
  133. $handle = fopen($file_name, "a");
  134. fwrite($handle, $content);
  135. fclose($handle);
  136. $x = 0;
  137. while ($x <= $quantity - 1) {
  138. $string = trim($data[$x]->string);
  139. $id = trim($data[$x]->id);
  140. if (check_url($string, $mailer_id)) {
  141. $handle = fopen($file_name, "a");
  142. $content = $string . "\n";
  143. fwrite($handle, $content);
  144. fclose($handle);
  145. $this->db->where('id', $data[$x]->id);
  146. $this->db->delete('mailers');
  147. $total_sold = $this->db->get('total_sold')->row()->mailer + 1;
  148. $update_total = array("mailer" => $total_sold);
  149. $this->db->update('total_sold', $update_total);
  150. $data = $this->db->order_by('rand()')->get('mailers')->result();
  151. $x += 1;
  152. } else {
  153. $this->db->where('id', $data[$x]->id);
  154. $this->db->delete('mailers');
  155. $data = $this->db->order_by('rand()')->get('mailers')->result();
  156. }
  157. }
  158. $data = array(
  159. "status" => "complete",
  160. "type" => "Cpanel",
  161. "file_name" => $this->session->userdata('file_name')
  162. );
  163. echo json_encode($data);
  164. session_write_close();
  165. exit();
  166. } elseif ($type == "shell") {
  167. $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
  168. $data = $this->db->order_by('rand()')->get('shells')->result();
  169. $shell_id = $this->db->get('setting')->row()->shell_id;
  170. $content = "//Shell List from SpamZone" . "\\\ " . "\n" . "Format: url" . "\n";
  171. $handle = fopen($file_name, "a");
  172. fwrite($handle, $content);
  173. fclose($handle);
  174. $x = 0;
  175. while ($x <= $quantity - 1) {
  176. $string = trim($data[$x]->string);
  177. $id = trim($data[$x]->id);
  178. if (check_url($string, $shell_id)) {
  179. $handle = fopen($file_name, "a");
  180. $content = $string . "\n";
  181. fwrite($handle, $content);
  182. fclose($handle);
  183. $this->db->where('id', $id);
  184. $this->db->delete('shells');
  185. $total_sold = $this->db->get('total_sold')->row()->shell + 1;
  186. $update_total = array("shell" => $total_sold);
  187. $this->db->update('total_sold', $update_total);
  188. $data = $this->db->order_by('rand()')->get('shells')->result();
  189. $x += 1;
  190. } else {
  191. $this->db->where('id', $id);
  192. $this->db->delete('shells');
  193. $data = $this->db->order_by('rand()')->get('shells')->result();
  194. }
  195. }
  196. $data = array(
  197. "status" => "complete",
  198. "type" => "Cpanel",
  199. "file_name" => $this->session->userdata('file_name')
  200. );
  201. echo json_encode($data);
  202. session_write_close();
  203. exit();
  204. }
  205. } else {
  206. //process perfectmoney file generate process
  207. $item = $this->session->userdata('item');
  208. $item_price = $this->db->get('pricing')->row()->$item;
  209. $total_price = $item_price * $this->session->userdata('quantity');
  210. $payment_id = $this->session->userdata('payment_id');
  211. $payee_account = $this->db->get('pm_settings')->row()->PAYEE_ACCOUNT;
  212. $this->db->where('PAYEE_ACCOUNT', $payee_account);
  213. $this->db->where('PAYMENT_ID', $payment_id);
  214. $this->db->where('PAYMENT_AMOUNT', $total_price);
  215. $this->db->where('PAYMENT_UNITS', 'USD');
  216. if ($this->db->get('pm_transactions')->num_rows() == 1) {
  217. $type = $item;
  218. $quantity = $this->session->userdata('quantity');
  219. if ($type == "cpanel") {
  220. $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
  221. $data = $this->db->order_by('rand()')->get('cpanels')->result();
  222. $content = "//Cpanel List from SpamZone" . "\\\ " . "\n" . "Format: url|username|password" . "\n";
  223. $handle = fopen($file_name, "a");
  224. fwrite($handle, $content);
  225. fclose($handle);
  226. $x = 0;
  227. while ($x <= $quantity - 1) {
  228. $string = trim($data[$x]->string);
  229. $id = trim($data[$x]->id);
  230. if (check_cp($string)) {
  231. $handle = fopen($file_name, "a");
  232. $content = $string . "\n";
  233. fwrite($handle, $content);
  234. fclose($handle);
  235. $this->db->where('id', $id);
  236. $this->db->delete('cpanels');
  237. $total_sold = $this->db->get('total_sold')->row()->cpanel + 1;
  238. $update_total = array("cpanel" => $total_sold);
  239. $this->db->update('total_sold', $update_total);
  240. $data = $this->db->order_by('rand()')->get('cpanels')->result();
  241. $x += 1;
  242. } else {
  243. $this->db->where('id', $id);
  244. $this->db->delete('cpanels');
  245. $data = $this->db->order_by('rand()')->get('cpanels')->result();
  246. }
  247. }
  248. $data = array(
  249. "status" => "complete",
  250. "type" => "Cpanel",
  251. "file_name" => $this->session->userdata('file_name')
  252. );
  253. echo json_encode($data);
  254. session_write_close();
  255. exit();
  256. } elseif ($type == "mailer") {
  257. $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
  258. $data = $this->db->order_by('rand()')->get('mailers')->result();
  259. $mailer_id = $this->db->get('setting')->row()->mailer_id;
  260. $content = "//Mailer List from SpamZone" . "\\\ " . "\n" . "Format: url" . "\n";
  261. $handle = fopen($file_name, "a");
  262. fwrite($handle, $content);
  263. fclose($handle);
  264. $x = 0;
  265. while ($x <= $quantity - 1) {
  266. $string = trim($data[$x]->string);
  267. $id = trim($data[$x]->id);
  268. if (check_url($string, $mailer_id)) {
  269. $handle = fopen($file_name, "a");
  270. $content = $string . "\n";
  271. fwrite($handle, $content);
  272. fclose($handle);
  273. $this->db->where('id', $data[$x]->id);
  274. $this->db->delete('mailers');
  275. $total_sold = $this->db->get('total_sold')->row()->mailer + 1;
  276. $update_total = array("mailer" => $total_sold);
  277. $this->db->update('total_sold', $update_total);
  278. $data = $this->db->order_by('rand()')->get('mailers')->result();
  279. $x += 1;
  280. } else {
  281. $this->db->where('id', $data[$x]->id);
  282. $this->db->delete('mailers');
  283. $data = $this->db->order_by('rand()')->get('mailers')->result();
  284. }
  285. }
  286. $data = array(
  287. "status" => "complete",
  288. "type" => "Cpanel",
  289. "file_name" => $this->session->userdata('file_name')
  290. );
  291. echo json_encode($data);
  292. session_write_close();
  293. exit();
  294. } elseif ($type == "shell") {
  295. $file_name = generate_file_create_path() . "/" . $this->session->userdata('file_name') . ".txt";
  296. $data = $this->db->order_by('rand()')->get('shells')->result();
  297. $shell_id = $this->db->get('setting')->row()->shell_id;
  298. $content = "//Shell List from SpamZone" . "\\\ " . "\n" . "Format: url" . "\n";
  299. $handle = fopen($file_name, "a");
  300. fwrite($handle, $content);
  301. fclose($handle);
  302. $x = 0;
  303. while ($x <= $quantity - 1) {
  304. $string = trim($data[$x]->string);
  305. $id = trim($data[$x]->id);
  306. if (check_url($string, $shell_id)) {
  307. $handle = fopen($file_name, "a");
  308. $content = $string . "\n";
  309. fwrite($handle, $content);
  310. fclose($handle);
  311. $this->db->where('id', $id);
  312. $this->db->delete('shells');
  313. $total_sold = $this->db->get('total_sold')->row()->shell + 1;
  314. $update_total = array("shell" => $total_sold);
  315. $this->db->update('total_sold', $update_total);
  316. $data = $this->db->order_by('rand()')->get('shells')->result();
  317. $x += 1;
  318. } else {
  319. $this->db->where('id', $id);
  320. $this->db->delete('shells');
  321. $data = $this->db->order_by('rand()')->get('shells')->result();
  322. }
  323. }
  324. $data = array(
  325. "status" => "complete",
  326. "type" => "Cpanel",
  327. "file_name" => $this->session->userdata('file_name')
  328. );
  329. echo json_encode($data);
  330. session_write_close();
  331. exit();
  332. }
  333. }
  334. }
  335. }
  336. }
  337.  
  338. public function download_file($file) {
  339. $file_name = generate_file_create_path() . "/" . $file . ".txt";
  340. header('Content-Description: File Transfer');
  341. header('Content-Type: application/octet-stream');
  342. header('Content-Disposition: attachment; filename="' . basename($file_name) . '"');
  343. header('Expires: 0');
  344. header('Cache-Control: must-revalidate');
  345. header('Pragma: public');
  346. header('Content-Length: ' . filesize($file_name));
  347. readfile($file_name);
  348. exit();
  349. }
  350.  
  351. //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
  352. //https://api.blockchain.info/v2/receive/balance_update
  353. //curl "https://api.blockchain.info/v2/receive/callback_log?callback=https%3A%2F%2Fmystore.com%3Finvoice_id%3D05892112%26secret%3DZzsMLGKe162CfA5EcG6j&key=[yourkeyhere]"
  354. public function test() {
  355. $my_xpub = $this->db->get('setting')->row()->btc_xpub;
  356. $my_api_key = $this->db->get('setting')->row()->btc_api;
  357. echo $gap_check_url = "https://api.blockchain.info/v2/receive/checkgap?xpub=" . $my_xpub . "&key=" . $my_api_key;
  358. $gap_check_response = file_get_contents($gap_check_url);
  359. $gap_limit = (int) json_decode($gap_check_response)->gap + 2;
  360. echo $gap_check_response;
  361. }
  362.  
  363. public function test1() {
  364. if (!empty($this->input->post('confs'))) {
  365. echo $this->input->post('confs');
  366. } else {
  367. echo "Error";
  368. }
  369. }
  370.  
  371. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement