%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/www/website_6ca89795/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/www/website_6ca89795/api/update_cart.php
<?php

header("Content-Type: application/json");

include("../dbcon.php");
include('auth.php');
$cart_id=intval($_REQUEST['cart_id'] ?? 0);
$action=$_REQUEST['action'] ?? '';

if($cart_id<=0)
{
    exit(json_encode([
        "status"=>false,
        "message"=>"Cart ID required"
    ]));
}

if($action=='plus')
{
    mysqli_query(
    $conn,
    "UPDATE cart_items
     SET quantity=quantity+1
     WHERE id='$cart_id'"
    );
}

if($action=='minus')
{
    mysqli_query(
    $conn,
    "UPDATE cart_items
     SET quantity=GREATEST(quantity-1,1)
     WHERE id='$cart_id'"
    );
}

echo json_encode([
    "status"=>true,
    "message"=>"Cart updated"
]);

?>

VaKeR 2022