仰望星辰工作室

better-staridc-MNBT

better-staridc-MNBT/ user/pay.php 2.2 KB · 51 行 原始文件
Z zfhsh first commit 1 天前
1<?php
2@header('Content-Type: text/html; charset=UTF-8');
3include("../MPHX/common.php");
4if($islogins==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
5
6// V1.81 P3: 支付方式 type 格式为 {plugin}__{method},如 epay__alipay
7$type = isset($_POST['type']) ? $_POST['type'] : '';
8if ($type === '' || !function_exists('mnbt_pay_parse_type') || !mnbt_pay_parse_type($type)) {
9 exit("<script language='javascript'>alert('请选择有效的支付方式');history.go(-1);</script>");
10}
11
12if($_POST['pay_lx']=='yjbs'){
13$bs_id=daddslashes($_POST['id']);
14$bs_cx = $DB->get_row_prepare("SELECT * FROM `MN_bs` WHERE `id` = ? limit 1", [$bs_id]);
15}else{
16// ymgm(域名购买)已迁移至 domain_shop 插件,由 index.php?_r=/domain/buy 路由处理
17exit('404 NOT!');
18}
19$out_trade_no = date("YmdHis").mt_rand(100,999);
20$name = 'MNBT订单支付支付';
21$money = $bs_cx['jg'];
22$dada = date("Y-m-d H-i-s");
23$ip = $_SERVER["REMOTE_ADDR"] ?? '127.0.0.1';
24
25if($_POST['pay_lx']=='yjbs'){
26//一键部署
27if($bs_cx['qk']==false)exit("<script language='javascript'>alert('该程序已下架!');history.go(-1);</script>");
28if(in_array($yhc['user'],json_decode($bs_cx['tj'],true)))exit("<script language='javascript'>alert('您已购买该程序!');history.go(-1);</script>");
29$cs=json_encode(array('user'=>$yhc['user'],'gmid'=>$_POST['id']),256); //user:购买该程序的主机账号;gmid:部署程序的id
30$row1=$DB->get_row_prepare("SELECT * FROM MN_dd WHERE 1 order by id desc limit 1");
31$id = $row1['id']+1;
32$DB->query_prepare("INSERT INTO `MN_dd` (`id`, `cs`, `date`, `zffs`, `je`, `ddh`, `lx`, `qk`, `ip`) VALUES (?,?,?,?,?,?,?,?,?)", [$id, $cs, $date, $type, $money, $out_trade_no, 'yjbs', 'false', $ip]);
33
34}else{exit('404 NOT!');}
35
36// V1.81 P3: 分发到支付插件
37$order_context = array(
38 'out_trade_no' => $out_trade_no,
39 'name' => $name,
40 'money' => $money,
41 'type' => $type,
42 'siteurl' => $siteurl,
43 'pay_lx' => $_POST['pay_lx'],
44);
45
46$html = mnbt_pay_dispatch_gateway($type, $order_context);
47if ($html === false) {
48 exit("<script language='javascript'>alert('支付方式不可用,请检查支付插件是否已启用');history.go(-1);</script>");
49}
50echo $html;
51?>