Beispiel #1
0
<?php

session_start();
include '../DBBaseTable.php';
$goodsID = '';
if (isset($_POST['goodsID'])) {
    $goodsID = $_POST['goodsID'];
}
if (strlen($goodsID) > 0) {
    $t_reserve = new DBBaseTable("");
    $sql = "SELECT reserve.*, user.username FROM reserve, user WHERE goodsID='" . $goodsID . "' AND reserve.userID = user.uid";
    $result = $t_reserve->query($sql);
    echo json_encode($result);
    exit;
}
echo '{"status":"error"}';
exit;
Beispiel #2
0
<?php

session_start();
include '../DBBaseTable.php';
$userID = '';
if (isset($_POST['userID'])) {
    $userID = $_POST['userID'];
}
if (strlen($userID) == 0 && isset($_SESSION['CURRENT_USER_ID'])) {
    $userID = $_SESSION['CURRENT_USER_ID'];
}
// else{
// 	if not signed in, redirect to login.html
// 	header("Location: ../../index/login.html"); /* Redirect browser */
// 	exit();
// }
if (strlen($userID) > 0) {
    $t = new DBBaseTable("user");
    $result = $t->query_by_id($userID);
    echo json_encode($result);
    exit;
}
echo '{"status":"error"}';
exit;
Beispiel #3
0
// 2015/8/26
include '../DBBaseTable.php';
$userID = '';
if (isset($_POST['userID'])) {
    $userID = $_POST['userID'];
}
if (strlen($userID) == 0 && isset($_SESSION['CURRENT_USER_ID'])) {
    $userID = $_SESSION['CURRENT_USER_ID'];
}
// else{
// 	if not signed in, redirect to login.html
// 	header("Location: ../../index/login.html"); /* Redirect browser */
// 	exit();
// }
if (strlen($userID) > 0) {
    $t_user = new DBBaseTable("user");
    $array = array();
    if (isset($_POST['email'])) {
        $array['email'] = $_POST['email'];
    }
    if (isset($_POST['sex'])) {
        $array['sex'] = $_POST['sex'];
    }
    if (isset($_POST['age'])) {
        $array['age'] = $_POST['age'];
    }
    if (isset($_POST['password'])) {
        $array['password'] = md5($_POST['password']);
    }
    if (isset($_POST['address'])) {
        $array['address'] = $_POST['address'];
Beispiel #4
0
if (isset($_POST['keyword'])) {
    $keyword = $_POST['keyword'];
}
if (isset($_POST['category'])) {
    $category = $_POST['category'];
}
if (strlen($keyword) > 0 && strlen($category) > 0) {
    $t = new DBBaseTable("goods");
    $where = "title LIKE " . "'%" . $keyword . "%' AND category = '" . $category . "'";
    $result = $t->query_by_where($where);
    echo json_encode($result);
    exit;
} elseif (strlen($keyword) > 0) {
    $t = new DBBaseTable("goods");
    $where = "title LIKE " . "'%" . $keyword . "%'";
    $result = $t->query_by_where($where);
    echo json_encode($result);
    exit;
} elseif (strlen($category) > 0) {
    $t = new DBBaseTable("goods");
    $result = $t->query_by_field("category", $category);
    echo json_encode($result);
    exit;
} else {
    $t = new DBBaseTable("goods");
    $result = $t->query_by_nothing();
    echo json_encode($result);
    exit;
}
echo '{"status":"error"}';
exit;
Beispiel #5
0
<?php

session_start();
include '../DBBaseTable.php';
$userID = '';
if (isset($_POST['userID'])) {
    $userID = $_POST['userID'];
}
if (strlen($userID) == 0 && isset($_SESSION['CURRENT_USER_ID'])) {
    $userID = $_SESSION['CURRENT_USER_ID'];
}
// else{
// 	if not signed in, redirect to login.html
// 	header("Location: ../../index/login.html"); /* Redirect browser */
// 	exit();
// }
if (strlen($userID) > 0) {
    $t = new DBBaseTable("goods");
    $result = $t->query_by_field("userID", $userID);
    echo json_encode($result);
    exit;
}
echo '{"status":"error"}';
exit;
Beispiel #6
0
<?php

session_start();
include '../DBBaseTable.php';
$username = '';
$password = '';
if (isset($_POST['username'])) {
    $username = $_POST['username'];
}
if (isset($_POST['password'])) {
    $password = $_POST['password'];
}
if (strlen($username) > 0 && strlen($password) > 0) {
    $t = new DBBaseTable("User");
    $result = $t->query_by_field("username", $username);
    if (count($result) > 0) {
        if ($result[0]['password'] === md5($password)) {
            $_SESSION['CURRENT_USER_ID'] = $result[0]['uid'];
            $_SESSION['CURRENT_USER'] = $result[0]['username'];
            echo '{"status":"success"}';
            exit;
        } else {
            echo '{"status":"error", "message":"password error"}';
            exit;
        }
    }
}
echo '{"status":"error"}';
exit;
Beispiel #7
0
    $userID = $_POST['userID'];
}
if (strlen($userID) == 0 && isset($_SESSION['CURRENT_USER_ID'])) {
    $userID = $_SESSION['CURRENT_USER_ID'];
}
// else{
// 	if not signed in, redirect to login.html
// 	header("Location: ../../index/login.html"); /* Redirect browser */
// 	exit();
// }
if (isset($_POST['category'])) {
    $category = $_POST['category'];
}
if (isset($_POST['photos'])) {
    $photos = $_POST['photos'];
}
if (isset($_POST['description'])) {
    $description = $_POST['description'];
}
if (strlen($title) > 0 && strlen($category) > 0 && strlen($userID) > 0) {
    $t_goods = new DBBaseTable("goods");
    $array = array("title" => $title, "category" => $category, "userID" => $userID, "photos" => $photos, "description" => $description);
    $goodsID = $t_goods->insert_with_array($array);
    if (strlen($goodsID) > 0) {
        /* Or Redirect To Another Page */
        echo '{"status":"success", "goodsID":"' . $goodsID . '"}';
        exit;
    }
}
echo '{"status":"error"}';
exit;
Beispiel #8
0
$goodsID = '';
$reason = '';
if (isset($_POST['userID'])) {
    $userID = $_POST['userID'];
}
if (strlen($userID) == 0 && isset($_SESSION['CURRENT_USER_ID'])) {
    $userID = $_SESSION['CURRENT_USER_ID'];
}
// else{
// 	if not signed in, redirect to login.html
// 	header("Location: ../../index/login.html"); /* Redirect browser */
// 	exit();
// }
if (isset($_POST['goodsID'])) {
    $goodsID = $_POST['goodsID'];
}
if (isset($_POST['reason'])) {
    $reason = $_POST['reason'];
}
if (strlen($userID) > 0 && strlen($goodsID) > 0) {
    $t = new DBBaseTable("reserve");
    $array = array("reason" => $reason, "userID " => $userID, "goodsID" => $goodsID);
    $reserveID = $t->insert_with_array($array);
    if (strlen($reserveID) > 0) {
        /* Or Redirect To Another Page */
        echo '{"status":"success", "reserveID":"' . $reserveID . '"}';
        exit;
    }
}
echo '{"status":"error"}';
exit;
<?php

session_start();
include '../DBBaseTable.php';
$userID = '';
if (isset($_POST['userID'])) {
    $userID = $_POST['userID'];
}
if (strlen($userID) == 0 && isset($_SESSION['CURRENT_USER_ID'])) {
    $userID = $_SESSION['CURRENT_USER_ID'];
}
// else{
// 	if not signed in, redirect to login.html
// 	header("Location: ../../index/login.html"); /* Redirect browser */
// 	exit();
// }
if (strlen($userID) > 0) {
    $t = new DBBaseTable("");
    $sql = "SELECT goods.* FROM goods,reserve WHERE goods.uid = reserve.goodsID and reserve.userID = '" . $userID . "'";
    $result = $t->query($sql);
    echo json_encode($result);
    exit;
}
echo '{"status":"error"}';
exit;
Beispiel #10
0
<?php

include '../DBBaseTable.php';
$t = new DBBaseTable("goods");
// $goodsID ="5A5C23BB387A4A69A145CBD6F30DF12B";
$goodsID = '';
if (isset($_POST['goodsID'])) {
    $goodsID = $_POST['goodsID'];
}
if (strlen($goodsID) > 0) {
    $result = $t->query_by_id($goodsID);
    echo json_encode($result);
    exit;
}
echo '{"status":"error"}';
exit;
Beispiel #11
0
$array = array();
if (isset($_POST['username'])) {
    $array['username'] = $_POST['username'];
}
if (isset($_POST['password'])) {
    $array['password'] = md5($_POST['password']);
}
if (isset($_POST['email'])) {
    $array['email'] = $_POST['email'];
}
if (isset($_POST['sex'])) {
    $array['sex'] = $_POST['sex'];
}
if (isset($_POST['address'])) {
    $array['address'] = $_POST['address'];
}
if (isset($_POST['avatar'])) {
    $array['avatar'] = $_POST['avatar'];
}
if (count($array) > 0) {
    $t_user = new DBBaseTable("user");
    $userID = $t_user->insert_with_array($array);
    if (strlen($userID) > 0) {
        $_SESSION['CURRENT_USER_ID'] = $userID;
        $_SESSION['CURRENT_USER'] = $_POST['username'];
        echo '{"status":"success", "userID":"' . $userID . '"}';
        exit;
    }
}
echo '{"status":"error"}';
exit;