function transferMoney() { // Globals global $MySelf; global $DB; global $TIMEMARK; $MyCredits = getCredits($MySelf->getID()); // Can we afford even the most basic transactions? if (!numericCheckBool($MyCredits, 0)) { makeNotice("You can not afford any transaction.", "warning", "Out of money", "index.php?action=manageWallet", "[cancel]"); } // Did we supply an isk amount at all? if ($_POST[amount] == "") { makeNotice("You did not specify an ISK amount. Please go back, and try again.", "warning", "How much?", "index.php?action=manageWallet", "[cancel]"); } if (!is_numeric($_POST[amount])) { makeNotice("The frog looks at you and your cheque with the amount of \"" . $_POST[amount] . "\". The frog is unsure how much ISK that is and instead decides to lick your face in a friendly manner, then it closes the teller and goes for lunch.", "warning", "Huh?"); } // Check for sanity. if (!numericCheckBool($_POST[to], 0)) { makeNotice("The supplied reciver is not valid.", "warning", "Invalid ID", "index.php?action=manageWallet", "[cancel]"); } if (!numericCheckBool($_POST[amount], 0)) { makeNotice("You need to specify a positive ISK value.", "error", "Invalid amount", "index.php?action=manageWallet", "[cancel]"); } if (!numericCheckBool($_POST[amount], 0, $MyCredits)) { makeNotice("You can not afford this transaction.", "warning", "Out of money", "index.php?action=manageWallet", "[cancel]"); } // Ok so now we know: The reciver is valid, the sender has enough money. $from = "<br><br>From: " . ucfirst($MySelf->getUsername()); $to = "<br>To: " . ucfirst(idToUsername($_POST[to])); $amount = "<br>Amount: " . number_format($_POST[amount], 2) . " ISK"; $reason = "<br>Reason: " . $_POST[reason]; confirm("Please authorize this transaction:" . $from . $to . $amount . $reason); // Lets do it. $transaction = new transaction($_POST[to], 0, $_POST[amount]); $transaction->setReason("Cash transfer from " . ucfirst($MySelf->getUsername()) . " to " . ucfirst(idToUsername($_POST[to])) . ": " . $_POST[reason]); $transaction->isTransfer(true); $transaction->commit(); // Send'em back. makeNotice($amount . " has been transfered from your into " . ucfirst(idToUsername($_POST[to])) . " account.", "notice", "Cash transfered", "index.php?action=manageWallet", "[OK]"); }