<?php require_once 'core/init.php'; $user = new User(); if (Input::exists()) { if (Token::check(Input::get('token'))) { $validate = new Validate(); $validation = $validate->check($_POST, array('ddlMyAccounts' => array('name' => "Saját számla", 'required' => true), 'ddlAccountTypes' => array('name' => "Tipus", 'required' => true), 'amount' => array('name' => 'Összeg', 'required' => true, 'min' => 1), 'description' => array('name' => 'Leírás', 'required' => true, 'min' => 7))); if ($validation->passed()) { if (Input::get('amount') <= $user->getAccAmount(Input::get('ddlMyAccounts'))) { $transactionid = $user->getTranByAccID(Input::get('ddlMyAccounts')); if (Input::get('ddlAccountTypes') == "accountid") { $toaccid = $user->getAccByCode(Input::get('accountid')); $totranid = $user->getTranByAccID($toaccid->ID); } else { if (Input::get('ddlAccountTypes') == "contact") { $toaccid = $user->getAccByCode(Input::get('ddlContacts')); $totranid = $user->getTranByAccID($toaccid->ID); } } $senderaccid = Input::get('ddlMyAccounts'); if ($toaccid != 0) { $user->send(array('Transaction_ID' => $transactionid->ID, 'Account_ID' => $toaccid->ID, 'When' => date(DATE_ATOM), 'Amount' => Input::get('amount'), 'IsIncome' => 0, 'Description' => Input::get('description'))); $user->send(array('Transaction_ID' => $totranid->ID, 'Account_ID' => Input::get('ddlMyAccounts'), 'When' => date(DATE_ATOM), 'Amount' => Input::get('amount'), 'IsIncome' => 1, 'Description' => Input::get('description'))); Session::flash('home', 'Tranzakció sikeresen végrehajtva !'); Redirect::to('index.php'); } else { echo 'Tranzakció sikertelen! Ellenőrizze a megadott információkat!'; } } else { echo 'Nincs elég pénz a számláján!!!';