duanpiangeng8958 2015-10-27 13:04
浏览 26

Android:使用htaccess和htpasswd从php脚本中获取详细信息

I have a php script with this output: enter image description here

And then I display this data in Android. But now, I put a .htaccess and .htpasswd file in the directory and I have to enter a password, if I want to read the data. My question is how can I display the data in Android, now with the files (.htaccess and .htpasswd). Is there a way to enter the password in Android to show the data because now I cant display the data.. Thanks

EDIT:

This is my php script:

<?php

/*
 * Following code will list all the products
 */

// array for JSON response
$response = array();

// include db connect class
require_once __DIR__ . '/db_connect.php';

// connecting to db
$db = new DB_CONNECT();

// get all products from products table
$result = mysql_query("SELECT * FROM users") or die(mysql_error());

// check for empty result
if (mysql_num_rows($result) > 0) {
    // looping through all results
    // products node
    $response["feed"] = array();

    while ($row = mysql_fetch_array($result)) {
        // temp user array
        $feed = array();
        $feed["uid"] = $row["uid"];
        $feed["unique_id"] = $row["unique_id"];
        $feed["name"] = $row["name"];
        $feed["full_name"] = $row["full_name"];
        $feed["email"] = $row["email"];
        $feed["age"] = $row["age"];
        $feed["about_the_customer"] = $row["about_the_customer"];
        $feed["encrypted_password"] = $row["encrypted_password"];
        $feed["salt"] = $row["salt"];
        $feed["created_at"] = strtotime($row["created_at"]);
        $feed["updated_at"] = $row["updated_at"];
        $feed["imageName"] = $row["imageName"];

        // push single product into final response array
        array_push($response["feed"], $feed);
    }
    // success
    $response["success"] = 1;

    // echoing JSON response
    echo json_encode($response);
} else {
    // no products found
    $response["success"] = 0;
    $response["message"] = "No feed found";

    // echo no users JSON
    echo json_encode($response);
}
?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡等级和折扣规则
    • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目
    • ¥20 mysql架构,按照姓名分表
    • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分