/* Open a confirmation warning variable, which will be used to store any warnings
 generated by the verification system */
 $ConfirmationWarning = "";
 /* Include the verifytrade.php file, which includes the required functions for the
 trade verification system */
 include "verifytrade.php";
 /* Clean up the amount field to ensure that it is a number, and clean up the
 description */
 $Amount = MakeCurrency($Amount);
 $Description = stripslashes($Description);
 /* Check that the accounts exist */
 if ($EnteredBy == 'buyer') {
     $SellerID = ExistsAccount($SellerID);
     $SellerAccountName = $AccountName;
 } else {
     $BuyerID = ExistsAccount($BuyerID);
     $BuyerAccountName = $AccountName;
 }
 /* Check that the accounts have trading priveleges 
 (Credit Limit is greater than zero) */
 if ($EnteredBy == 'buyer') {
     if (NoCredit($BuyerID)) {
         $title = 'Trading not authorized';
         include 'header.php';
         print "<h1>Trading Not Authorized</h1>\n               \t\t\t<strong>Your account has no trading priveleges on {$Systemname}.</strong><p>\n\t\t\t\tif you think that your account should be authorized to change, or wish to make changes to your account status, please contact the <a href='mailto://{$SystemEmail}'>{$Systemname} Administrator</a>,";
         include 'footer.php';
         exit;
     }
     if (NoCredit($SellerID)) {
         $title = 'Seller Account not authorized';
         include 'header.php';
/* call the adminlogin file to ensure admin level access */
include "adminlogin.php";
/* check to see if the Function variable is set to Process.  If so, verify
and record all trades. */
if (empty($Function)) {
    $Function = "";
}
if ($Function == 'Process') {
    include "verifytrade.php";
    include "recordtrade.php";
    /* Process each transaction form */
    for ($trade = 0; $trade < 10; $trade++) {
        /* Check that the submitted accounts exist, and that the Amount field is
        numeric */
        $SellerID["{$trade}"] = ExistsAccount($SellerID["{$trade}"]);
        $BuyerID["{$trade}"] = ExistsAccount($BuyerID["{$trade}"]);
        $Amount["{$trade}"] = MakeCurrency($Amount["{$trade}"]);
        /* Don't process if no data is entered, or if only partial data is submitted.
        Set the Result[] variable to contain a response to the user, as appropriate */
        if (empty($SellerID["{$trade}"]) && empty($BuyerID["{$trade}"]) && empty($Description["{$trade}"]) && empty($Amount["{$trade}"])) {
            $Result["{$trade}"] = "No trade data entered.";
        } elseif (empty($SellerID["{$trade}"]) || empty($BuyerID["{$trade}"]) || empty($Description["{$trade}"]) || empty($Amount["{$trade}"])) {
            $Result["{$trade}"] = "Not processed.  <em>Submitted Trade Data incomplete or contains invalid AccountID</em>.";
        } else {
            /* Check for expired accounts */
            if (IsExpired($SellerID["{$trade}"])) {
                $Result["{$trade}"] = "Not Processed.  <em>The Seller account has expired</em>.";
            } 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')) {