<?php /** * Created by PhpStorm. * User: Radley * Date: 12/3/2015 * Time: 6:19 PM */ require 'connect.php'; $is_gain = $_GET['is_gain']; // bill name/type todo add me $bill_name = $_GET['bill_name']; // bill name/type todo change me from bill type $frequency = $_GET['frequency']; // how often todo SINGLE WEEKLY BI-WEEKLY MONTHLY $due_period = $_GET['due_period']; // how often todo enum('eom','bom') $every_x_days = $_GET['every_x_days']; // how often todo int add me $on_the_x = $_GET['on_the_x']; // how often todo int add me $amount = $_GET['amount']; // dollar amount $user_id = SignUserIn('radley', 'radley123'); echo $user_id; if (SignUserIn('radley', 'radley123') != 0) { $gain = $is_gain === true; echo $gain; $added_bill = AddBill(1, $is_gain, $bill_name, $frequency, $due_period, $every_x_days, $on_the_x, $amount); } else { }
public function save($username, $userpass) { // get the username pass from DB $user_id = SignUserIn($username, $userpass); if ($user_id != 0) { //TODO LOGIN SUCCESS // returns true or false //AddBill($user_id, $is_gain, $bill_name, $frequency, $due_period, $every_x_days, $on_the_x, $amount) $added_bill = AddBill($user_id, $this->is_gain, $this->bill_name, $this->frequency, $this->due_period, $this->every_x_days, $this->on_the_x, $this->amount); if ($added_bill === true) { //TODO ADDED BILL SUCCESS } else { // TODO ADDING FAILED throw new Exception('Failed to save bill item'); } } else { // TODO FAILED LOGIN throw new Exception('Failed to login'); } //if saving was not successful, throw an exception //if the $bill_id isn't set yet, it means we need to create a new todo item // if( is_null($this->bill_id) || !is_numeric($this->bill_id) ) { // //the todo id is the current time // $this->bill_id = time(); // } $bill_item_array = $this->toArray(); return $bill_item_array; }