Some of the code is required to be able to interact with the bank.
Code: Select all
<?php
//These are the basic require files.
require_once '../../require/util.php'; //utility functions (need to connect to the server)
require_once '../../require/config.php'; //config file needed for various constants.
require_once '../../require/bankops.php'; //needed if you want to move money.
//There are more libraries at your disposal but I don't plan to go into them here.
error_reporting(E_ALL); //I require this.
begin_session(); //needed for session to work. Only put it once. and before any HTML.
$server = bank_server_connect(); //now you have a server connection.
//From here on what whatever you need/want for your addon.
//If you want to move money you'll need the transfer_funds() function.
//Here is an example of it in use.
// transfer_funds($instigator, $sender, $receiver, $funds, $reason, $server)
transfer_funds('Admin', 'Admin', 'Erik', '15.9', 'Taxes', $server)
//this will show that Admin initiated a transfer from their account to Erik's for 15.9. When logged by the function it will show the reason.
//Most of the time $instigator and $sender should be the same person. Unless you are an admin you should not be moving money from OTHER people's accounts.
//Though in some situation, when the other user authorized it, you might be moving money from their account to yours.
//But try to make all funds movements based on who hits the buttons.
//make sure to use proper XHTML and to have you ending tags. htmllib.php has some premade functions for html.
//Ask and I can send a recent copy of all required files.
?>
Code: Select all
function transfer_funds($instigator, $sender, $receiver, $funds, $reason, $server)
//Take money from one account and put it in another.
//Returns 0 on success. Returns 1 on failure due to insufficient funds.
//2 is returned if the account for the reciever did not exist.
//3 if the sender doesn't exist.
//4 if trying to send to yourself.
//5 if funds to move are neg
//6 if the reciever is an Inactive account.
//7 if the instigator is an Inactive account.
//We handle cleaning up the funds.
//handles error messages and logging.
include_once ('require/myfile.php'); this is how you should do your requires. Mine are 2 directories up the tree.