$id = @$_POST["id"];
    $catname = @$_POST["catname"];
    $status = @$_POST["status"];
    $template_list = @$_POST["template_list"];
    $template_show = @$_POST["template_show"];
    $pagesize = @$_POST["pagesize"];
    #if
    if (!empty($catname) && !empty($pagesize)) {
        if (empty($template_list)) {
            $template_list = "house_list.html";
        }
        if (empty($template_show)) {
            $template_show = "house_show.html";
        }
        #sql
        $sql = "insert into " . tablePrefix() . "house_category (catname,status,template_list,template_show,pagesize) values (?,?,?,?,?)";
        $sql_data = array($catname, $status, $template_list, $template_show, $pagesize);
        if (!empty($id)) {
            $sql = "update " . tablePrefix() . "house_category set catname=?,status=?,template_list=?,template_show=?,pagesize=? where id = ?";
            $sql_data[] = $id;
        }
        #execute
        _execute($sql, $sql_data);
        #tishi
        $error = "操作成功";
    } else {
        $error = "操作失败,缺少必要参数";
    }
    include_once getTPL("tishi");
    exit;
}
//status
if (!empty($type) && $type == "status") {
    #param
    $status = @$_GET["status"];
    $id = @$_GET["id"];
    #update
    if (!empty($id)) {
        if ($status != null && $status == "0") {
            $status = 1;
        } else {
            $status = 0;
        }
        $sql = "update " . tablePrefix() . "house_village set status =? where id = ?";
        _execute($sql, array($status, $id));
        $error = "操作成功";
    } else {
        $error = "操作失败,缺少必要参数";
    }
    #tpl
    include_once getTPL("tishi");
    exit;
}
//edit
if (!empty($type) && $type == 'edit') {
    #地区
    $sql_dq = "select id,name,parent_id from " . tablePrefix() . "house_area where status= 0 order by id asc";
    $arr_dq = _select($sql_dq);
    #tpl
    include_once getTPL("house_village-edit");
    exit;
}
Exemple #3
0
#logout
$error = "";
if (!empty($type) && $type == "logout") {
    $error = "用户已退出,请重新登录";
}
#timeout
if (!empty($type) && $type == 'timeout') {
    $error = "用户认证超时,请重新登录";
}
#login
$status = 0;
if (!empty($type) && $type == "login") {
    $username = @$_POST['username'];
    $password = @$_POST['password'];
    if (!empty($username) && !empty($password)) {
        $sql = "select * from " . tablePrefix() . "user where username=? and status=1 limit 1";
        $res = _select($sql, array($username));
        if (!empty($res) && count($res) > 0) {
            $user = $res[0];
            $user_pwd = $user['password'];
            if (md5($password) == $user_pwd) {
                $_SESSION['user'] = $user;
                //session
                $error = "登录成功,正在跳转";
                $status = 1;
            } else {
                $error = "密码错误,请检查密码填写";
                $status = 0;
            }
        } else {
            $error = "登录失败,未找到该用户";
Exemple #4
0
        }
        # insert thumbs to $id
        if (!empty($id) && !empty($thumbs)) {
            $sql2 = "insert into " . tablePrefix() . "thumbs (refer_id,refer_table,url,createtime) values";
            $arr = explode(",", $thumbs);
            for ($i = 0; $i < count($arr); $i++) {
                if ($i == count($arr) - 1) {
                    $sql2 .= " (" . $id . ",'house','" . $arr[$i] . "'," . time() . ")";
                } else {
                    $sql2 .= " (" . $id . ",'house','" . $arr[$i] . "'," . time() . "),";
                }
            }
            _execute($sql2);
            $error = "操作成功";
        }
    } else {
        $error = "操作失败,缺少必要参数";
    }
    include_once getTPL("tishi");
    exit;
}
//delete
if (!empty($type) && $type == "delete") {
    $id = @$_GET["id"];
    #sql
    $sql = "update " . tablePrefix() . "house set status=1 where id=?";
    #execute
    _execute($sql, array($id));
    include_once getTPL("tishi");
    exit;
}