All pastes #901977 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-02-13 01:59 UTC
rendered paste body
Choco has 30 posts.
Nor has 20 posts.

Choco is selling a skin print for $15. 
Nor wants the skin print.

When Exode (another user) loads the topic, the script goes and checks if Nor and Choco have sent/recieved any money ever. It finds out that they haven't. So if you get $5 per post, Choco has:
$150
And Nor has:
$100

Now, Nor clicks Send Money to choco. He sends Choco $15.
Nor should now have $85, while choco should have $165.

So Exode reloads the page. 
Script goes and multiplies post counts and sees that Choco should have 30 posts * $5 and Nor should have 20 posts * $5, just like before -- $150 and $100.
But wait! Choco and Nor made a transaction. So script goes and looks at table. Table looks like this:

T-ID ~~ User 1 ~~ User 2 ~~ Amount of Money
--------------------------------------------
 1   ~~ Nor    ~~ Choco  ~~ $15

The script is figuring out Nor's first. It searches the table for any transactions that Nor made. It finds T-ID 1. It sees that Nor sent $15 away. So it subtracts $15 from $100 and gets $85. It stores this in array $curMoney.
Now, time for Choco. It searches the transactions for Choco. It finds TID 1. It sees that Choco got $15. It adds $15 to $150 and gets $165. It puts this in $curMoney.

Now, the script sends $curMoney back to the javascript, where the javascript puts the crap on the posting page.