Esempio n. 1
0
<?php

if (!defined('iBUAA')) {
    exit('Access Denied');
}
$op = empty($_GET['op']) ? "view" : $_GET['op'];
$mid = empty($_GET['mid']) ? '' : trim($_GET['mid']);
if (!checkperm('allowmagic')) {
    ckspacelog();
    showmessage('magic_groupid_not_allowed');
    //您所在的用户组被禁止使用道具
}
//获得道具
$magic = $mid ? magic_get($mid) : array();
//提交购买
if (submitcheck("buysubmit")) {
    //购买
    if (!$mid) {
        showmessage('unknown_magic');
    }
    //获得道具信息
    $results = magic_buy_get($magic);
    extract($results);
    //购买道具
    $charge = magic_buy_post($magic, $magicstore, $coupon);
    if ($magic['experience']) {
        showmessage('magicbuy_success_with_experence', $_POST['refer'], 0, array($charge, $magic['experience'] * intval($_POST['buynum'])));
    } else {
        showmessage('magicbuy_success', $_POST['refer'], 0, array($charge));
    }
} elseif (submitcheck("presentsubmit")) {
Esempio n. 2
0
if (empty($_SGLOBAL['supe_uid'])) {
    showmessage('to_login', 'do.php?ac=' . $_SCONFIG['login_action']);
}
//站点关闭
checkclose();
//MID检查
if (empty($mid)) {
    showmessage('unknown_magic');
}
//获取空间信息
$space = getspace($_SGLOBAL['supe_uid']);
if (empty($space)) {
    showmessage('space_does_not_exist');
}
//获得道具
$magic = magic_get($mid);
//是否拥有该道具
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname("usermagic") . " WHERE uid='{$_SGLOBAL['supe_uid']}' AND mid='{$mid}'");
$usermagic = $_SGLOBAL['db']->fetch_array($query);
if (empty($usermagic['count'])) {
    $op = 'buy';
}
//提交购买
$frombuy = false;
if (submitcheck('buysubmit')) {
    //获得道具信息
    $results = magic_buy_get($magic);
    extract($results);
    //购买道具
    magic_buy_post($magic, $magicstore, $coupon);
    $op = 'use';