######################################################## # get all relevant owners ######################################################## $sql = "SELECT o.* FROM owners as o, users as u, canners as c \n\t\tWHERE u.id=c.user_id AND o.canner_id = c.user_id\n\t\tAND u.email_address = '" . $postArray['email_address'] . "'\n\t\tORDER BY o.collection_day, city_address;"; $returnArray = getDataSet($DBConnArray, $sql); if (!$returnArray['ErrorReturn']['Success']) { echo json_encode(array('table' => $DBConnArray['ErrorReturn']['ErrorMessage'])); return; } ########################################################## # get invoices and payments ########################################################## $sql = "SELECT * FROM invoices where owner_id = " . $returnArray['DataSet'][0]['user_id']; $invoiceArray = getDataSet($DBConnArray, $sql); $sql = "SELECT * FROM payments where owner_id = " . $returnArray['DataSet'][0]['user_id']; $paymentArray = getDataSet($DBConnArray, $sql); ########################################################## # Compare the two arrays: ########################################################## foreach ($invoiceArray['DataSet'] as $idx => $invoice) { $invoiceArray['DataSet'][$idx]['used'] = false; } ################################################ # add up payments ################################################ $pastPaid = 0; foreach ($paymentArray['DataSet'] as $idxP => $payment) { $pastPaid += $payment['amount']; } ################################################ # mark off invoices and decrement pastPaid
$results = Character::activeCharacters()->get(); if (Input::get("include-npcs")) { $results = $results->merge(Character::activeNPCs()->get()); } if ($hasY) { $mode = "Scatter"; $xData = getDataSet($x); $yData = getDataSet($y); foreach ($results as $c) { $xDataValue = call_user_func($xData["extractor"], $c); $yDataValue = call_user_func($yData["extractor"], $c); $data[] = ["label" => $c->name, "data" => [["x" => $xDataValue, "y" => $yDataValue]]]; $pureData[] = ["name" => $c->name, "x" => $xDataValue, "y" => $yDataValue]; } } else { $xData = getDataSet($x); $labels = $xData["labels"]; $data = [["label" => $x, "fillColor" => "rgba(151,187,205,0.5)", "strokeColor" => "rgba(151,187,205,0.8)", "highlightFill" => "rgba(151,187,205,0.75)", "highlightStroke" => "rgba(151,187,205,1)", "data" => []]]; foreach ($labels as $l) { $data[0]["data"][] = 0; } foreach ($results as $c) { $xDataValue = call_user_func($xData["extractor"], $c); $data[0]["data"][array_search($xDataValue, $labels)]++; $pureData[] = ["name" => $c->name, "x" => $xDataValue]; } } } ?> self.statList = ["", "Current Experience", "Total Experience", "Experience Spent", "Generation", "Morality", "Courage", "Self-Control/Instinct", "Conscience/Conviction", "Physical Traits", "Mental Traits", "Social Traits", "{{implode($all_abilities, "\",\"")}}", "{{implode($all_backgrounds, "\",\"")}}", "Total Influence"]; self.selectedX = ko.observable("{{$x}}");
# # connect to database $DBConnArray = getDBConn(); if (!$DBConnArray['ErrorReturn']['Success']) { $_SESSION['returnArray'] = $DBConnArray['ErrorReturn']['ErrorMessage']; header("Location: " . $_SERVER['HTTP_REFERER']); return; } # # Select info from temp_users table # Update password from current form # Copy to users record # Insert record into users table... # $sql = "SELECT * FROM temp_users WHERE id = " . $cannerWorkArray['user_id'] . ";"; $tempUserArray = getDataSet($DBConnArray, $sql); $tempUserArray['DataSet'][0]['password'] = $cannerWorkArray['password']; # # Check 1-day time restraint... $lastPossible = date('Y-m-d H:i:s'); $time = strtotime($lastPossible); $time_new = $time - 86400; $lastPossible = date('Y-m-d H:i:s', $time_new); if ($tempUserArray['DataSet'][0]['created'] < $lastPossible) { $sql = "DELETE FROM temp_users WHERE id = " . $_SESSION['returnValues']['last_key'] . ";"; $returnArray = updateData($DBConnArray, $sql); $_SESSION['returnArray'] = "Please start over! You have taken too long![" . $tempUserArray['created'] . "]" . $lastPossible; header("Location: " . $_SERVER['HTTP_REFERER']); return; } $userArray = getArray('users');
$_SESSION['returnArray'] = $DBConnArray['ErrorReturn']['ErrorMessage']; header("Location: " . $_SERVER['HTTP_REFERER']); return; } $sql = "SELECT * from users as u, payments as p\n\t\tWHERE p.owner_id = u.id \n\t\tAND u.email_address = '" . $postArray['email'] . "';"; $checkArray = getDataSet($DBConnArray, $sql); if (!$DBConnArray['ErrorReturn']['Success']) { $_SESSION['returnArray'] = $DBConnArray['ErrorReturn']['ErrorMessage']; header("Location: " . $_SERVER['HTTP_REFERER']); return; } if (empty($checkArray['DataSet'])) { $_SESSION['returnArray'] = "You can not critique your canner if you have never paid"; header("Location: " . $_SERVER['HTTP_REFERER']); return; } # # Select info from temp_users table # Update password from current form # Copy to users record # Insert record into users table... # #$postArray['email'] = '*****@*****.**'; $sql = "SELECT c.* FROM canners as c, owners as o, users as u \n\t\tWHERE c.user_id = o.canner_id \n\t\tAND o.user_id = u.id \n\t\tAND u.email_address = '" . $postArray['email'] . "';"; $cannerArray = getDataSet($DBConnArray, $sql); $sql = "INSERT INTO canner_ratings (user_id, rating, notes) \n\t\tVALUES (" . $cannerArray['DataSet'][0]['user_id'] . "," . $postArray['rating'] . ",\"" . preg_replace("/\"/", "'", $postArray['notes']) . "\");"; $cannerArray = updateData($DBConnArray, $sql); header('Location:' . $baseURL . 'index.html'); ?>
<?php ################################################## # ajax # echos join on users, canners ################################################## include_once 'DBInterface.php'; $DBConnArray = getDBConn(); if (!$DBConnArray['ErrorReturn']['Success']) { echo $DBConnArray['ErrorReturn']['ErrorMessage']; return; } $sql = "SELECT * FROM canners, users where id=user_id;"; $returnArray = getDataSet($DBConnArray, $sql); if (!$returnArray['ErrorReturn']['Success']) { echo $returnArray['ErrorReturn']['ErrorMessage']; return; } echo json_encode($returnArray['DataSet']); ?>
$ownerWorkArray[$name] = $postArray[$name]; } $_SESSION['postData'] = $ownerWorkArray; # # connect to database $DBConnArray = getDBConn(); if (!$DBConnArray['ErrorReturn']['Success']) { $_SESSION['returnArray'] = $DBConnArray['ErrorReturn']['ErrorMessage']; header("Location: " . $_SERVER['HTTP_REFERER']); return; } # # Check password users table # $sql = "SELECT * FROM users as u, owners as o WHERE o.user_id = u.id AND u.email_address = '" . $ownerWorkArray['email_address'] . "' AND u.password = '******'password'] . "';"; $userArrayTemp = getDataSet($DBConnArray, $sql); $userArray = getArray('users'); foreach ($userArrayTemp['DataSet'][0] as $k => $value) { $userArray[$k] = $value; } $sql = "INSERT INTO users " . stringKeys($userArray) . " VALUES " . stringValues($userArray) . ";"; echo $sql; die; $returnArray = updateData($DBConnArray, $sql); if (!$returnArray['ErrorReturn']['Success']) { $_SESSION['returnArray'] = $returnArray['ErrorReturn']['ErrorMessage']; header("Location: " . $_SERVER['HTTP_REFERER']); return; } $lastKey = $returnArray['last_key']; #
} # get all the relevant owners... $sql = "SELECT o.* FROM owners as o, users as u\n\t\tWHERE u.id=o.user_id AND u.email_address = '" . $postArray['email_address'] . "'\n\t\tORDER BY o.collection_day, city_address;"; $returnArray = getDataSet($DBConnArray, $sql); if (!$returnArray['ErrorReturn']['Success']) { echo json_encode(array('table' => $DBConnArray['ErrorReturn']['ErrorMessage'])); return; } $collectionArray = array(); if (count($returnArray['DataSet']) > 0) { foreach ($returnArray['DataSet'] as $idx => $row) { $sql = "SELECT * FROM invoices WHERE owner_id = " . $row['user_id'] . " AND NOT paid = 'Y' order by service_date ASC;"; $invoiceArray = getDataSet($DBConnArray, $sql); foreach ($invoiceArray['DataSet'] as $i => $invoiceRow) { $sql = "SELECT c.weekly_price FROM canners as c, owners as o WHERE o.user_id = " . $row['user_id'] . " AND o.canner_id = c.user_id;"; $priceArray = getDataSet($DBConnArray, $sql); $collectionArray[$row['user_id']][] = array('invoiceDate' => $invoiceRow['service_date'], 'amount' => $priceArray['DataSet'][0]['weekly_price'], 'entered' => 'yes'); } } } $tableReturn = "<table class=table><tr><td class=tablecell>You are all paid up! Thanks!</td></tr></table>"; if (empty($collectionArray)) { echo json_encode(array("table" => $tableReturn)); return; } #################################################### # go to pay pal # if pay pal payment is success - continue # other wise, send error... #################################################### # $clientToken = Braintree_ClientToken::generate();
function updateInvoices($params) { global $DBConnArray; $userID = $params['userID']; $userEmail = $params['email']; $userFName = $params['fname']; $userLName = $params['lname']; $paymentAmount = $params['amount']; $paymentDateArray = $params['dates']; $date = date("Y-m-d"); #echo "<br>" . $userEmail; #echo "<br>" . $userFName . " " . $userLName; #echo "<br>" . $paymentAmount; #echo "<br>" . print_r($paymentDateArray, true); foreach ($paymentDateArray as $invDate) { $sql = "SELECT * FROM invoices WHERE owner_id = " . $userID . " AND service_date = '" . $invDate . "';"; $invoiceData = getDataSet($DBConnArray, $sql); if ($paymentAmount >= $invoiceData['DataSet'][0]['amount']) { $paymentAmount -= $invoiceData['DataSet'][0]['amount']; $sql = "UPDATE invoices SET paid = 'Y', " . " invoice_date ='" . $date . "' WHERE owner_id = " . $userID . " AND service_date = '" . $invDate . "';"; $returnArray = updateData($DBConnArray, $sql); } else { $paymentAmount = 0; $sql = "UPDATE invoices SET paid = 'P', " . " invoice_date ='" . $date . "' WHERE owner_id = " . $userID . " AND service_date = '" . $invDate . "';"; $returnArray = updateData($DBConnArray, $sql); } } return array('success' => true); }
public function getPaymentTypeList() { $sql = "SELECT * FROM payment_types;"; $returnArray = getDataSet($this->DBConnArray, $sql); return $returnArray['DataSet']; }
function Load() { $this->Result = getDataSet($this->TargetFile); }