case 1:
        $title = 'Unable to Process';
        include "header.php";
        print "<h2>Account Balance Too High</h2>\n\t\tYour account, number {$ToAccount}, has a balance that exceeds the permitted maximum.  You cannot enter this cheque until your balance returns to within acceptable limits.";
        include "footer.php";
        exit;
        break;
    case 2:
        $SellerOver = "<strong>WARNING:</strong>";
        break;
    default:
}
// seems all is good.  Now we can record the trade.
include "recordtrade.php";
// get a transaction ID
$transIDtime = time();
mysql_query("INSERT INTO transidlookup\n\t\t VALUES ('','{$transIDtime}','{$MemberID}')");
$transIDlookup = mysql_query("SELECT TransactionID FROM transidlookup\n\t\t\t      WHERE Time = {$transIDtime}\n\t\t\t      AND MemberID = {$MemberID}");
$TransactionID = mysql_result($transIDlookup, 0, 'TransactionID');
// update the Cheque table to show Transaction ID
mysql_query("UPDATE cheques\n\t\tSET TransactionID = {$TransactionID}\n\t\tWHERE ChequeID = {$ChequeID}");
// enter the transaction
SubmitTrade($TransactionID, $Cheque["AccountID"], -$Amount, "Cheque {$ChequeID}: {$Memo}", $ToAccount);
SubmitTrade($TransactionID, $ToAccount, $Amount, "Cheque {$ChequeID}: {$Memo}", $Cheque["AccountID"]);
ProcessFee($TransactionID, $ToAccount, $Amount, 'sell');
ProcessFee($TransactionID, $Cheque["AccountID"], $Amount, 'buy');
$title = 'Cheque Registered';
include 'header.php';
print "<h2>Cheque Registered</h2>\n\tCheque {$ChequeID} has been registered, and the amount of {$Amount} Ecos has been transferred to Account {$ToAccount}.<p>\n\tTo have this transaction reversed, contact the <a href=mailto:{$SystemEmail}>system administrator</a><p>\n\t<hr><p>\n\t<strong>To register another cheque complete the form below:</strong><p>\n";
PrintForm('', '', '', '');
include 'footer.php';
            //編集対象番号が入力されている場合編集フォーム出力
            PrintFormEdit();
        }
        if ($_POST["delete_num"] != null) {
            //削除対象番号が入力されている場合
            DeleteData();
        } else {
            if ($_POST["edit_num"] == null) {
                //編集対象番号に入力がなければ
                WriteData();
            }
        }
    } else {
        if (isset($_POST["edit_form"])) {
            //編集フォームを入力した後の処理
            PrintForm();
            EditData();
        }
    }
}
ReadData();
//ファイルに掲示板のデータを書き込む関数
function WriteData()
{
    $keijiban_file = 'keijiban.txt';
    if (!file_exists($keijiban_file)) {
        //ファイル作成
        if (touch($keijiban_file)) {
            chmod($keijiban_file, 0777);
        }
    }
示例#3
0
		case 'save':
			$experimentid = SaveForm($enrollmentid, $formid, $val_strings, $val_numbers, $val_texts, $val_dates, $val_files, $experimentor, $experimentdate, $username, $label, $notes);
			ViewForm($experimentid, "view");
			break;
		case 'update':
			UpdateForm($experimentid, $enrollmentid, $formid, $val_strings, $val_numbers, $val_texts, $val_dates, $val_files, $experimentor, $experimentdate, $username, $label, $notes);
			ViewForm($experimentid, "view");
			break;
		case 'view':
			ViewForm($experimentid, "print");
			break;
		case 'edit':
			ViewForm($experimentid, "edit");
			break;
		case 'print':
			PrintForm($experimentid);
			break;
		default:
			echo "No action specified";
	}
	
	
	/* ------------------------------------ functions ------------------------------------ */

	/* -------------------------------------------- */
	/* ------- SetAsComplete ---------------------- */
	/* -------------------------------------------- */
	function SetAsComplete($experimentid) {
		$sqlstring = "update assessments set iscomplete = 1 where experiment_id = $experimentid";
		$result = mysql_query($sqlstring) or die("Query failed [" . __FILE__ . "(line " . __LINE__ . ")]: " . mysql_error() . "<br><i>$sqlstring</i><br>");
	}
