function AddMoreCard($add, $userid, $username)
{
    global $empire, $dbtbpre;
    $donum = (int) $add['donum'];
    $cardnum = (int) $add['cardnum'];
    $passnum = (int) $add['passnum'];
    $add[cardfen] = (int) $add[cardfen];
    $add[money] = (int) $add[money];
    $add[carddate] = (int) $add[carddate];
    $add[cdgroupid] = (int) $add[cdgroupid];
    $add[cdzgroupid] = (int) $add[cdzgroupid];
    if (!$donum || !$cardnum || !$passnum || !$add[money]) {
        printerror("EmptyMoreCard", "history.go(-1)");
    }
    //验证权限
    CheckLevel($userid, $username, $classid, "card");
    $cardtime = date("Y-m-d H:i:s");
    //写入卡号
    $no = 1;
    while ($no <= $donum) {
        $card_no = strtolower(no_make_password($cardnum));
        $password = strtolower(no_make_password($passnum));
        $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewscard where card_no='{$card_no}' limit 1");
        if (!$num) {
            $sql = $empire->query("insert into {$dbtbpre}enewscard(card_no,password,cardfen,money,cardtime,endtime,carddate,cdgroupid,cdzgroupid) values('{$card_no}','{$password}',{$add['cardfen']},{$add['money']},'{$cardtime}','{$add['endtime']}',{$add['carddate']},{$add['cdgroupid']},{$add['cdzgroupid']});");
            $no += 1;
        }
    }
    if ($sql) {
        //操作日志
        insert_dolog("cardnum={$donum}&cardfen={$add['cardfen']}&carddate={$add['carddate']}");
        printerror("AddMoreCardSuccess", "AddMoreCard.php");
    } else {
        printerror("DbError", "history.go(-1)");
    }
}
Exemple #2
0
$loginin = $lur['username'];
$loginrnd = $lur['rnd'];
$loginlevel = $lur['groupid'];
$loginadminstyleid = $lur['adminstyleid'];
//ehash
$ecms_hashur = hReturnEcmsHashStrAll();
//验证权限
CheckLevel($logininid, $loginin, $classid, "card");
$enews = ehtmlspecialchars($_GET['enews']);
$time = ehtmlspecialchars($_GET['time']);
$r[money] = 10;
$r[cardfen] = 0;
$r[carddate] = 0;
$r[endtime] = "0000-00-00";
$r[card_no] = time();
$r[password] = strtolower(no_make_password(6));
$url = "<a href=ListCard.php" . $ecms_hashur['whehref'] . ">管理点卡</a> &gt; 增加点卡";
if ($enews == "EditCard") {
    $cardid = (int) $_GET['cardid'];
    $r = $empire->fetch1("select card_no,password,money,cardfen,endtime,carddate,cdgroupid,cdzgroupid from {$dbtbpre}enewscard where cardid='{$cardid}' limit 1");
    $url = "<a href=ListCard.php" . $ecms_hashur['whehref'] . ">管理点卡</a> &gt; 修改点卡:<b>" . $r[card_no] . "</b>";
}
//----------会员组
$sql = $empire->query("select groupid,groupname from {$dbtbpre}enewsmembergroup order by level");
while ($level_r = $empire->fetch($sql)) {
    if ($r[cdgroupid] == $level_r[groupid]) {
        $select = " selected";
    } else {
        $select = "";
    }
    $group .= "<option value=" . $level_r[groupid] . $select . ">" . $level_r[groupname] . "</option>";