コード例 #1
0
ファイル: blog.php プロジェクト: xudong7930/mobile
     if ($bid == "" || $bid == null) {
         $result = array("status" => "error", "code" => 505, "msg" => "bid field requird");
         throwJSON($result);
         exit;
     }
     $cuid = form_input($_POST['cuid']);
     //评论uid
     if ($cuid == "" || $cuid == null) {
         $result = array("status" => "error", "code" => 505, "msg" => "cuid field requird");
         throwJSON($result);
         exit;
     }
     $message = form_input($_POST['message']);
     if ($message == "" || $message == null) {
         $result = array("status" => "error", "code" => 505, "msg" => "message field requird");
         throwJSON($result);
         exit;
     }
     $cusername = get_username($cuid);
     $ip = get_client_ip();
     $port = get_client_port();
     $home_comment = array("uid" => $uid, "id" => $bid, "idtype" => "blogid", "authorid" => $cuid, "author" => $cusername, "ip" => $ip, "port" => $port, "dateline" => $now, "message" => $message, "magicflicker" => 0, "status" => 0);
     $flag = $db->AutoExecute("disc_home_comment", $home_comment, "INSERT");
     if ($flag) {
         $data = array("status" => "ok", "code" => 200, "msg" => "评论成功");
     } else {
         $data = array("status" => "error", "code" => 505, "msg" => "评论失败");
     }
 } else {
     $data = array("status" => "error", "msg" => "no module to handle this action.");
 }
コード例 #2
0
ファイル: place.php プロジェクト: xudong7930/mobile
        }
        if (!$business_id) {
            return;
        }
        $params = array("out_offset_type" => 1, "platform" => 2, "format" => "json", "business_id" => $business_id);
        //组合成请求URL
        $requestURL = getRequsetURL($appkey, $appSecret, $params, $singleURL);
        //获取搜索结果
        $data = getDianpingJson($requestURL);
        //打印查询结果
        //var_dump($data);
    } else {
        $data = array("status" => "error", "code" => 505, "msg" => "no action to handle this.");
    }
}
throwJSON($data);
/**
 * 执行请求
 * @param  [type] $url [description]
 * @return [type]      [description]
 */
function getDianpingJson($url)
{
    $data = array();
    //适用CURL请求JSON
    $curl = curl_init();
    //初始化curl
    curl_setopt($curl, CURLOPT_URL, $url);
    //设置要访问的地址
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    // 设置cURL 参数,要求结果保存到字符串中还是输出到屏幕上。
コード例 #3
0
ファイル: profile.php プロジェクト: xudong7930/mobile
$data = array();
$now = time();
$act = "list";
if ($_GET['act']) {
    $act = $_GET["act"];
}
if ($act == "sign") {
    //签到
    $uid = form_input($_POST['fromuid']);
    if (isUserExist($uid)) {
        addCredit($uid, "daylogin");
        $credit = getCredit("daylogin");
        throwJSON(array("status" => "ok", "code" => 200, "msg" => "sign success", "credit" => $credit));
        exit;
    } else {
        throwJSON(array("status" => "error", "code" => 301, "msg" => "uid no exist."));
        exit;
    }
} else {
    if ($act == "view") {
        //查看别人的资料  http://51fabu.bj-soft.cn/mobile/profile.php?act=view&fromuid=1&touid=1
        $fuid = htmlspecialchars($_GET["fromuid"]);
        //来自谁
        $tuid = htmlspecialchars($_GET["touid"]);
        //要查看谁的资料
        $sql = "select regdate from disc_common_member where uid='{$tuid}'";
        $res0 = $db->Execute($sql);
        $sql = "select uid, gender,constellation, resideprovince, residecity, residedist,height,interest,birthyear,birthmonth,birthday from disc_common_member_profile where uid='{$tuid}'";
        $res = $db->Execute($sql);
        if ($res->fields['uid']) {
            $sql2 = "select * from disc_common_member where uid='{$tuid}'";