function PrintFormEdit()
{
    $link = mysql_connect('localhost', 'homework', '2357seiken');
    if (!$link) {
        die('接続失敗です。' . mysql_error());
    }
    // print('<p>接続に成功しました。</p>');
    $db_selected = mysql_select_db('keijiban', $link);
    if (!$db_selected) {
        die('データベース選択失敗です。' . mysql_error());
    }
    //パスワード認証のための処理
    $sql = sprintf("SELECT * FROM toukou WHERE num=%d", $_POST['edit_num']);
    $result = mysql_query($sql);
    if (!$result) {
        die('SELECTクエリーが失敗しました。' . mysql_error());
    }
    $edit = mysql_fetch_assoc($result);
    $password = $edit['password'];
    if ($_POST['password'] == $password) {
        print '<form action="kadai2-ouyou.php" method="post">
                        編集を行ってください<br />
                        名前 :<br />
                        <input type="text" name="name_edit" size="30" value=' . $edit['name'] . ' /><br />
                        コメント :<br />
                        <input type="text" name="comment_edit" size="30" value=' . $edit['comment'] . ' /><br />
                        <input type="submit" value="送信">
                        <input type="hidden" name="edit_done" value=' . $_POST['edit_num'] . '>
                        <input type="hidden" name="edit_form">
                   </form>';
    } else {
        echo "パスワードが正しくありません。<br>";
        PrintForm();
    }
    $close_flag = mysql_close($link);
    if (!$close_flag) {
        print '<p>切断に失敗しました。</p>';
    }
}
function PrintFormEdit()
{
    $keijiban_file = 'keijiban.txt';
    $fp = fopen($keijiban_file, 'rb');
    $list = file($keijiban_file);
    //パスワード認証
    $item = explode("<>", $list[$_POST['edit_num'] - 1]);
    if ($_POST['password'] == intval($item[4])) {
        foreach ($list as $key => $value) {
            $item = explode("<>", $value);
            if ($item[0] == $_POST['edit_num']) {
                print '<form action="kadai2-6.php" method="post">
	                        編集を行ってください<br />
	                        名前 :<br />
	                        <input type="text" name="name_edit" size="30" value=' . $item[1] . ' /><br />
	                        コメント :<br />
	                        <input type="text" name="comment_edit" size="30" value=' . $item[2] . ' /><br />
	                        <input type="submit" value="送信">
	                        <input type="hidden" name="edit_done" value=' . $item[0] . '>
	                        <input type="hidden" name="edit_form">
	                   </form>';
            }
        }
    } else {
        PrintForm();
        print "パスワードが異なっています。";
    }
    fclose($fp);
}
 case 'DeleteCredit':
     mysql_query("DELETE FROM creditlimits\n\t\t\t      WHERE AccountTypeID = '{$AccountTypeID}'\n\t\t\t       AND TradeVolume = '{$TradeVolume}'\n\t\t\t       AND CreditLimit = '{$CreditLimit}'");
     mysql_query("INSERT INTO adminactions\n\t\t\t      VALUES (NELL,'{$MemberID}','Deleted {$CreditLimit} Eco credit limit from {$AccountTypeName} Account Type')");
     $title = "{$AccountTypeName} Options -- Credit Limit Removed";
     include "header.php";
     print "<h3>Credit Limit Removed</h3><hr>";
     PrintForm($AccountTypeName, 'EditCurrent');
     include "footer.php";
     exit;
 case 'AddCredit':
     mysql_query("INSERT INTO creditlimits\n\t\t\t      VALUES ('{$AccountTypeID}','{$TradeVolume}','{$CreditLimit}')");
     mysql_query("INSERT INTO adminactions\n\t\t\t     VALUES (NULL,'{$MemberID}','Add {$CreditLimit} Eco credit limit to {$AccountTypeName} Account Type')");
     $title = "{$AccountTypeName} Options -- Credit Limit Added";
     include "header.php";
     print "<h3>Credit Limit Added</h3><hr>";
     PrintForm($AccountTypeName, 'EditCurrent');
     include "footer.php";
     exit;
 case 'DeleteType':
     $lookupid = mysql_query("SELECT AccountTypeID FROM accounttypeoptions\n                \t\t        WHERE AccountTypeName = '{$AccountTypeName}'");
     $AccountTypeID = mysql_result($lookupid, 0, "AccountTypeID");
     $lookupaccounts = mysql_query("SELECT * FROM account\n                \t\t\t      WHERE AccountTypeID = '{$AccountTypeID}'");
     switch (mysql_num_rows($lookupaccounts)) {
         case 0:
             $title = "Delete {$AccountTypeName} account type";
             include "header.php";
             print "<h2>Confirm Delete</h2>\n                                \tYou have asked to have the {$AccountTypeName} account type removed from the system.  Please confirm this request by clicking the button below.<p>\n                                        <form action=accountoptions.php method=post>\n                                        <input type=hidden name=AccountTypeName value='{$AccountTypeName}'>\n                                        <input type=hidden name=Function value='ConfirmDelete'>\n                                        <input type=submit value='Delete the {$AccountTypeName} account type'><p>";
             include "footer.php";
             exit;
         default:
             $title = "Cannot Delete {$AccountTypeName}";