Merge branch 'erwin_branch'

This commit is contained in:
webdeveloper 2024-02-15 21:09:36 +08:00
commit d9a4ccfd15
73 changed files with 252 additions and 261 deletions

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
// $_SESSION["company"] = $_POST["company"];
// $_SESSION["firstname"] = $_POST["company"];
// $_SESSION["phone"] = $_POST["phonenumber"];

5
admin/config.php Normal file
View File

@ -0,0 +1,5 @@
<?php
$_SESSION["is_test"]=true;
$_SESSION["test_email_rcpt"]="egalang@premiummegastructures.com";
$_SESSION["data_endpoint"]="api.obanana.shop";
?>

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
if ($_SESSION["isLoggedIn"] == true and $_SESSION["user_type"] == "admin"){
header("location: index.php");
}

View File

@ -1,5 +1,5 @@
<?php
session_start();
session_unset();
session_destroy();
header("location: login.php")

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -959,7 +959,7 @@ $allorders = json_encode($orders, true);
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
function login(username, password, callback) {
fetch("https://api.obanana.shop/api/v1/login", {
fetch("https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -1029,7 +1029,7 @@ $allorders = json_encode($orders, true);
// Define your functions here
function toReceiveFunction(orderId, reason, image, token) {
// const token = '<?php echo $_SESSION["token"] ?>';
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
@ -1057,7 +1057,7 @@ $allorders = json_encode($orders, true);
}
function refundCompleteFunction(orderId, reason, image, token) {
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$vendorId = $_POST['vendor_api_id'];
$productName = $_POST['product_name'];

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$vendorId = $_SESSION['vendorId'];
//echo '$vendorId: '.$vendorId.'<br>';
$productName = $_POST['product_name'];

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
?>
<!DOCTYPE html>

View File

@ -1,7 +1,8 @@
<?php
include "../functions.php";
$productId = $_GET['id'];
$curl = curl_init();
$url = 'https://api.obanana.shop/api/v1/products/'.$productId;
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/".$productId;
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt_array($curl, array(
//CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/656717579624f6181c49cdda',

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$productId = $_SESSION['productId'];
$vendorId = $_SESSION['vendorId'];
//echo '$vendorId: '.$vendorId.'<br>';

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
$vendorId = $_SESSION["vendorId"];
if ($_SESSION["userId"] <> "") {
@ -1046,7 +1046,7 @@ $vendorId = $_SESSION["vendorId"];
formData.append('category', 'product');
formData.append('image', resizedFile);
fetch('https://api.obanana.shop/api/v1/upload_image', {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
@ -1062,12 +1062,12 @@ $vendorId = $_SESSION["vendorId"];
const filename = result.filename;
const payload = {
product_image: `https://api.obanana.shop/images/storage/product_uploads/${filename}`,
product_image: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/product_uploads/${filename}`,
};
console.log('Payload:', payload);
const token = '<?php echo $_SESSION["token"] ?>';
return fetch('https://api.obanana.shop/api/v1/products/' + productId, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/' + productId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -928,7 +928,7 @@ if($_SESSION["user_type"]!="admin"){
formData.append('category', 'product');
formData.append('image', file);
fetch('https://api.obanana.shop/api/v1/upload_image', {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
@ -947,7 +947,7 @@ if($_SESSION["user_type"]!="admin"){
const filename = result.filename;
const payload = {
product_image: `https://api.obanana.shop/images/storage/product_uploads/${filename}`,
product_image: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/product_uploads/${filename}`,
vendor_api_id: vendor,
product_name: updatedName,
stock: updatedStock,
@ -963,7 +963,7 @@ if($_SESSION["user_type"]!="admin"){
console.log('Payload:', payload);
// Make another API request using the extracted filename
return fetch('https://api.obanana.shop/api/v1/products/' + productId, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/' + productId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -988,7 +988,7 @@ if($_SESSION["user_type"]!="admin"){
}
else {
// If no file selected, only update the email
fetch('https://api.obanana.shop/api/v1/products/' + productId, {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/' + productId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'

View File

@ -1,5 +1,5 @@
<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$input = json_decode(file_get_contents('php://input'), true);

View File

@ -1,3 +1,4 @@
<?php include "../functions.php"; ?>
<!DOCTYPE html>
<html>
@ -169,7 +170,7 @@ function getAllProducts()
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/search?q=',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -194,7 +195,7 @@ function getAllUsers()
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/users',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,

View File

@ -1,4 +1,5 @@
<?php
include "../functions.php";
$id = $_GET['id'];
$users = getAllUsers($id);
$users = array_values($users);
@ -76,7 +77,7 @@ function getAllUsers($id)
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/users',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -108,7 +109,7 @@ function getAllProducts()
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/search?q=',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$id = $_POST['_id'];
$username = $_POST['username'];
$userType = $_POST['user_type'];

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -762,7 +762,7 @@ $users = getUsers();
}
function login(username, password, sessionToken, callback) {
fetch("https://api.obanana.shop/api/v1/login", {
fetch("https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/login", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -892,7 +892,7 @@ function deleteVendor(vendorId){
formData.append('category', 'vendor');
formData.append('image', file);
fetch('https://api.obanana.shop/api/v1/upload_image', {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
@ -908,7 +908,7 @@ function deleteVendor(vendorId){
const filename = result.filename;
const payload = {
vendor_image: `https://api.obanana.shop/images/storage/vendor_uploads/${filename}`,
vendor_image: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/vendor_uploads/${filename}`,
user_login: updatedUser,
first_name: firstName,
last_name: lastName,
@ -927,7 +927,7 @@ function deleteVendor(vendorId){
};
// Make another API request using the extracted filename
return fetch('https://api.obanana.shop/api/v1/vendors/' + vendorId, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -948,7 +948,7 @@ function deleteVendor(vendorId){
});
} else {
// If no file selected, only update the email
fetch('https://api.obanana.shop/api/v1/vendors/' + vendorId, {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -992,7 +992,7 @@ function deleteVendor(vendorId){
var email = emailInput.value;
if (email.trim() !== '') {
return fetch('https://api.obanana.shop/api/v1/vendors/search?q=' + email)
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/search?q=' + email)
.then(response => {
if (response.ok) {
return response.json();
@ -1301,7 +1301,7 @@ function deleteVendor(vendorId){
if (email.trim() !== '') {
var response;
$.ajax({
url: 'https://api.obanana.shop/api/v1/vendors/search?q=' + email,
url: 'https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/search?q=' + email,
method: 'GET',
success: function(data) {
response = data;

View File

@ -1,10 +1,10 @@
<?php
session_start();
include "../functions.php";
$urlCurrent = $_SESSION["url"];
$vendorId = $_GET['id'];
$curl = curl_init();
$url = 'https://api.obanana.shop/api/v1/vendors/'.$vendorId;
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/".$vendorId;
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
$vendorId = $_SESSION["vendorId"];
?>
@ -1102,7 +1102,7 @@ $vendorId = $_SESSION["vendorId"];
formData.append('category', 'product');
formData.append('image', file);
fetch('https://api.obanana.shop/api/v1/upload_image', {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
@ -1121,7 +1121,7 @@ $vendorId = $_SESSION["vendorId"];
const filename = result.filename;
const payload = {
product_image: `https://api.obanana.shop/images/storage/product_uploads/${filename}`,
product_image: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/product_uploads/${filename}`,
vendor_api_id: vendor,
product_name: updatedName,
stock: updatedStock,
@ -1137,7 +1137,7 @@ $vendorId = $_SESSION["vendorId"];
console.log('Payload:', payload);
// Make another API request using the extracted filename
return fetch('https://api.obanana.shop/api/v1/products/' + productId, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/' + productId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -1161,7 +1161,7 @@ $vendorId = $_SESSION["vendorId"];
});
} else {
// If no file selected, only update the email
fetch('https://api.obanana.shop/api/v1/products/' + productId, {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/' + productId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
$vendorId = $_SESSION["vendorId"];
if ($_SESSION["userId"] <> "") {
@ -777,7 +777,7 @@ if($_SESSION["user_type"]!="admin"){
}
function login(username, password, callback) {
fetch("https://api.obanana.shop/api/v1/login", {
fetch("https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/login", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
if(isset($_SESSION["vendorId"])){
if(isset($_GET["id"])){
$_SESSION["vendorId"]=$_GET["id"];

View File

@ -1,6 +1,6 @@
<?php
include "../functions.php";
session_start();
$email = $_POST['user_email'];
$phone = $_POST['phone'];
$company = $_POST['first_name'];

View File

@ -3,7 +3,7 @@
use Symfony\Component\VarDumper\VarDumper;
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -255,7 +255,7 @@ if ($_SESSION["userId"] <> "") {
function handleQtyInputCart(input, orderId, itemId, prodId) {
var newQuantity = parseInt(input.value);
// updateQuantityCart(orderId, itemId, newQuantity);
fetch(`https://api.obanana.shop/api/v1/products/${prodId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/${prodId}`, {
method: 'GET'
})
@ -301,7 +301,7 @@ if ($_SESSION["userId"] <> "") {
}
function qtyIncrementCart(orderId, itemId, isFloat, prodId) {
fetch(`https://api.obanana.shop/api/v1/products/${prodId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/${prodId}`, {
method: 'GET'
})
@ -352,7 +352,7 @@ if ($_SESSION["userId"] <> "") {
function qtyDecrementCart(orderId, itemId, isFloat, prodId) {
console.log('decrementing')
fetch(`https://api.obanana.shop/api/v1/products/${prodId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/${prodId}`, {
method: 'GET'
})
@ -408,7 +408,7 @@ if ($_SESSION["userId"] <> "") {
function updateQuantityCart(orderId, itemId, newQuantity, isFloat) {
console.log(isFloat)
const token = '<?php echo $_SESSION["token"] ?>';
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}/items/${itemId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}/items/${itemId}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
@ -441,7 +441,7 @@ if ($_SESSION["userId"] <> "") {
function updateFloatTotalAmountCart(orderId) {
// Fetch the order data
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`)
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`)
.then(response => response.json())
.then(orderData => {
console.log("This is the OrderData: " + JSON.stringify(orderData, null, 2));
@ -457,7 +457,7 @@ if ($_SESSION["userId"] <> "") {
// Perform the PATCH request to update the total amount in the API
const token = '<?php echo $_SESSION["token"] ?>';
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
@ -487,7 +487,7 @@ if ($_SESSION["userId"] <> "") {
function updateTotalAmountCart(orderId) {
// Fetch the order data
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`)
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`)
.then(response => response.json())
.then(orderData => {
if (orderData && orderData !== "") {
@ -504,7 +504,7 @@ if ($_SESSION["userId"] <> "") {
// Perform the PATCH request to update the total amount in the API
const token = '<?php echo $_SESSION["token"] ?>';
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
@ -534,7 +534,7 @@ if ($_SESSION["userId"] <> "") {
function getLatestOrdersCart() {
var customerId = '<?php echo $customer['_id'] ?>'
// Fetch the order data
fetch(`https://api.obanana.shop/api/v1/orders/customer/${customerId}`)
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/customer/${customerId}`)
.then(response => response.json())
.then(orderData => {
if (orderData && orderData !== "") {
@ -563,7 +563,7 @@ if ($_SESSION["userId"] <> "") {
function deleteOrderCart(orderId) {
console.log('delete')
fetch('https://api.obanana.shop/api/v1/orders/' + orderId, {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/' + orderId, {
method: 'DELETE'
})
.then(response => response.json())

View File

@ -3,7 +3,7 @@
use Symfony\Component\VarDumper\VarDumper;
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,37 +1,9 @@
<?php
session_start();
echo "user_type : ".$_SESSION['user_type']."<br>";
echo "email : ".$_SESSION["email"]."<br>";
echo "password : ".$_SESSION["password"]."<br>";
echo "firstname : ".$_SESSION["firstname"]."<br>";
echo "lastname : ".$_SESSION["lastname"]."<br>";
echo "company : ".$_SESSION["company"]."<br>";
echo "phone : ".$_SESSION["phone"]."<br>";
if($_SESSION["isCustomer"]){
echo "isCustomer : true<br>";
} else {
echo "isCustomer : false<br>";
}
echo "customerId : ".$_SESSION["customerId"]."<br>";
if($_SESSION["isVendor"]){
echo "isVendor : true<br>";
} else {
echo "isVendor : false<br>";
}
echo "vendorId : ".$_SESSION["vendorId"]."<br>";
echo "otp : ".$_SESSION["otp"]."<br>";
echo "token : ".$_SESSION["token"]."<br>";
echo "userId : ".$_SESSION["userId"]."<br>";
if($_SESSION["isLoggedIn"]){
echo "isLoggedIn : true<br>";
} else {
echo "isLoggedIn : false<br>";
}
echo "url : ".$_SESSION["url"]."<br>";
echo "cartitems : ".count($_SESSION["cart_items"])."<br>";
echo "productId : ".$_SESSION["productId"]."<br>";
if (isset($_SESSION["LoggedInVendorId"])) {
echo "LoggedInVendorId: " . $_SESSION["LoggedInVendorId"] . "<br>";
}
?>
<?php
include "functions.php";
if($_SESSION["is_test"]==true){
echo '<pre>';
var_dump($_SESSION);
echo '</pre>';
}else{
echo "<h1>Alert! This only works in test mode.</h1>";
}

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -489,7 +489,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
$('#submitBtn').on('click', function() {
// Retrieve existing addresses from the API
// fetch('https://api.obanana.shop/api/v1/customers/65482e8d209ff8d348bd30fd')
fetch('https://api.obanana.shop/api/v1/customers/' + customerId)
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId)
.then(response => response.json())
.then(data => {
// Get the existing addresses array
@ -524,7 +524,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
existingAddresses.push(newAddress);
// Make a PATCH request to update the addresses array
return fetch('https://api.obanana.shop/api/v1/customers/' + customerId, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -892,7 +892,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
ordersToUpdate.forEach(async (orderId) => {
// console.log(orderId)
const patchResponse = await fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
const patchResponse = await fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: "PATCH",
body: JSON.stringify({
// shipping_address:{
@ -947,7 +947,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
ordersToUpdate.forEach(async (orderId) => {
// console.log(orderId)
const patchResponse = await fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
const patchResponse = await fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: "PATCH",
body: JSON.stringify({
shipping_address: {

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -490,7 +490,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
$('#submitBtn').on('click', function() {
// Retrieve existing addresses from the API
// fetch('https://api.obanana.shop/api/v1/customers/65482e8d209ff8d348bd30fd')
fetch('https://api.obanana.shop/api/v1/customers/' + customerId)
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId)
.then(response => response.json())
.then(data => {
// Get the existing addresses array
@ -525,7 +525,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
existingAddresses.push(newAddress);
// Make a PATCH request to update the addresses array
return fetch('https://api.obanana.shop/api/v1/customers/' + customerId, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -937,7 +937,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
console.log(orderId)
const token = '<?php echo $_SESSION["token"] ?>';
const shippingfee = parseFloat(orderId.shipping_fee)
const patchResponse = await fetch(`https://api.obanana.shop/api/v1/orders/${orderId._id}`, {
const patchResponse = await fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId._id}`, {
method: "PATCH",
body: JSON.stringify({
shipping_address: {
@ -1020,7 +1020,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
console.log(orderId)
const token = '<?php echo $_SESSION["token"] ?>';
const shippingfee = parseFloat(orderId.shipping_fee)
const patchResponse = await fetch(`https://api.obanana.shop/api/v1/orders/${orderId._id}`, {
const patchResponse = await fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId._id}`, {
method: "PATCH",
body: JSON.stringify({
shipping_address: {

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$fName = $_POST['firstname'];
$lName = $_POST['lastname'];
$email = $_POST['email'];

View File

@ -1,5 +1,5 @@
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
@ -181,7 +181,7 @@ var pass2I = document.getElementById(`passInput2`);
var email = '<?php echo $_SESSION["email"] ?>'
if (otp && pass && pass2) {
if (pass === pass2) {
fetch(`https://api.obanana.shop/api/v1/change-password`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/change-password`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$otp = md5($_POST["otp"]);
if($otp==$_SESSION["otp"]){
header("location: forget_password_reset.php");

View File

@ -1,6 +1,6 @@
<?php
// include "functions.php";
// session_start();
//
// $_SESSION["email"] = $_POST["name"];
// $result = sendOTP($_SESSION["email"]);
@ -17,7 +17,7 @@
// }
// header("location: forget_otp.php");
include "functions.php";
session_start();
$_SESSION["email"] = $_POST["name"];

View File

@ -1,11 +1,12 @@
<?php
session_start();
include "admin/config.php";
function simpleProducts($category)
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/products',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -30,7 +31,7 @@ function simpleProducts($category)
// function searchProducts($query)
// {
// $query = str_replace(" ", "+", $query);
// $url = "https://api.obanana.shop/api/v1/products/search?q=$query";
// $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=$query";
// $curl = curl_init();
// curl_setopt($curl, CURLOPT_URL, $url);
// curl_setopt_array($curl, array(
@ -57,7 +58,7 @@ function simpleProducts($category)
function searchProducts($query)
{
$query = str_replace(" ", "+", $query);
$url = "https://api.obanana.shop/api/v1/products/search?q=$query";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=$query";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt_array($curl, array(
@ -108,11 +109,11 @@ $result = searchProducts($query);
// function searchProducts($query)
// {
// $query = str_replace(" ", "+", $query);
// $url = "https://api.obanana.shop/api/v1/products/search?q=$query";
// $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=$query";
// $curl = curl_init();
// curl_setopt($curl, CURLOPT_URL, $url);
// curl_setopt_array($curl, array(
// //CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/search?q=phone',
// //CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=phone',
// CURLOPT_RETURNTRANSFER => true,
// CURLOPT_ENCODING => '',
// CURLOPT_MAXREDIRS => 10,
@ -133,7 +134,7 @@ $result = searchProducts($query);
function getProduct($product)
{
$url = "https://api.obanana.shop/api/v1/products/$product";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/$product";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt_array($curl, array(
@ -157,7 +158,7 @@ function productList()
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/products',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -179,10 +180,10 @@ function productList()
function productListVendor($vendorId)
{
$curl = curl_init();
$url = 'https://api.obanana.shop/api/v1/products/vendor/' . $vendorId;
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/vendor/" . $vendorId;
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt_array($curl, array(
//CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/vendor/6527b593f79b5deac5ad6cb8',
//CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/vendor/6527b593f79b5deac5ad6cb8',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -209,7 +210,7 @@ function getProductVariations($parent_id)
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/products',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -245,7 +246,7 @@ function register($username, $password)
$json = json_encode($array);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/register',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/register",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -273,7 +274,7 @@ function login($username, $password)
$json = json_encode($array);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/login',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/login",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -293,6 +294,9 @@ function login($username, $password)
}
function forgot_password($email)
{
if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){
$email = $_SESSION["test_email_rcpt"];
}
$curl = curl_init();
$array = array(
"username" => $email
@ -300,7 +304,7 @@ function forgot_password($email)
$json = json_encode($array);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/forgot-password',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/forgot-password",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -320,7 +324,7 @@ function forgot_password($email)
function getCustomerbyLoginId($id)
{
$curl = curl_init();
$url = "https://api.obanana.shop/api/v1/customers/login_id/$id";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/login_id/$id";
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
@ -344,7 +348,7 @@ function getCustomerbyLoginId($id)
function getCustomer($id)
{
$curl = curl_init();
$url = "https://api.obanana.shop/api/v1/customers/$id";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/$id";
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
@ -368,7 +372,7 @@ function getCustomer($id)
function getVendorbyLoginId($id)
{
$curl = curl_init();
$url = "https://api.obanana.shop/api/v1/vendors/login_id/$id";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/login_id/$id";
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
@ -392,7 +396,7 @@ function getVendorbyLoginId($id)
function customerExists($email)
{
$curl = curl_init();
$url = "https://api.obanana.shop/api/v1/customers/search?q=$email";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/search?q=$email";
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
@ -420,7 +424,7 @@ function customerExists($email)
function vendorExists($email)
{
$curl = curl_init();
$url = "https://api.obanana.shop/api/v1/vendors/search?q=$email";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/search?q=$email";
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
@ -449,7 +453,9 @@ function vendorExists($email)
function sendEmail($fName, $lName, $email, $phone, $message)
{
$email2 = "stacyjoycemapano@gmail.com";
if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){
$email = $_SESSION["test_email_rcpt"];
}
$message2 = "
<h4>Greetings from Obanana!</h4>
<ul>
@ -468,7 +474,7 @@ function sendEmail($fName, $lName, $email, $phone, $message)
],
"To" => [
[
"Email" => $email2,
"Email" => $email,
"Name" => "Subscriber"
]
],
@ -484,7 +490,7 @@ function sendEmail($fName, $lName, $email, $phone, $message)
$curl = curl_init();
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.mailjet.com/v3.1/send',
CURLOPT_URL => "https://api.mailjet.com/v3.1/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -507,7 +513,9 @@ function sendEmail($fName, $lName, $email, $phone, $message)
function sendOTP($email)
{
$email2 = "junjihadbarroga@gmail.com";
if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){
$email = $_SESSION["test_email_rcpt"];
}
$curl = curl_init();
$otp = generateOTP(6);
$json = '{
@ -519,7 +527,7 @@ function sendOTP($email)
},
"To": [
{
"Email": "' . $email2 . '",
"Email": "' . $email . '",
"Name": "Subscriber"
}
],
@ -531,7 +539,7 @@ function sendOTP($email)
}';
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.mailjet.com/v3.1/send',
CURLOPT_URL => "https://api.mailjet.com/v3.1/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -581,7 +589,7 @@ function createCustomer($email, $phone, $firstname, $lastname, $loginId, $token)
curl_setopt($curl, CURLOPT_POSTFIELDS, $array);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/customers',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -600,7 +608,7 @@ function createCustomer($email, $phone, $firstname, $lastname, $loginId, $token)
function updateCustomer($customerId, $phone, $firstname, $lastname, $loginId, $token)
{
$url = "https://api.obanana.shop/api/v1/customers/$customerId";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/$customerId";
$array = '{
"last_name": "' . $lastname . '",
"login_id": "' . $loginId . '",
@ -637,7 +645,7 @@ function profile($token)
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/profile',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/profile",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -663,7 +671,7 @@ function profile($token)
// );
// curl_setopt($curl, CURLOPT_POSTFIELDS, $array);
// curl_setopt_array($curl, array(
// CURLOPT_URL => 'https://api.obanana.shop/api/v1/vendors',
// CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/vendors',
// CURLOPT_RETURNTRANSFER => true,
// CURLOPT_ENCODING => '',
// CURLOPT_MAXREDIRS => 10,
@ -683,7 +691,7 @@ function profile($token)
// function updateVendor($vendorId, $phone, $company, $loginId, $token)
// {
// $url = "https://api.obanana.shop/api/v1/vendors/$vendorId";
// $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/$vendorId";
// $array = '{
// "login_id": "' . $loginId . '",
// "first_name": "' . $company . '",
@ -712,7 +720,7 @@ function profile($token)
// }
function updateVendor($vendorId, $phone, $userlogin, $firstname, $lastname, $loginId, $token)
{
$url = "https://api.obanana.shop/api/v1/vendors/$vendorId";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/$vendorId";
$array = '{
"login_id": "' . $loginId . '",
"user_login": "' . $userlogin . '",
@ -755,7 +763,7 @@ function createVendor($email, $phone, $userlogin, $firstname, $lastname, $loginI
);
curl_setopt($curl, CURLOPT_POSTFIELDS, $array);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/vendors',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -824,7 +832,7 @@ function createVendor($email, $phone, $userlogin, $firstname, $lastname, $loginI
// curl_setopt($curl, CURLOPT_POSTFIELDS, $array);
// curl_setopt_array($curl, array(
// CURLOPT_URL => 'https://api.obanana.shop/api/v1/vendors',
// CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/vendors',
// CURLOPT_RETURNTRANSFER => true,
// CURLOPT_ENCODING => '',
// CURLOPT_MAXREDIRS => 10,
@ -850,7 +858,7 @@ function vendorList()
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/vendors',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -873,7 +881,7 @@ function simpleVendors()
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/vendors',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -902,7 +910,7 @@ function productListVendors($vendorIds)
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/products?vendor_ids=' . $vendorIdsString,
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products?vendor_ids=" . $vendorIdsString,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -925,7 +933,7 @@ function simpleVendorsWithProducts()
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/vendors',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -988,11 +996,11 @@ function simpleVendorsWithProducts()
function getVendorbyId($id)
{
$url = "https://api.obanana.shop/api/v1/vendors/$id";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/$id";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt_array($curl, array(
//CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/search?q=phone',
//CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=phone',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -1012,7 +1020,7 @@ function getVendorbyId($id)
function searchVendorByLoginId($id)
{
$id = str_replace(" ", "+", $id);
$url = "https://api.obanana.shop/api/v1/vendors/search?q=$id";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/search?q=$id";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt_array($curl, array(
@ -1034,7 +1042,7 @@ function searchVendorByLoginId($id)
function getOrder($order)
{
$url = "https://api.obanana.shop/api/v1/orders/$order";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/$order";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt_array($curl, array(
@ -1058,7 +1066,7 @@ function getAllOrder()
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/orders',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -1086,11 +1094,11 @@ function getAllOrder()
function getOrderbyCustomerId($id)
{
$url = "https://api.obanana.shop/api/v1/orders/customer/$id";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/customer/$id";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt_array($curl, array(
//CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/search?q=phone',
//CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=phone',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -1108,11 +1116,11 @@ function getOrderbyCustomerId($id)
}
function getOrderbyVendorId($id)
{
$url = "https://api.obanana.shop/api/v1/orders/vendor/$id";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/vendor/$id";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt_array($curl, array(
//CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/search?q=phone',
//CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=phone',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -1142,7 +1150,7 @@ function editOrderStatus($orderId, $status, $currentStatus, $trackingNumber, $co
}
$params3 = json_encode($data);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/orders/' . $orderId,
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/orders/" . $orderId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -1174,7 +1182,7 @@ function editOrderStatus($orderId, $status, $currentStatus, $trackingNumber, $co
// $curl = curl_init();
// curl_setopt($curl,CURLOPT_POSTFIELDS,$array);
// curl_setopt_array($curl, array(
// CURLOPT_URL => 'https://api.obanana.shop/api/v1/orders',
// CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/orders',
// CURLOPT_RETURNTRANSFER => true,
// CURLOPT_ENCODING => '',
// CURLOPT_MAXREDIRS => 10,
@ -1193,11 +1201,11 @@ function editOrderStatus($orderId, $status, $currentStatus, $trackingNumber, $co
function deleteOrderbyId($id)
{
$url = "https://api.obanana.shop/api/v1/orders/$id";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/$id";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt_array($curl, array(
//CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/search?q=phone',
//CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=phone',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -1247,7 +1255,7 @@ function addProduct(
);
curl_setopt($curl, CURLOPT_POSTFIELDS, $array);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/products',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -1325,11 +1333,11 @@ function editProduct(
}
// $params3 = json_encode($data);
// $url = 'https://api.obanana.shop/api/v1/products/'.$productId;
// $url = 'https://".$_SESSION["data_endpoint"]."/api/v1/products/'.$productId;
// curl_setopt($curl,CURLOPT_URL,$url);
// curl_setopt($curl, CURLOPT_POSTFIELDS, $params3);
// curl_setopt_array($curl, array(
// //CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/656712969624f6181c49cdd0',
// //CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/656712969624f6181c49cdd0',
// CURLOPT_RETURNTRANSFER => true,
// CURLOPT_ENCODING => '',
// CURLOPT_MAXREDIRS => 10,
@ -1345,7 +1353,7 @@ function editProduct(
$params3 = json_encode($data);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/' . $productId,
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products/" . $productId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -1390,7 +1398,7 @@ function editProduct(
// );
// curl_setopt($curl, CURLOPT_POSTFIELDS, $array);
// curl_setopt_array($curl, array(
// CURLOPT_URL => 'https://api.obanana.shop/api/v1/vendors',
// CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/vendors',
// CURLOPT_RETURNTRANSFER => true,
// CURLOPT_ENCODING => '',
// CURLOPT_MAXREDIRS => 10,
@ -1448,7 +1456,7 @@ function addVendor(
$params2 = json_encode($data);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/vendors',
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -1473,7 +1481,7 @@ function addVendor(
function getUsers()
{
$curl = curl_init();
$url = "https://api.obanana.shop/api/v1/users";
$url = "https://".$_SESSION["data_endpoint"]."/api/v1/users";
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
@ -1508,7 +1516,7 @@ function getUsers()
// );
// curl_setopt($curl, CURLOPT_POSTFIELDS, $array);
// curl_setopt_array($curl, array(
// CURLOPT_URL => 'https://api.obanana.shop/api/v1/users/' . $id,
// CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/users/' . $id,
// CURLOPT_RETURNTRANSFER => true,
// CURLOPT_ENCODING => '',
// CURLOPT_MAXREDIRS => 10,
@ -1540,7 +1548,7 @@ function editUsers($id, $username, $userType, $token)
$jsonPayload = json_encode($data); // Convert the array to JSON format
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.obanana.shop/api/v1/users/' . $id,
CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/users/" . $id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@ -1561,4 +1569,4 @@ function editUsers($id, $username, $userType, $token)
echo $response;
return $response;
}
}

View File

@ -411,7 +411,7 @@
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
function login(username, password, callback) {
fetch("https://api.obanana.shop/api/v1/login", {
fetch("https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -488,7 +488,7 @@
function updateQuantity(orderId, itemId, newQuantity, isFloat, token) {
console.log(isFloat)
// const token = '<?php echo $_SESSION["token"] ?>';
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}/items/${itemId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}/items/${itemId}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
@ -521,7 +521,7 @@
function updateFloatTotalAmount(orderId, token) {
// Fetch the order data
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`)
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`)
.then(response => response.json())
.then(orderData => {
console.log("This is the OrderData: " + JSON.stringify(orderData, null, 2));
@ -537,7 +537,7 @@
// Perform the PATCH request to update the total amount in the API
// const token = '<?php echo $_SESSION["token"] ?>';
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
@ -568,7 +568,7 @@
function updateTotalAmount(orderId, token) {
// Fetch the order data
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`)
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`)
.then(response => response.json())
.then(orderData => {
if (orderData && orderData !== "") {
@ -583,7 +583,7 @@
// Perform the PATCH request to update the total amount in the API
// const token = '<?php echo $_SESSION["token"] ?>';
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
@ -614,7 +614,7 @@
function getLatestOrders() {
var customerId = '<?php echo $customer['_id'] ?>'
// Fetch the order data
fetch(`https://api.obanana.shop/api/v1/orders/customer/${customerId}`)
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/customer/${customerId}`)
.then(response => response.json())
.then(orderData => {
if (orderData && orderData !== "") {
@ -635,7 +635,7 @@
}
function deleteOrder(orderId) {
fetch('https://api.obanana.shop/api/v1/orders/' + orderId, {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/' + orderId, {
method: 'DELETE'
})
.then(response => response.json())

View File

@ -3,7 +3,7 @@
use Symfony\Component\VarDumper\VarDumper;
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

3
info.php Normal file
View File

@ -0,0 +1,3 @@
<?php
phpinfo();
?>

View File

@ -1,5 +1,5 @@
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$url = $_SESSION["url"];
$_SESSION["email"] = $_POST["name"];
$_SESSION["password"] = $_POST["password"];

View File

@ -3,7 +3,7 @@
use Symfony\Component\VarDumper\VarDumper;
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -579,7 +579,7 @@ foreach ($variation_details as $index => $variation) {
var wishCustomerId = '<?php echo $customer_data[0]['_id'] ?>';
var wishProductId = '<?php echo $product_details['_id']; ?>';
fetch('https://api.obanana.shop/api/v1/customers/' + wishCustomerId)
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + wishCustomerId)
.then(response => response.json())
.then(data => {
const existingWishlist = data.favorites ?? {
@ -599,7 +599,7 @@ foreach ($variation_details as $index => $variation) {
existingWishlist.products.push(newFavorites.products[0]);
return fetch('https://api.obanana.shop/api/v1/customers/' + wishCustomerId, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + wishCustomerId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -639,7 +639,7 @@ foreach ($variation_details as $index => $variation) {
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
function login(username, password, callback) {
fetch("https://api.obanana.shop/api/v1/login", {
fetch("https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -722,7 +722,7 @@ foreach ($variation_details as $index => $variation) {
// Check if the product is already in the order API
var existingOrder;
var orderCheckXhr = new XMLHttpRequest();
orderCheckXhr.open("GET", "https://api.obanana.shop/api/v1/orders/customer/" + customerData.customer_id, true);
orderCheckXhr.open("GET", "https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/customer/" + customerData.customer_id, true);
orderCheckXhr.onreadystatechange = function() {
if (orderCheckXhr.readyState === 4) {
if (orderCheckXhr.status === 200) {
@ -768,7 +768,7 @@ foreach ($variation_details as $index => $variation) {
console.log("Request data:", requestData); // Debugging statement
// const token = '<?php echo $_SESSION["token"] ?>';
xhr.open("POST", "https://api.obanana.shop/api/v1/orders", true);
xhr.open("POST", "https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders", true);
xhr.setRequestHeader("Content-Type", "application/json", );
xhr.setRequestHeader("Authorization", "Bearer " + token);
xhr.onreadystatechange = function() {
@ -823,7 +823,7 @@ foreach ($variation_details as $index => $variation) {
function getLatestOrders() {
var customerId = '<?php echo $customer_data[0]['_id'] ?>'
// Fetch the order data
fetch(`https://api.obanana.shop/api/v1/orders/customer/${customerId}`)
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/customer/${customerId}`)
.then(response => response.json())
.then(orderData => {
if (orderData && orderData !== "") {
@ -846,7 +846,7 @@ foreach ($variation_details as $index => $variation) {
function updateOrder(orderId, existingItemId) {
var updateOrderXhr = new XMLHttpRequest();
// const token = '<?php echo $_SESSION["token"] ?>';
updateOrderXhr.open("PUT", `https://api.obanana.shop/api/v1/orders/${orderId}/items/${existingItemId}`, true);
updateOrderXhr.open("PUT", `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}/items/${existingItemId}`, true);
updateOrderXhr.setRequestHeader("Content-Type", "application/json");
updateOrderXhr.setRequestHeader("Authorization", "Bearer " + token);
updateOrderXhr.onreadystatechange = function() {
@ -909,7 +909,7 @@ foreach ($variation_details as $index => $variation) {
updateOrderXhr.send(JSON.stringify(updateData));
var patchTotalAmountXhr = new XMLHttpRequest();
patchTotalAmountXhr.open("PATCH", `https://api.obanana.shop/api/v1/orders/${orderId}`, true);
patchTotalAmountXhr.open("PATCH", `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, true);
patchTotalAmountXhr.setRequestHeader("Content-Type", "application/json");
patchTotalAmountXhr.setRequestHeader("Authorization", "Bearer " + token);

View File

@ -1,5 +1,5 @@
<?php
session_start();
$_SESSION["isCustomer"] = false;
$_SESSION["isVendor"] = false;
?>

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["email"] = $_POST["name"];
$_SESSION["password"] = $_POST["password"];
$result = sendOTP($_SESSION["email"]);

View File

@ -1,5 +1,5 @@
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["firstname"] = $_POST["firstname"];
$_SESSION["lastname"] = $_POST["lastname"];
$_SESSION["phone"] = $_POST["phonenumber"];

View File

@ -1,5 +1,5 @@
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$otp = md5($_POST["otp"]);
if($otp==$_SESSION["otp"]){
$result = register($_SESSION["email"],$_SESSION["password"]);

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$vendors = getVendorbyId($_SESSION["vendorId"]);
$vendorData = json_decode($vendors, true);

View File

@ -1,6 +1,6 @@
<?php
// include "functions.php";
// session_start();
//
// $_SESSION["company"] = $_POST["company"];
// $_SESSION["firstname"] = $_POST["company"];
// $_SESSION["phone"] = $_POST["phonenumber"];
@ -13,7 +13,7 @@
// }
// header("location: /");
include "functions.php";
session_start();
$_SESSION["user_login"] = $_POST["user_login"];
$_SESSION["firstname"] = $_POST["first_name"];
$_SESSION["contactlast_name"] = $_POST["last_name"];

View File

@ -3,7 +3,7 @@
use Symfony\Component\VarDumper\VarDumper;
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
// $result=searchProducts($_GET["searchText"]);
// //echo $result;
// $array = json_decode($result,true);
@ -43,7 +43,7 @@
// include "functions.php";
// session_start();
//
// $searchText = $_GET["searchText"];
// $result = searchProducts($searchText);

View File

@ -5,7 +5,7 @@
$data = json_decode(file_get_contents('php://input'), true);
// You can process the $data as needed, for example, store it in session
session_start();
$_SESSION['selected_variation'] = $data;
var_dump($_SESSION['selected_variation']);

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ( $_SESSION["userId"] <> "" ) {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,5 +1,5 @@
<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$input = json_decode(file_get_contents('php://input'), true);

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -408,7 +408,7 @@ if ($_SESSION["userId"] <> "") {
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
function login(username, password, callback) {
fetch("https://api.obanana.shop/api/v1/login", {
fetch("https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -498,7 +498,7 @@ if ($_SESSION["userId"] <> "") {
console.log('FormData:', formData);
fetch('https://api.obanana.shop/api/v1/upload_image', {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
@ -528,12 +528,12 @@ if ($_SESSION["userId"] <> "") {
const payload = {
return_order: {
reason: reason,
image: `https://api.obanana.shop/images/storage/order_uploads/${filename}`,
image: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/order_uploads/${filename}`,
status: 'To Approve',
}
}
// const token = '<?php echo $_SESSION["token"] ?>';
fetch('https://api.obanana.shop/api/v1/orders/' + orderId, {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/' + orderId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
@ -583,7 +583,7 @@ if ($_SESSION["userId"] <> "") {
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
function login(username, password, callback) {
fetch("https://api.obanana.shop/api/v1/login", {
fetch("https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -660,7 +660,7 @@ if ($_SESSION["userId"] <> "") {
function updateCompletedStatus(orderId) {
login(email, password, function(token) {
// const token = '<?php echo $_SESSION["token"] ?>';
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',

View File

@ -2,7 +2,7 @@
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -351,7 +351,7 @@ if ($_SESSION["userId"] <> "") {
const phone = document.getElementById('phone-').value;
// If no file selected, only update the email
fetch(`https://api.obanana.shop/api/v1/customers/${customerId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/${customerId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -508,7 +508,7 @@ if ($_SESSION["userId"] <> "") {
$('#submitBtn').on('click', function() {
// Retrieve existing addresses from the API
// fetch('https://api.obanana.shop/api/v1/customers/65482e8d209ff8d348bd30fd')
fetch('https://api.obanana.shop/api/v1/customers/' + customerId)
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId)
.then(response => response.json())
.then(data => {
// Get the existing addresses array
@ -543,7 +543,7 @@ if ($_SESSION["userId"] <> "") {
existingAddresses.push(newAddress);
// Make a PATCH request to update the addresses array
return fetch('https://api.obanana.shop/api/v1/customers/' + customerId, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -577,7 +577,7 @@ if ($_SESSION["userId"] <> "") {
<script>
async function updateAddressBilling(customerId, addressIndex, isBilling) {
try {
const apiUrl = `https://api.obanana.shop/api/v1/customers/${customerId}`;
const apiUrl = `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/${customerId}`;
const response = await fetch(apiUrl, {
method: 'GET',
headers: {
@ -633,7 +633,7 @@ if ($_SESSION["userId"] <> "") {
async function updateAddressShipping(customerId, addressIndex, isShipping) {
try {
const apiUrl = `https://api.obanana.shop/api/v1/customers/${customerId}`;
const apiUrl = `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/${customerId}`;
const response = await fetch(apiUrl, {
method: 'GET',
headers: {
@ -763,7 +763,7 @@ if ($_SESSION["userId"] <> "") {
formData.append('category', 'customer');
formData.append('image', file);
fetch('https://api.obanana.shop/api/v1/upload_image', {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
@ -779,13 +779,13 @@ if ($_SESSION["userId"] <> "") {
const filename = result.filename;
const payload = {
customer_image: `https://api.obanana.shop/images/storage/customer_uploads/${filename}`,
customer_image: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/customer_uploads/${filename}`,
};
console.log('Payload:', payload);
return fetch('https://api.obanana.shop/api/v1/customers/' + customerId, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'

View File

@ -2,7 +2,7 @@
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

View File

@ -3,7 +3,7 @@
use Symfony\Component\VarDumper\VarDumper;
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -221,7 +221,7 @@ $products = productList();
}
function login(username, password, callback) {
fetch("https://api.obanana.shop/api/v1/login", {
fetch("https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/login", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$orderId = $_SESSION['vendorOrderId'];
$currentStatus = $_POST['order_status'];
$trackingNumber = $_POST['tracking_number'];

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -238,7 +238,7 @@ if (is_array($vendorOrderss)) {
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
function login(username, password, callback) {
fetch("https://api.obanana.shop/api/v1/login", {
fetch("https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/login", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -3,7 +3,7 @@
use Symfony\Component\VarDumper\VarDumper;
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ( $_SESSION["userId"] <> "" ) {
$_SESSION["isLoggedIn"] = true;

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -571,7 +571,7 @@ if (is_array($vendorOrderss)) {
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
function login(username, password, callback) {
fetch("https://api.obanana.shop/api/v1/login", {
fetch("https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -650,7 +650,7 @@ if (is_array($vendorOrderss)) {
function updateRefundShipStatus(orderId, image, reason) {
login(email, password, function() {
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
@ -685,7 +685,7 @@ if (is_array($vendorOrderss)) {
function updateRefundReceiveStatus(orderId, image, reason) {
login(email, password, function() {
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
// $customer_data = getCustomerbyLoginId($_SESSION["userId"]);
@ -337,7 +337,7 @@ if ($_SESSION["userId"] <> "") {
const phone = document.getElementById('cphone-').value;
// If no file selected, only update the email
fetch(`https://api.obanana.shop/api/v1/vendors/${vendorid}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/${vendorid}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -492,7 +492,7 @@ if ($_SESSION["userId"] <> "") {
$('#submitBtn').on('click', function() {
// Retrieve existing addresses from the API
fetch('https://api.obanana.shop/api/v1/vendors/' + vendorid)
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid)
.then(response => response.json())
.then(data => {
// Get the existing addresses array
@ -527,7 +527,7 @@ if ($_SESSION["userId"] <> "") {
existingAddresses.push(newAddress);
// Make a PATCH request to update the addresses array
return fetch('https://api.obanana.shop/api/v1/vendors/' + vendorid, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -560,7 +560,7 @@ if ($_SESSION["userId"] <> "") {
<script>
async function updateAddressBilling(vendorid, addressIndex, isBilling) {
try {
const apiUrl = `https://api.obanana.shop/api/v1/vendors/${vendorid}`;
const apiUrl = `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/${vendorid}`;
const response = await fetch(apiUrl, {
method: 'GET',
headers: {
@ -613,7 +613,7 @@ if ($_SESSION["userId"] <> "") {
async function updateAddressShipping(vendorid, addressIndex, isShipping) {
try {
const apiUrl = `https://api.obanana.shop/api/v1/vendors/${vendorid}`;
const apiUrl = `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/${vendorid}`;
const response = await fetch(apiUrl, {
method: 'GET',
headers: {
@ -735,7 +735,7 @@ if ($_SESSION["userId"] <> "") {
formData.append('category', 'vendor');
formData.append('image', file);
fetch('https://api.obanana.shop/api/v1/upload_image', {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
@ -751,13 +751,13 @@ if ($_SESSION["userId"] <> "") {
const filename = result.filename;
const payload = {
vendor_image: `https://api.obanana.shop/images/storage/vendor_uploads/${filename}`,
vendor_image: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/vendor_uploads/${filename}`,
};
console.log('Payload:', payload);
return fetch('https://api.obanana.shop/api/v1/vendors/' + vendorid, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@ -788,7 +788,7 @@ if ($_SESSION["userId"] <> "") {
formData.append('category', 'vendor');
formData.append('image', file);
fetch('https://api.obanana.shop/api/v1/upload_image', {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
@ -804,13 +804,13 @@ if ($_SESSION["userId"] <> "") {
const filename = result.filename;
const payload = {
vendor_banner: `https://api.obanana.shop/images/storage/vendor_uploads/${filename}`,
vendor_banner: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/vendor_uploads/${filename}`,
};
console.log('Payload:', payload);
return fetch('https://api.obanana.shop/api/v1/vendors/' + vendorid, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$vendorId = $_SESSION['vendorId'];
//echo '$vendorId: '.$vendorId.'<br>';
$productName = $_POST['product_name'];

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$productId = $_SESSION['newProductId'];
$vendorId = $_SESSION['vendorId'];
//echo '$vendorId: '.$vendorId.'<br>';

View File

@ -1,6 +1,6 @@
<?php
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -455,7 +455,7 @@ $array = json_decode($result, true);
formData.append('category', 'product');
formData.append('image', resizedFile);
fetch('https://api.obanana.shop/api/v1/upload_image', {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
@ -471,12 +471,12 @@ $array = json_decode($result, true);
const filename = result.filename;
const payload = {
product_image: `https://api.obanana.shop/images/storage/product_uploads/${filename}`,
product_image: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/product_uploads/${filename}`,
};
console.log('Payload:', payload);
const token = '<?php echo $_SESSION["token"] ?>';
return fetch('https://api.obanana.shop/api/v1/products/' + productId, {
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/' + productId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',

View File

@ -3,7 +3,7 @@
use Symfony\Component\VarDumper\VarDumper;
include "functions.php";
session_start();
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
@ -282,7 +282,7 @@ if ($_SESSION["userId"] <> "") {
// Make an AJAX request to update the favorites with the remaining products
var xhr = new XMLHttpRequest();
xhr.open('PATCH', 'https://api.obanana.shop/api/v1/customers/' + customerId, true);
xhr.open('PATCH', 'https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {