<?php require_once 'task_class.php'; if (isset($_POST['taskid'])) { $task = new task(); $task->getFromDB($_POST['taskid']); } else { $error['invalidtaskid'] = true; echo json_encode($error); return; } if (isset($_POST['bidderid']) && isset($_POST['bidamt'])) { $error = $task->addBid($_POST['bidderid'], $_POST['bidamt']); if ($error == null) { $error['Success'] = true; } echo json_encode($error); } else { $error['invalidbidderidorbidamt'] = true; echo json_encode($error); }
$task = new task(); $error = $task->getFromDB($intaskid); if (count($error) == 0) { require_once 'php/user_class.php'; $user = new user(); $user->getFromDB($task->userid); $date = new DateTime(); $date->setTimestamp($task->enddatetime); $dateStr = $date->format('m/d/Y g:i A'); } else { $_SESSION['msg_badtaskid'] = "Bad task id"; } if (isset($_POST['submit'])) { $biderror = array(); if (isset($_SESSION['userid'])) { $biderror = $task->addBid($_SESSION['userid'], $_POST['Bid']); } else { $_SESSION['msg_needlogin'] = "******"; } if (count($biderror) == 0) { $_SESSION['msg_bidplaced'] = "Bid Placed"; } if (isset($biderror['active'])) { $_SESSION['msg_bidover'] = "Bidding Ended"; } if (isset($biderror['bidamount'])) { $_SESSION['msg_bidless'] = "Must Bid Less Than Current"; } if (isset($biderror['bidnegative'])) { $_SESSION['msg_bidnegative'] = "Bid Cannot Be Negative"; }