Advertisement
Guest User

Untitled

a guest
Sep 15th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.40 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>KingdomlandVN | Thông Tin Giao Dịch</title>
  6. <meta name="description" content="Trang chủ server KingdomlandVN ">
  7. <meta name="author" content="www.kingdomlandvn.com">
  8. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9. <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
  10. <link rel="stylesheet" type="text/css" href="custom/custom-bootstrap.css" />
  11. <link rel="stylesheet" type="text/css" href="custom/font-awesome.css" />
  12. <link href="css/animate.min.css" rel="stylesheet" media="screen">
  13. <meta property="og:locale" content="vi_VN" />
  14. <meta property="og:type" content="website" />
  15. <meta property="og:title" content="Nạp Thẻ KingdomlandVN" />
  16. <meta property="og:url" content="http://kingdomlandvn.com/" />
  17. <meta property="og:site_name" content="KingdomlandVN" />
  18. <link rel="stylesheet" style="text/css" href ="css/bootstrap.min.css">
  19. <link href="css/baokim.css" rel="stylesheet">
  20. </head>
  21. <body>
  22. <div style="text-align: center; margin-top: 80px" class="form-bk">
  23. <h3 class="title">Thông Tin Giao Dịch</h3>
  24. <?php
  25.  
  26. include "../kingdomland/lib/config.php";
  27. session_start();
  28. if (constant("ENABLE_TRANSACTION") == false)
  29. {
  30. message("Hiện tại trang nạp thẻ không thể truy cập ngay lúc này!");
  31. header ("Location: ../index.php");
  32. }
  33.  
  34. if (!isset($_SESSION['user_login']))
  35. {
  36. header("Location: ../index.php");
  37. }
  38.  
  39. header('Content-Type: text/html; charset=utf-8');
  40.  
  41. $seri = isset($_POST['txtseri']) ? $_POST['txtseri'] : '';
  42. $sopin = isset($_POST['txtpin']) ? $_POST['txtpin'] : '';
  43. //Loai the cao (VINA, MOBI, VIETEL, VTC, GATE)
  44. $mang = isset($_POST['chonmang']) ? $_POST['chonmang'] : '';
  45. $user = get_real_name_authme($connect, $_SESSION['user_id_authme'], $mysql);
  46. $uuid = get_uuid_from_authme($connect, $_SESSION['user_id_authme'], $mysql);
  47. $coin_a = get_money_player($connect, $_SESSION['user_id_playerpoint'], $mysql);
  48.  
  49. $card_type = 0;
  50. if ($mang == 92 || $mang == 'MOBI' || $mang == 2) {
  51. $ten = "Mobiphone";
  52. $card_type = 2;
  53. } else if ($mang == 107 || $mang == 'VIETEL' || $mang == 1) {
  54. $ten = "Viettel";
  55. $card_type = 1;
  56. } else if ($mang == 120 || $mang == 'GATE' || $mang == 4) {
  57. $ten = "Gate";
  58. $card_type = 4;
  59. } else if ($mang == 121 || $mang == 'VTC' || $mang == 5) {
  60. $ten = "VTC";
  61. $card_type = 5;
  62. } else if ($mang == 'Vietnamobile' || $mang == 'VNM' || $mang == 10) {
  63. $ten = "VNmobile";
  64. $card_type = 10;
  65. } else {
  66. $ten = "Vinaphone";
  67. $card_type = 3;
  68. }
  69. // lay thong tin tu vippay - muc thong tin ca nhan - tich hop website
  70. $merchant_id = 5058; //API_ID lay trong tich hop website sau khi dang nhạp vippay.vn
  71. $api_user = "650973ff644649f784287a40f1627be6"; //API_USERNAME lay trong tich hop website sau khi dang nhạp vippay.vn
  72. $api_password = "18ea6e7817e64c468ba357b036176433"; //API_PASSWORD lay trong tich hop website sau khi dang nhạp vippay.vn
  73.  
  74. $vippay_api = new Vippay_API();
  75. $vippay_api->setMerchantId($merchant_id);
  76. $vippay_api->setApiUser($api_user);
  77. $vippay_api->setApiPassword($api_password);
  78. $vippay_api->setPin($sopin);
  79. $vippay_api->setSeri($seri);
  80. $vippay_api->setCardType(intval($card_type));
  81. $vippay_api->setNote($user); // Ghi chu cua ban
  82. $vippay_api->cardCharging();
  83. $code = intval($vippay_api->getCode());
  84. $amount = intval($vippay_api->getInfoCard());
  85. $error = $vippay_api->getMsg();
  86.  
  87. date_default_timezone_set('Asia/Ho_Chi_Minh');
  88. $time = time();
  89. //$time = time();
  90.  
  91. function prnt($msg)
  92. {
  93. echo $msg . "<br>";
  94. }
  95. function breakLine()
  96. {
  97. echo "<br>";
  98. }
  99. $status_transaction = false;
  100.  
  101. $xu = "";
  102.  
  103. if ($code === 0 && $amount >= 10000) {
  104.  
  105. $xu = 0;
  106. $status_transaction = "<font style='color:seagreen;'>Thành công</font>";
  107.  
  108. switch($amount) {
  109. case 10000: $xu = 10; break;
  110. case 20000: $xu = 20; break;
  111. case 30000: $xu = 30; break;
  112. case 50000: $xu= 50; break;
  113. case 100000: $xu = 100; break;
  114. case 200000: $xu = 200; break;
  115. case 300000: $xu = 300; break;
  116. case 500000: $xu = 500; break;
  117. case 1000000: $xu = 1000; break;
  118. }
  119. add_money($connect, $mysql, $_SESSION['user_id_playerpoint'], $xu);
  120.  
  121. // Xu ly thong tin tai day
  122. $file = "carddung.log";
  123. $xuall = intval($coin_a) + intval($xu);
  124. $fh = fopen($file,'a') or die("cant open file");
  125. fwrite($fh,"Tai khoan: ".$user.", Loai the: ".$ten.", Menh gia: ".$amount.", Thoi gian: ".$time.", Ma the: {$sopin}, Seri: {$seri}, UUID: {$uuid}, So coin luc nay: {$coin_a}, Xu tong cong: {$xuall}");
  126. fwrite($fh,"\r\n");
  127. fclose($fh);
  128.  
  129.  
  130. }
  131. else{
  132. $status_transaction = "<font style='color:red;'>Không thành công</font>";
  133.  
  134. breakLine();
  135. echo $error . "<br>";
  136.  
  137. $file = "cardsai.log";
  138. $fh = fopen($file,'a') or die("cant open file");
  139. fwrite($fh,"Tai khoan: ".$user.", Ma the: ".$sopin.", Seri: ".$seri.", Noi dung loi: ".$error.", Thoi gian: ".$time);
  140. fwrite($fh,"\r\n");
  141. fclose($fh);
  142. }
  143.  
  144.  
  145. prnt("Loại giao dịch: Nạp vào tài khoản");
  146. prnt("--------------------------------------------------------");
  147. prnt("Tên tài khoản: $user");
  148. prnt("UUID: $uuid");
  149. prnt("Mã thẻ: $sopin");
  150. prnt("Seri: $seri");
  151. prnt("Loại thẻ: $ten");
  152. prnt("Mã giao dịch: ".$result['transaction_id']);
  153. prnt("Trạng thái giao dịch: ".$status_transaction);
  154. prnt("Số Coins lúc trước: ". $coin_a);
  155.  
  156. if ($code === 0 && $amount >= 10000) {
  157. $now_a = intval($coin_a)+intval($xu);
  158. prnt("Hiện tại có: {$now_a}");
  159. prnt("Mệnh giá: " . $amount);
  160. }
  161. prnt("--------------------------------------------------------");
  162. prnt('<span class="glyphicon glyphicon-info-sign"></span> <span style="color: red; font-weight: bold;"> Nếu bạn bị lỗi không nhận được coins<br> khi nạp vui lòng chụp lại ảnh này và gữi<br>về page server (inbox) để được giải quyết.</span>');
  163. prnt('<a target="_Blank"; href="https://www.facebook.com/KingdomlandVN/">Trang Page Server</a>');
  164. breakLine();
  165. breakLine();
  166. prnt("<a href='../''>Trở về trang chủ</a> | <a href='../napthe'>Tiếp tục nạp thẻ</a>");
  167.  
  168. class Vippay_API
  169. {
  170.  
  171. private $merchant_id;
  172. private $pin;
  173. private $seri;
  174. private $card_type;
  175. private $api_user;
  176. private $api_password;
  177. private $code;
  178. private $msg;
  179. private $info_card;
  180. private $transaction_id;
  181. private $note;
  182.  
  183. /**
  184. * @return the $merchant_id
  185. */
  186. public function getMerchantId()
  187. {
  188. return $this->merchant_id;
  189. }
  190.  
  191. /**
  192. * @return the $pin
  193. */
  194. public function getPin()
  195. {
  196. return $this->pin;
  197. }
  198.  
  199. /**
  200. * @return the $seri
  201. */
  202. public function getSeri()
  203. {
  204. return $this->seri;
  205. }
  206.  
  207. /**
  208. * @return the $card_type
  209. */
  210. public function getCardType()
  211. {
  212. return $this->card_type;
  213. }
  214.  
  215. /**
  216. * @return the $api_user
  217. */
  218. public function getApiUser()
  219. {
  220. return $this->api_user;
  221. }
  222.  
  223. /**
  224. * @return the $api_password
  225. */
  226. public function getApiPassword()
  227. {
  228. return $this->api_password;
  229. }
  230.  
  231. /**
  232. * @return the $code
  233. */
  234. public function getCode()
  235. {
  236. return $this->code;
  237. }
  238.  
  239. /**
  240. * @return the $msg
  241. */
  242. public function getMsg()
  243. {
  244. return $this->msg;
  245. }
  246.  
  247. /**
  248. * @return the $info_card
  249. */
  250. public function getInfoCard()
  251. {
  252. return $this->info_card;
  253. }
  254.  
  255. /**
  256. * @return the $transaction_id
  257. */
  258. public function getTransactionId()
  259. {
  260. return $this->transaction_id;
  261. }
  262.  
  263. /**
  264. * @return the $note
  265. */
  266. public function getNote()
  267. {
  268. return $this->note;
  269. }
  270.  
  271. /**
  272. * @param field_type $merchant_id
  273. */
  274. public function setMerchantId($merchant_id)
  275. {
  276. $this->merchant_id = $merchant_id;
  277. }
  278.  
  279. /**
  280. * @param field_type $pin
  281. */
  282. public function setPin($pin)
  283. {
  284. $this->pin = $pin;
  285. }
  286.  
  287. /**
  288. * @param field_type $seri
  289. */
  290. public function setSeri($seri)
  291. {
  292. $this->seri = $seri;
  293. }
  294.  
  295. /**
  296. * @param field_type $card_type
  297. */
  298. public function setCardType($card_type)
  299. {
  300. $this->card_type = $card_type;
  301. }
  302.  
  303. /**
  304. * @param field_type $api_user
  305. */
  306. public function setApiUser($api_user)
  307. {
  308. $this->api_user = $api_user;
  309. }
  310.  
  311. /**
  312. * @param field_type $api_password
  313. */
  314. public function setApiPassword($api_password)
  315. {
  316. $this->api_password = $api_password;
  317. }
  318.  
  319. /**
  320. * @param field_type $code
  321. */
  322. public function setCode($code)
  323. {
  324. $this->code = $code;
  325. }
  326.  
  327. /**
  328. * @param field_type $msg
  329. */
  330. public function setMsg($msg)
  331. {
  332. $this->msg = $msg;
  333. }
  334.  
  335. /**
  336. * @param field_type $info_card
  337. */
  338. public function setInfoCard($info_card)
  339. {
  340. $this->info_card = $info_card;
  341. }
  342.  
  343. /**
  344. * @param field_type $transaction_id
  345. */
  346. public function setTransactionId($transaction_id)
  347. {
  348. $this->transaction_id = $transaction_id;
  349. }
  350.  
  351. /**
  352. * @param field_type $note
  353. */
  354. public function setNote($note)
  355. {
  356. $this->note = $note;
  357. }
  358.  
  359. public function cardCharging()
  360. {
  361. $fields = array(
  362. 'merchant_id' => $this->merchant_id,
  363. 'pin' => $this->pin,
  364. 'seri' => $this->seri,
  365. 'card_type' => $this->card_type,
  366. 'note' => $this->note
  367. );
  368.  
  369. $ch = curl_init("https://vippay.vn/api/api/card");
  370. curl_setopt($ch, CURLOPT_POST, 1);
  371. curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
  372. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  373. curl_setopt($ch, CURLOPT_TIMEOUT, 120);
  374. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  375. curl_setopt($ch, CURLOPT_USERPWD, $this->api_user . ":" . $this->api_password);
  376. $result = curl_exec($ch);
  377. $result = json_decode($result);
  378. $this->code = $result->code;
  379. $this->msg = $result->msg;
  380. $this->info_card = $result->info_card;
  381. $this->transaction_id = $result->transaction_id;
  382. }
  383. }
  384.  
  385. ?>
  386. </div>
  387. </body>
  388. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement