} break; case 'seller': switch (OverLimit($SellerID, $Amount, 'seller')) { case 1: $title = "Account Balance Too High"; include "header.php"; print "<h1>Trade not authorized</h1>\n\t\t Your account, <strong>(Account #{$SellerID})</strong>, has a balance that exceeds the maximum allowable level.<p>\n\t\t <em>Until you bring your balance within your permitted range, further purchase by this account are not permitted.</em>\n\t\t For information or advice on how to use the system to purchase goods and services, contact the <a href=\"mailto:{$SystemEmail}\">{$Systemname} Administrator</a>.<p>\n\t\t You may attempt to re-enter this trade when your balance has been brought to within acceptable limits."; include "footer.php"; exit; case 2: $ConfirmationWarning .= "<strong>WARNING: </strong> This trade puts your account balance above the maximum allowable level. <strong>Your account will be restricted from further sales until your balance is brought to within acceptable levels.</strong><p>"; default: } if (OverLimit($BuyerID, $Amount, 'buyer')) { if (WasWarned($SellerID, $BuyerID, 'Over Limit')) { $title = "Trade not authorized"; include "header.php"; print "<h1>Trade not authorized</h1>\n\t\t Account #{$BuyerID} has surpassed the maximum allowable credit. Database records show that <em>your account (#{$SellerID}) received a warning to this effect on <strong>{$WarningDate}.</strong></em><p>\n\t\t As you have received a previous warning about the current status of this account, entry of this trade is forbidden.<p>\n\t\t If you have cause to believe that this information is incorrect or invalid, please contact the <a href=\"mailto:{$SystemEmail}\">{$Systemname} Administrator</a>."; include "footer.php"; exit; } $ConfirmationWarning .= "<strong>WARNING: </strong>The buyer account named in this transaction (Account #{$BuyerID}) is currently over the credit limit.<strong> Future sales to this account will not be permitted until such time as the account's balance is within acceptable levels.</strong><p>"; } } /* Look up a Transaction ID. This is done by inserting a timestamp and the memberID into the transactionlookup table, then querying the table for transactionID based on those same details */ $transIDtime = time(); if (!mysql_query("INSERT INTO transidlookup\n \t\t VALUES ('','{$transIDtime}','{$MemberID}')")) { $title = "Database Error";
include "footer.php"; exit; } $today = date("Y-m-d"); if ($Acct["AccountRenewalDate"] < $today) { $title = 'Unable to Process'; include "header.php"; print "<h2>Chequing Account No Longer Active</h2>\nAccount #{$Cheque['AccountID']}, on which this cheque was written, has expired without renewal. This cheque cannot be processed.\n<p><hr><p>\n"; PrintForm('', '', '', ''); include "footer.php"; exit; } /* Cheque is valid, involved accounts can trade.... Check that the trade is within credit limits */ if (OverLimit('$Cheque["AccountID"]', $Amount, 'Buyer')) { if (WasWarned("{$ToAccount}", "{$Cheque['AccountID']}", "")) { $title = 'Unable to Process'; include "header.php"; print "<h2>Insufficient Funds</h2>\nThe account on which this cheque was written, Account #{$Cheque['AccountID']}: {$Acct['AccountName']}, is extended beyond its credit limit, and members of Account #{$ToAccount} have received a previous warning about making sales to the chequing account. <p>\nRe-submission of this cheque is permitted once Account #{$Cheque['AccountID']}: {$Acct['AccountName']} has returned to within acceptable credit limits."; include "footer.php"; exit; } if (!empty($AdminType)) { mail(); } else { $SellerWarning = "<strong>WARNING: the Account from which you received this cheque, #{$Cheque['AccountID']}: {$Acct['AccountName']}, is over its limit"; } } $testseller = OverLimit($ToAccount, $Amount, 'Seller'); switch ($testseller) { case 1:
} elseif (IsExpired($BuyerID["{$trade}"])) { $Result["{$trade}"] = "Not Processed. <em>The Buyer account has expired</em>."; } elseif (AccountStatus($BuyerID["{$trade}"]) == 'Suspended' || AccountStatus($BuyerID["{$trade}"]) == 'Suspended from Buy') { if (WasWarned($SellerID["{$trade}"], $BuyerID["{$trade}"], 'Suspension')) { $Result["{$trade}"] = "Not Processed. <em>Buyer Account is under suspension and Seller has received a previous warning</em>."; } } elseif (AccountStatus($SellerID["{$trade}"]) == 'Suspended' || AccountStatus($SellerID["{$trade}"]) == 'Suspended from Sale') { if (WasWarned($BuyerID["{$trade}"], $SellerID["{$trade}"], 'Suspension')) { $Result["{$trade}"] = "Not Processed. <em>Seller Account is under suspension and Buyer has received a previous warning</em>."; } } elseif (BuyerOverLimit($BuyerID["{$trade}"], $Amount["{$trade}"])) { if (WasWarned($SellerID["{$trade}"], $BuyerID["{$trade}"], 'Over Limit')) { $Result["{$trade}"] = "Not Processed. <em>Buyer Account is over limit and Seller has received a previous warning</em>."; } } elseif (SellerOverLimit($SellerID["{$trade}"], $Amount["{$trade}"])) { if (WasWarned($BuyerID["{$trade}"], $SellerID["{$trade}"], 'Over Limit')) { $Result["{$trade}"] = "Not Processed. <em>Seller Account is over limit and Buyer has received a previous warning</em>"; } } else { /* Get a transactionID */ $transidtime = time(); if (!mysql_query("INSERT INTO transidlookup\n VALUES('','{$transidtime}','{$MemberID}')")) { $Result["{$trade}"] = "Not Processed. <em>The database was unable to lookup a transaction ID</em>."; } else { $lookuptransid = mysql_query("SELECT TransactionID\n FROM transidlookup\n WHERE Time = '{$transidtime}'\n AND MemberID = '{$MemberID}'"); $TransactionID = mysql_result($lookuptransid, 0, "TransactionID"); /* Submit the transactions */ SubmitTrade($TransactionID, $SellerID["{$trade}"], $Amount["{$trade}"], $Description["{$trade}"], $BuyerID["{$trade}"]); SubmitTrade($TransactionID, $BuyerID["{$trade}"], -$Amount["{$trade}"], $Description["{$trade}"], $SellerID["{$trade}"]); ProcessFee($TransactionID, $SellerID["{$trade}"], $Amount["{$trade}"], 'sell'); ProcessFee($TransactionID, $BuyerID["{$trade}"], $Amount["{$trade}"], 'buy');