//echo "post not set\n";
}
$task = new task();
$error = $task->getFromDB($intaskid);
if ($error == NULL) {
    //Convert task to usable array
    $taskout = array();
    $taskout['TaskID'] = $task->taskid;
    $taskout['Lister'] = $task->userid;
    $taskout['Title'] = $task->title;
    $taskout['Description'] = $task->description;
    $taskout['Location'] = $task->location;
    $taskout['Category'] = $task->category;
    $taskout['Tags'] = $task->tags;
    $taskout['NumImages'] = $task->numimg;
    $taskout['CurrentBid'] = $task->getCurrentBid();
    $taskout['EndDateTime'] = $task->enddatetime;
    $taskout['HighestBidderID'] = $task->winnerid;
    if ($taskout['HighestBidderID'] != null) {
        $winner = new user();
        $winner->getFromDB($taskout['HighestBidderID']);
        $taskout['HighestBidderUsername'] = $winner->username;
    }
    //Get user info
    $lister = new user();
    if ($lister->getFromDB($task->userid) == null) {
        $taskout['ListerUsername'] = $lister->username;
        $taskout['ListerAvatarURL'] = $lister->getAvatarURL();
        //$taskout['ListerAvatarURL']=$lister->DEBUGgetAvatarURL();
        $rating = $lister->getListerRating();
        $taskout['ListerRating'] = $rating['rating'];
Esempio n. 2
0
        $_SESSION['msg_bidnegative'] = "Bid Cannot Be Negative";
    }
    if (isset($biderror['bidself'])) {
        $_SESSION['msg_bidself'] = "Can't bid on own task";
    }
    if (isset($biderror['login'])) {
        $_SESSION['msg_needlogin'] = "******";
    }
    //redirect to prevent form resubmission on refresh
    header("Location: /ViewTask.php?id=" . $intaskid);
    die;
}
//AJAX for getting the current bid
if (isset($_GET['getCurrentBid'])) {
    echo 'Current bid: $<b>';
    echo $task->getCurrentBid();
    echo '.00';
    if (isset($_SESSION['userid']) && $task->getBidLeaderID() == $_SESSION['userid']) {
        echo ' (You)';
    }
    echo '</b>';
    die;
}
//show alert if task is not active
if (count($error) == 0 && $task->active == 0) {
    if (isset($_SESSION['userid']) && $task->winnerid == $_SESSION['userid']) {
        $_SESSION['msg_taskover_won'] = "Task ended, you won!";
    } else {
        $_SESSION['msg_taskover'] = "Task ended";
    }
}