예제 #1
0
파일: card.php 프로젝트: noikiy/mdwp
<?php

/**
 * 会员卡AJAX 请求处理
 * @author abei<*****@*****.**>
 */
require_once dirname(dirname(__FILE__)) . '/app.php';
$action = strval($_GET['action']);
/* 验证账户 */
if ($action == 'checkuser') {
    $username = $_GET['u'];
    $password = $_GET['p'];
    $result = MCard::checkUser($username, $password);
    if ($result) {
        Session::Set('apply_card_real_u', $result['id']);
        $arr_step_1 = array('user_id' => $result['id'], 'create_time' => time(), 'step' => 1);
        DB::Insert('mcard', $arr_step_1);
        $json = array('done' => true);
        echo formatJSON($json);
        die;
    } else {
        //	无信息
        $json = array('done' => false);
        echo formatJSON($json);
        die;
    }
} else {
    if ($action == 'sendsms') {
        $mobile = $_GET['m'];
        $card_user_id = abs(intval($_SESSION['apply_card_real_u']));
        $card = DB::GetTableRow('mcard', array('user_id' => $card_user_id));