Beispiel #1
0
function CardGetFen($username, $reusername, $card_no, $password)
{
    global $empire, $dbtbpre;
    $card_no = RepPostVar($card_no);
    $password = RepPostVar($password);
    $username = RepPostVar($username);
    if (!trim($username) || !trim($card_no) || !trim($password)) {
        printerror("EmptyGetCard", "history.go(-1)", 1);
    }
    if ($username != $reusername) {
        printerror("DifCardUsername", "history.go(-1)", 1);
    }
    $user = $empire->fetch1("select " . eReturnSelectMemberF('userid,userdate,username') . " from " . eReturnMemberTable() . " where " . egetmf('username') . "='{$username}' limit 1");
    if (!$user['userid']) {
        printerror("ExiestCardUsername", "history.go(-1)", 1);
    }
    $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewscard where card_no='" . $card_no . "' and password='******' limit 1");
    if (!$num) {
        printerror("CardPassError", "history.go(-1)", 1);
    }
    //是否过期
    $buytime = date("Y-m-d H:i:s");
    $r = $empire->fetch1("select cardfen,money,endtime,carddate,cdgroupid,cdzgroupid from {$dbtbpre}enewscard where card_no='{$card_no}' limit 1");
    if ($r[endtime] != "0000-00-00") {
        $endtime = to_date($r[endtime]);
        if ($endtime < time()) {
            printerror("CardOutDate", "history.go(-1)", 1);
        }
    }
    //充值
    eAddFenToUser($r[cardfen], $r[carddate], $r[cdgroupid], $r[cdzgroupid], $user);
    $sql1 = $empire->query("delete from {$dbtbpre}enewscard where card_no='{$card_no}'");
    //删除卡号
    //备份购买记录
    BakBuy($user['userid'], $username, $card_no, $r[cardfen], $r[money], $r[carddate], 0);
    printerror("CardGetFenSuccess", "../member/card/", 1);
}
Beispiel #2
0
function PayApiBuyGroupPay($bgid, $money, $orderid, $userid, $username, $groupid, $ecms_paytype)
{
    global $empire, $dbtbpre, $level_r;
    $bgid = (int) $bgid;
    $userid = (int) $userid;
    $username = RepPostVar($username);
    $groupid = (int) $groupid;
    $ecms_paytype = RepPostVar($ecms_paytype);
    //验证是否重复提交
    $orderid = RepPostVar($orderid);
    $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewspayrecord where orderid='{$orderid}' limit 1");
    if ($num) {
        printerror('您已成功充值', '../../../', 1, 0, 1);
    }
    $buyr = $empire->fetch1("select * from {$dbtbpre}enewsbuygroup where id='{$bgid}'");
    if ($buyr['id'] && $money == $buyr['gmoney'] && $level_r[$buyr[buygroupid]][level] <= $level_r[$groupid][level]) {
        $money = (double) $money;
        //充值
        $user = $empire->fetch1("select " . eReturnSelectMemberF('userdate,userid,username') . " from " . eReturnMemberTable() . " where " . egetmf('userid') . "='{$userid}'");
        eAddFenToUser($buyr['gfen'], $buyr['gdate'], $buyr['ggroupid'], $buyr['gzgroupid'], $user);
        $posttime = date("Y-m-d H:i:s");
        $payip = egetip();
        $paybz = "充值类型:" . addslashes($buyr['gname']);
        $paybz = RepPostStr($paybz);
        $empire->query("insert into {$dbtbpre}enewspayrecord(id,userid,username,orderid,money,posttime,paybz,type,payip) values(NULL,'{$userid}','{$username}','{$orderid}','{$money}','{$posttime}','{$paybz}','{$ecms_paytype}','{$payip}');");
        //备份充值记录
        BakBuy($userid, $username, $buyr['gname'], $buyr['gfen'], $money, $buyr['gdate'], 1);
    }
    printerror('您已成功充值', '../../../', 1, 0, 1);
}