Ejemplo n.º 1
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;
Ejemplo n.º 2
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;
Ejemplo n.º 3
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;