<?php

require_once('../../vendor/autoload.php');
require_once('../../main_includes/init.php');

extract($_POST);

$user = User::find_by_id($_SESSION['user_id']);
    if (!$user) {
        return false;
    }
    
    if (!isset($id)) {
        echo false;
        exit;
    }
    
    
    $my_transaction = MyTransaction::find_by_id($id);
    
    if (!$my_transaction) {
        echo false;
        exit;
    }

    if ($my_transaction->user_id != $user->id) {
        echo false;
        exit;
    }

    $my_transaction->delete();


    echo $my_transaction->id;