| Server IP : 188.114.96.2 / Your IP : 104.23.197.230 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/edlftp-preprod/wp-content/plugins/ci-hybrid/ |
Upload File : |
<?php
//cross orign prevent
$option = $_POST['target'];
$param = $_POST['param'];
//session_start();
session_destroy();
if($option == "filter"){
$param = implode(',',$param);
//var_dump($param);
$postdata = http_build_query(
array("filters"=>$param)
);
$opts = array(
'http' =>
array(
'method' => 'POST',
'header' => 'Content-Type: application/x-www-form-urlencoded',
'content' => $postdata
),
'ssl' =>array(
'verify_peer'=>false,
'verify_peer_name'=>false,
),
);
//var_dump($opts);
echo file_get_contents("https://sms.ecoledelangues.be/shop/loadData", false, stream_context_create($opts));
}
else if($option == "add"){
//$param = implode(',',$param); // "product_id,product_qty"
$product_id = $param['product'];
$product_qty = $param['quantity'];
$product = get_product($product_id);
//echo "++>";
//var_dump($product);
$sessionCart = $_SESSION['cart'];
if($sessionCart != NULL && array_key_exists($product_id,$sessionCart)){
$prevQty = $sessionCart[$product_id]['qty'];
$sessionCart[$product_id]['qty'] = $prevQty + $product_qty;
}
else {
$product_item = array(
'data' => json_decode($product),
'qty' => $product_qty,
'option' => null,
);
$sessionCart[$product_id]= $product_item;
}
echo json_encode($sessionCart);
$_SESSION['cart'] = $sessionCart;
}
else if($option == "cart"){
$sessionCart = $_SESSION['cart'];
$qty = 0;
$total = 0;
var_dump($_SESSION);
foreach ($sessionCart as $key => $product) {
// var_dump($product['data'][0]['Course_Price']);
$qty = $qty + $product['qty'];
$price = $product['data'][0]['Course_Price'];
$total = $total + ($price * $qty);
}
$data = array(
"cart_qty" => $qty,
"cart_total" => $total,
"cart" => $sessionCart
);
echo json_encode($data);
}
else{
}
function get_product($id){
$postdata = $postdata = http_build_query(
array("product"=>$id)
);
$opts = array(
'http' =>
array(
'method' => 'POST',
'content' => $postdata,
'header' => 'Content-Type: application/x-www-form-urlencoded',
),
'ssl' =>
array(
'verify_peer'=>false,
'verify_peer_name'=>false,
),
);
//var_dump($postdata);
return file_get_contents("https://sms.ecoledelangues.be/shop/getProduct", false, stream_context_create($opts));
}