$state = $utilities->clean($_POST['state']); $country = $utilities->clean($_POST['country']); $pincode = $utilities->clean($_POST['pincode']); $phone_number = $utilities->clean($_POST['phone_number']); $country_code = $utilities->clean($_POST['country_code']); $is_default = $utilities->replaceZero($_POST['is_default']); $user_id = $utilities->replaceZero($_POST['user_id']); $log_datetime = $utilities->replaceNow(); $addressId = -1; try { $insertQuery = "INSERT INTO " . " `address` (street_address, landmark, city, state, country, pincode, phone_number, country_code, is_default, user_id, log_datetime) " . " VALUES ('{$street_address}', '{$landmark}', '{$city}', '{$state}', '{$country}', '{$pincode}', '{$phone_number}', '{$country_code}', '{$is_default}', '{$user_id}', '{$log_datetime}')"; $statement = $dbConnection->prepare($insertQuery); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $addressId = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $addressId, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'desc' => 'DB error occured' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;
$utilities = new Utilities(); $response = array(); $name = $utilities->clean($_POST['name']); $area = $utilities->clean($_POST['area']); $pincode = $utilities->clean($_POST['pincode']); $latitude = $utilities->replaceZero($_POST['latitude']); $longitude = $utilities->replaceZero($_POST['longitude']); $log_datetime = $utilities->replaceNow(); $kitchenId = -1; try { $insertQuery = "INSERT INTO " . " `kitchen` (name, area, pincode, latitude, longitude, log_datetime) " . " VALUES ('{$name}', '{$area}', '{$pincode}', '{$latitude}', '{$longitude}', '{$log_datetime}')"; $statement = $dbConnection->prepare($insertQuery); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $kitchenId = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $kitchenId, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'desc' => 'DB error occured' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;
$error = "Exception: " . $e->getMessage(); $response = array('status' => $errorCode, 'data' => array(), 'desc' => 'PDO exception occured' . $error); } } catch (PDOExecption $e) { $errorCode = -8; $error = "Exception: " . $e->getMessage(); $response = array('status' => $errorCode, 'data' => array(), 'desc' => 'PDO exception occured' . $error); } if ($dataReviewd[0]['is_reviewed'] == 0) { try { $insertQuery = "INSERT INTO " . " `likes` (food_item_id, user_id, rating, review, review_detail, log_datetime) " . " VALUES ('{$food_item_id}', '{$user_id}', '{$rating}', '{$review}', '{$review_detail}', '{$log_datetime}')"; $statement = $dbConnection->prepare($insertQuery); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $likeId = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $likeId, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'desc' => 'DB error occured' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;
$item_quantity_price_json = $utilities->clean($_POST['item_quantity_price_json']); $user_id = $utilities->replaceOne($_POST['user_id']); $time_slot_id = $utilities->replaceOne($_POST['time_slot_id']); $status = $utilities->replaceOne($_POST['status']); $date = $utilities->replaceToday($_POST['date']); $address_id = $utilities->replaceZero($_POST['address_id']); $order_type_id = $utilities->replaceZero($_POST['order_type_id']); $log_datetime = $utilities->replaceNow(); $order_id = -1; try { $insertQuery = "INSERT INTO " . " `order` (basket_code, user_id, item_quantity_price_json, time_slot_id, status, date, address_id, log_datetime) " . " VALUES ('{$basket_code}', '{$user_id}', '{$item_quantity_price_json}', '{$time_slot_id}', '{$status}', '{$date}', '{$address_id}', '{$log_datetime}')"; $statement = $dbConnection->prepare($insertQuery); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $order_id = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $order_id, 'basket_code' => $basket_code, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'basket_code' => '', 'desc' => 'DB error occured' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'basket_code' => '', 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;
$statement->execute(); $dataRegPushArray = $statement->fetchAll(PDO::FETCH_ASSOC); $statement->closeCursor(); if ($dataRegPushArray[0]['isPushReg'] == 0) { $insertQuery = "INSERT INTO " . " `push_reg` (user_id, push_reg_token, device_imei, os_id, os_name, datetime) " . " VALUES (:user_id, :push_reg_token, :device_imei, :os_id, :os_name, :datetime);"; $statement = $dbConnection->prepare($insertQuery); $statement->bindParam(":user_id", $userId, PDO::PARAM_INT); $statement->bindParam(":push_reg_token", $push_reg_token, PDO::PARAM_STR); $statement->bindParam(":device_imei", $device_imei, PDO::PARAM_STR); $statement->bindParam(":os_id", $os_id, PDO::PARAM_INT); $statement->bindParam(":os_name", $os_name, PDO::PARAM_STR); $statement->bindParam(":datetime", $dateTime, PDO::PARAM_STR); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $pushRegId = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $pushRegId, 'desc' => 'Success'); } else { $pushRegId = -99; $dbError = $statement->errorInfo(); $response = array('status' => $pushRegId, 'desc' => 'DB error occured: ' . $dbError[2]); } } catch (PDOExecption $e) { $pushRegId = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $pushRegId, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } else { $response = array('status' => 0, 'desc' => 'Push already exists with this IMEI and pus token');
$response = array(); $f_name = $utilities->clean($_POST['f_name']); $l_name = $utilities->clean($_POST['l_name']); $country_code = $utilities->replaceDefaultCountryCode($_POST['country_code']); $phone_number = $utilities->clean($_POST['phone_number']); $image_url = $utilities->clean($_POST['image_url']); $rating = $utilities->replaceZero($_POST['rating']); $log_datetime = $utilities->replaceNow(); $chefId = -1; try { $insertQuery = "INSERT INTO " . " `chef` (f_name, l_name, country_code, phone_number, image_url, rating, log_datetime) " . " VALUES ('{$f_name}', '{$l_name}', '{$country_code}', '{$phone_number}', '{$image_url}', '{$rating}', '{$log_datetime}')"; $statement = $dbConnection->prepare($insertQuery); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $chefId = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $chefId, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'desc' => 'DB error occured' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;
$phone_number = $utilities->clean($_POST['phone_number']); $is_default = $utilities->replaceZero($_POST['is_default']); $user_id = $utilities->clean($_POST['user_id']); $log_datetime = $utilities->replaceNow(); $addressId = -1; try { if ($isUpdate == 0) { $query = "INSERT INTO " . " `address` (street_address, landmark, city, state, country, pincode, phone_number, country_code, is_default, user_id, log_datetime) " . " VALUES ('{$street_address}', '{$landmark}', '{$city}','{$state}', 'country', '{$pincode}', '{$phone_number}', '+91', '{$is_default}', '{$user_id}' ,'{$log_datetime}')"; } else { $query = "UPDATE `address` SET" . " street_address = '{$street_address}', " . " landmark = '{$landmark}', " . " city = '{$city}', " . " state = '{$state}', " . " country = '{$country}', " . " pincode = '{$pincode}', " . " phone_number = '{$phone_number}', " . " country_code = '+91', " . " is_default = '{$is_default}', " . " log_datetime = '{$log_datetime}' " . " WHERE address_id = '{$address_id}';"; } $statement = $dbConnection->prepare($query); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $addressId = $isUpdate == 0 ? $dbConnection->lastInsertId() : $address_id; $dbConnection->commit(); $response = array('status' => $addressId, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'desc' => 'DB error occured' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;
$utilities = new Utilities(); $response = array(); $item_id = $utilities->replaceZero($_POST['item_id']); $serving_id = $utilities->replaceZero($_POST['serving_id']); $available_for = $utilities->replaceZero($_POST['available_for']); $order_count = $utilities->replaceZero($_POST['order_count']); $date = $utilities->replaceZero($_POST['date']); $log_datetime = $utilities->replaceNow(); $itemServingMappingId = -1; try { $insertQuery = "INSERT INTO " . " `item_serving_mapping` (item_id, serving_id, available_for, order_count, date, log_datetime) " . " VALUES ('{$item_id}', '{$serving_id}', '{$available_for}', '{$order_count}', '{$date}', '{$log_datetime}')"; $statement = $dbConnection->prepare($insertQuery); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $itemServingMappingId = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $itemServingMappingId, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'desc' => 'DB error occured' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;
$food_image_5 = $utilities->clean($_POST['food_image_5']); $food_image_6 = $utilities->clean($_POST['food_image_6']); $rating = $utilities->replaceZero($_POST['rating']); $price = $utilities->replaceZero($_POST['price']); $currency_id = $utilities->replaceOne($_POST['currency_id']); $chef_id = $utilities->replaceZero($_POST['chef_id']); $category_id = $utilities->replaceOne($_POST['category_id']); $log_datetime = $utilities->replaceNow(); $foodId = -1; try { $insertQuery = "INSERT INTO " . " `food_item` (name, description, ingredients, preparation_method, nutrition, food_image_1,food_image_2,food_image_3, food_image_4, food_image_5, food_image_6, rating, price, currency_id, chef_id, category_id, log_datetime) " . " VALUES ('{$name}', '{$description}', '{$ingredients}', '{$preparation_method}', '{$nutrition}', '{$food_image_1}', '{$food_image_2}','{$food_image_3}','{$food_image_4}','{$food_image_5}','{$food_image_6}', '{$rating}', '{$price}', '{$currency_id}', '{$chef_id}', '{$category_id}', '{$log_datetime}')"; $statement = $dbConnection->prepare($insertQuery); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $foodId = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $foodId, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'desc' => 'DB error occured' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;
include_once '../classes/Utilities.php'; $dbConnection = new PDOExt(); $utilities = new Utilities(); $response = array(); $user_id = $utilities->replaceZero($_POST['user_id']); $item_d = $utilities->replaceZero($_POST['item_d']); $rating = $utilities->replaceZero($_POST['rating']); $log_datetime = $utilities->replaceNow(); $user_item_rating = -1; try { $insertQuery = "INSERT INTO " . " `user_item_rating` (user_id, item_d, rating, log_datetime) " . " VALUES ('{$user_id}', '{$item_d}', '{$rating}', '{$log_datetime}')"; $statement = $dbConnection->prepare($insertQuery); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $user_item_rating = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $user_item_rating, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'desc' => 'DB error occured' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;
include_once '../classes/PDOExt.php'; include_once '../classes/Utilities.php'; $dbConnection = new PDOExt(); $utilities = new Utilities(); $response = array(); $user_id = $utilities->replaceZero($_POST['user_id']); $item_id = $utilities->replaceZero($_POST['item_id']); $serving_id = $utilities->replaceZero($_POST['serving_id']); $preferredId = -1; try { $insertQuery = "INSERT INTO " . " `preffered_list` (user_id, item_id, serving_id, log_datetime) " . " VALUES ('{$user_id}', '{$item_id}', '{$serving_id}', '{$log_datetime}')"; $statement = $dbConnection->prepare($insertQuery); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $preferredId = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $preferredId, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'desc' => 'DB error occured' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;
foreach ($orderJSONArray as $foodItem) { $subTotalPrice = $foodItem['qunatity'] * $foodItem['price']; $bill_item_count++; array_push($basketQunatityArray, array('item_name' => $foodItem['name'], 'qunatity' => $foodItem['qunatity'], 'unit_price' => $foodItem['price'], 'sub_total_price' => $subTotalPrice)); $totalAmount += $subTotalPrice; } $bill_amount = $totalAmount; $item_quantity_bill_json = json_encode($basketQunatityArray); $billId = -1; try { $insertQuery = "INSERT INTO " . " `bill` (bill_code, bill_amount, bill_discount, bill_total_amount, bill_item_count, bill_pay_through, bill_date, user_name, user_email, user_phone_number, use_delivery_address, basket_code, item_quantity_bill_json, is_bill_payed, log_datetime) " . " VALUES ('{$bill_code}', '{$bill_amount}', '{$bill_discount}','{$bill_total_amount}','{$bill_item_count}','{$bill_pay_through}', '{$bill_date}', '{$user_name}', '{$user_email}', '{$user_phone_number}', '{$use_delivery_address}', '{$basket_code}', '{$item_quantity_bill_json}', '{$is_bill_payed}','{$log_datetime}')"; $statement = $dbConnection->prepare($insertQuery); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $billId = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $billId, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'desc' => 'DB error occured' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;
$error = "Exception: " . $e->getMessage(); $response = array('status' => $errorCode, 'desc' => 'PDO exception occured' . $error); } } catch (PDOExecption $e) { $errorCode = -8; $error = "Exception: " . $e->getMessage(); $response = array('status' => $errorCode, 'desc' => 'PDO exception occured' . $error); } if (count($datauser) == 0) { try { $insertQuery = "INSERT INTO " . " `user` (f_name, l_name, country_code, phone_number, email, image_url, date_of_birth, log_datetime) " . " VALUES ('{$f_name}', '{$l_name}', '{$country_code}', '{$phone_number}', '{$email}', '{$image_url}', '{$date_of_birth}', '{$log_datetime}')"; $statement = $dbConnection->prepare($insertQuery); try { $dbConnection->beginTransaction(); if ($statement->execute()) { $userId = $dbConnection->lastInsertId(); $dbConnection->commit(); $response = array('status' => $userId, 'desc' => 'Success'); } else { $status = -99; $dbError = $statement->errorInfo(); $response = array('status' => $status, 'desc' => 'DB error occured: ' . $dbError[2]); } } catch (PDOExecption $e) { $status = -7; $error = "Exception: " . $e->getMessage(); $response = array('status' => $status, 'desc' => 'PDO exception occured' . $error); } $statement->closeCursor(); } catch (PDOExecption $e) { $status = -8;