ok

Mini Shell

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

<?php
include_once ('config/config.php');
session_start();
$return_arr = array(); // Initialize the return array




if (isset($_POST['type']) && $_POST['type'] == 'app_form') {
    try {

// Your validation and sanitization code goes here
$appointment_time = $_POST['appointment_time'];
error_log('app time'.$appointment_time);
$buyer_id = $_POST['buyer_id'];
$product_id = $_POST['product_id'];
$seller_id = $_POST['seller_id'];
$remrks = $_POST['remrks'];

// Prepare the SQL query for update
$statement = $pdo->prepare("INSERT INTO tbl_appointment (product_id, appointment_time, remarks, buyer_id, seller_id) VALUES (?, ?, ?, ?, ?)");

$result = $statement->execute([
$product_id,
$appointment_time,
$remrks,
$buyer_id,
$seller_id
]);







        if ($result) {
            // Update session variable only if the update operation is successful
            $return_arr['message'] = 'Details form Updated successfully.';
            $return_arr['status'] = 200;
        } else {
            $return_arr['message'] = 'Something went wrong.';
            $return_arr['status'] = 400;
        }
    } catch (Exception $e) {
        $return_arr['message'] = 'Internal Server Error: ' . $e->getMessage();
        $return_arr['status'] = 500;
        error_log($e->getMessage());
    }

    echo json_encode($return_arr);
}





if (isset($_POST['type']) && $_POST['type'] == 'upload') {
    
$id=$_SESSION['buyer']['id'];
error_log("Buyer Session id".$id);
$profile_created_for = $_POST['profile_created_for'];
$profile_name = $_POST['profile_name'];
$owner_limit = $_POST['owner_limit'];
$gender = $_POST['gender'];
$dob = $_POST['dob'];
$age = $_POST['age'];
$country = $_POST['country'];
$mobile_no = $_POST['mobile_no'];
$mobile_no_alt = $_POST['mobile_no_alt'];
$wa_limit = $_POST['wa_limit'];
$lgl_address = $_POST['lgl_address'];
$city = $_POST['city'];
$state = $_POST['state'];
$pin_code = $_POST['pin_code'];
$land_mark = $_POST['land_mark'];
$email_id = $_POST['email_id'];
$email_limit = $_POST['email_limit'];
  

    error_log($id."owner change");
   
    // $result="1";
    // Prepare and execute the SQL statement
$statement = $pdo->prepare("UPDATE `tbl_buyer`
SET
    `profile_created_for` = ?,
    `buyer_name` = ?,
    `gender` = ?,
    `buyer_dob` = ?,
    `buyer_age` = ?,
    `buyer_country` = ?,
    `buyer_mobile` = ?,
    `buyer_alt_mobile` = ?,
    `buyer_address` = ?,
    `buyer_city` = ?,
    `buyer_state` = ?,
    `buyer_pincode` = ?,
    `buyer_landmark` = ?,
    `buyer_email` = ?
WHERE
    `id` = ?");

$result = $statement->execute([
    $profile_created_for,
    $profile_name,
    $gender,
    $dob,
    $age,
    $country,
    $mobile_no,
    $mobile_no_alt,
    $lgl_address,
    $city,
    $state,
    $pin_code,
    $land_mark,
    $email_id,
    $id
]);

    // $_SESSION['user']['personal_info_cmt'] = 1;
    if ($result) {
        $return_arr['message'] = 'Profile Updated successfully.';
        $return_arr['status'] = 200;
    } else {
        $return_arr['message'] = 'Something went wrong.';
        $return_arr['status'] = 400;
    }
    echo json_encode($return_arr);
}
?>

Zerion Mini Shell 1.0