<?php

include_once "config.php";
$query = "SELECT * FROM permissions";
$result = mysql_query($query) or die(mysql_error());
$str = formatJSON($result);
echo $str;
Example #2
0
File: card.php Project: noikiy/mdwp
 */
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));
        $code = mt_rand(1000, 9999);
        DB::Update('mcard', $card['id'], array('code' => $code));
        sms_mcard_secret($mobile, $code);
    }
}
Example #3
0
File: ajax.php Project: noikiy/mdwp
 * ----------------------------------------------------------------------------

 * This is not free software

 * ----------------------------------------------------------------------------

 * @author abei <*****@*****.**>

 * @version 1.0

 * @link http://www.qiang8.cn

 * @return $json = array('done'=>false,'error'=>null,'code'=>0,'data'=>null);

 */

require_once (dirname(dirname(__FILE__)) . '/app.php');

$action = $_GET['action'];

/**

 * Get child category of father

 */

if ($action == 'getcatlist') {

	$cat_id = $_GET['id'];

	$childCatList = DB::LimitQuery('category', array('condition' => array('fid' => $cat_id), ));
Example #4
0
<?php

include_once "config.php";
$query = "SELECT * FROM users WHERE username='******'username']}' AND password ='******'password']}'";
$result = mysql_query($query);
$login = formatJSON($result);
if ($login == '[]') {
    echo false;
} else {
    echo $login;
}
die;
Example #5
0
<?php

include_once "config.php";
$id = $_POST;
//initialize
$content_list_q = "SELECT cid,catid FROM content";
$content_list_rs = mysql_query($content_list_q) or die(mysql_error());
$content_list = json_decode(formatJSON($content_list_rs), true);
$cat_list_q = "SELECT tbid,parent FROM category";
$cat_list_rs = mysql_query($cat_list_q) or die(mysql_error());
$cat_list = json_decode(formatJSON($cat_list_rs), true);
$cat_tree = createTree($cat_list, 0);
$deleteAbleArray = getDeletePortion($cat_tree, $id['id']);
processDeleteWithCOntent($deleteAbleArray);
die;
//create tree
function createTree($data = array(), $parent = 0)
{
    $tree = array();
    foreach ($data as $index => $value) {
        if ($value['parent'] == $parent) {
            $children = createTree($data, $value['tbid']);
            if (!empty($children)) {
                $value['children'] = $children;
            }
            $tree[] = $value;
        }
    }
    return $tree;
}
//get delete portion