ok

Mini Shell

Direktori : /home2/selectio/www/wedding-info-new/api/
Upload File :
Current File : /home2/selectio/www/wedding-info-new/api/wishlist.php

<?php
error_log("Wish list start 1");
include_once('config/config.php');
error_log("Wish list start");
    session_start();

error_log("Wish list start");
$return_arr = array(); // Initialize the return arrayallaiance_verified

if (isset($_POST['type']) && $_POST['type'] == 'wishlist') {
    try {
        $insert=$_POST['insert'];
        error_log($insert);
        $id=$_POST['id'];
        $u_id=$_SESSION['user']['id'];

        if($insert=="deactive"){
        $statement = $pdo->prepare("INSERT INTO `tbl_wishlist`(`user_id`, `alliance_id`) VALUES (?,?)");
        $result = $statement->execute(array($u_id,$id));
        if ($result) {
            $return_arr['message'] = 'Alliance Added to Wishlist.';
            $return_arr['element'] = 'active';
            $return_arr['ids'] = $id;
            $return_arr['status'] = 200;
        } else {
            $return_arr['message'] = 'Error';
            $return_arr['status'] = 400;
        }
            
        }
        
        else{
            $statement = $pdo->prepare("DELETE FROM tbl_wishlist WHERE alliance_id = ?");
            $result = $statement->execute(array($id));
            if ($result) {
                $return_arr['element'] = 'deactivate';
                $return_arr['status'] = 200;
                $return_arr['ids'] = $id;

            } else {
                $return_arr['message'] = 'Error';
                $return_arr['status'] = 400;
            }
            
        }
    } catch (Exception $e) {
        $return_arr['message'] = $e->getMessage();
        $return_arr['status'] = 500;
        error_log($e->getMessage());
    }

    echo json_encode($return_arr);
}
?>

Zerion Mini Shell 1.0