[BETA] Bank

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post by LaZeR » Sat Dec 28, 2002 5:16 am

lovecraft wrote: Since Zarath is not interested, I will carry on with his work, right now I'm working on i18n and moving the HTML code away from php files and into templates. I will start with loans after the holidays.
Should I continue with this thread or start a new one?


Cool, this mod is nice but it has so much potential yet. I would like to see the Admin section to include a running accounts list per member also along with transaction records if possible. Loans is a neat idea also. 8)

Questions
Registered User
Posts: 705
Joined: Mon Sep 30, 2002 11:06 pm
Location: Cyberspace Learning: PHP & MySQL
Contact:

Post by Questions » Sun Dec 29, 2002 7:09 pm

i agree with LaZeR :wink:
I will Install MODs to your forum, or install a fresh phpBB 2.0.10 to your host for reasonable prices.
Contact me via AIM @: Gam LDub


(Please note: I use paypal as my money transaction, so before you contact me to do any work to your site, make sure you have one. Thank you.)

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Tue Dec 31, 2002 7:05 am

**IMPORTANT**

If anyone has downloaded this mod, please download it again as soon as possible and change your bank.php file with the one in the new zip.

The old one has a rather large bug in it that allows people to input a negative number. If this number was big enough it would probably cycle around and set the int to 45345345345 points. (not exact) :P

pollix
Registered User
Posts: 153
Joined: Tue Jul 23, 2002 6:29 pm
Location: Ridgecrest, CA
Contact:

Post by pollix » Thu Jan 02, 2003 9:52 am

Ok.. I know everyone has been waiting for this and I've spent about 2 days working on this.

I've created a Loan_Mod add on to this bank_mod. It's very late right now so I don't have time to do documentation. I'll get to it first thing tomorrow. I need some beta testers to make sure it works. I already know of one bug, and I have to ask zarath about it. The bug doesn't effect the operation of this mod. :wink:

To view it in action... go to http://www.drunksquids.com/bank.php log in with the following info:

username: test
password: test123

WARNING: If your the first couple of users try this.. you can only take out what you have in savings. Please only take out loans of no more that $5 dollars at anyone time. I want to be able to let others test this too! I currently have the loan limit set to $1000. You can only take out a max loan of $500 at anyone time. Right now... all above numbers are hard coded in. I will be making ACP availability so admins can change the loanlimit and max one time loan price.

One thing you will notice is that I have the loan rate set at 30%. In my opinion it will be hard to get users to pay back there loan, so I charge in the beginning. I will try to implement a way to take back money in the ACP.

Please test this for me so that I may go farther with this mod.

Thanks.

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Thu Jan 02, 2003 11:11 am

hmm, the page crashes everytime I try to put in a large number...

It doesn't seem to limit me (I've now got over 1500 in loans).

A couple of problems, you have the limits on in bank and in hand, if it = over 1000, it stops them loaning anymore... people can just spend it, give it away, then loan more.

Here's the major problem, people can create an alternate account, loan 4534534534 from the bank then give it to someone else and never use the character again.

Solution for this?
Add another row, keep the loaned out amount in it, when someone goes to donate, you'll need to edit the userpointscp.php and make it check the userpoints to loaned amount, if it drops it below the loaned amount it will have to error.

How do you have the interest charged on the loans? Using the same Loop I have on interest backwards?

Also, a field to display how much you've loaned out would be nice.

It's coming along nicely though :P

r_taylor883
Registered User
Posts: 32
Joined: Sat Dec 28, 2002 11:44 pm

Post by r_taylor883 » Thu Jan 02, 2003 1:57 pm

Suggestion for loan mod: If somebody can't pay it back, they get banned. Lol.

pollix
Registered User
Posts: 153
Joined: Tue Jul 23, 2002 6:29 pm
Location: Ridgecrest, CA
Contact:

Post by pollix » Thu Jan 02, 2003 5:30 pm

Zarath wrote: hmm, the page crashes everytime I try to put in a large number...

I do not have this problem. I've tried an extremely huge number and I get the results I created. "You can only take out a maximum of $500 bucks at any one time."
zarath wrote: It doesn't seem to limit me (I've now got over 1500 in loans).


Not sure what you did.. but I went into the 'test' account and there was a total of $1200 in savings account. I tried to take out a $200 loan and it stopped me by saying "You already have enough drunk bucks in your account." (which I wanted it to do this. That way you can't keep taking out loans.)
zarath wrote: A couple of problems, you have the limits on in bank and in hand, if it = over 1000, it stops them loaning anymore... people can just spend it, give it away, then loan more. Here's the major problem, people can create an alternate account, loan 4534534534 from the bank then give it to someone else and never use the character again.


yes I'm aware of this. I just wanted to get the base code out first to see if it will work or not. I'm really not sure how to counter act this. I'm still new to php.
zarath wrote: Solution for this?
Add another row, keep the loaned out amount in it, when someone goes to donate, you'll need to edit the userpointscp.php and make it check the userpoints to loaned amount, if it drops it below the loaned amount it will have to error.


I'll have to look into this.
zarath wrote: How do you have the interest charged on the loans? Using the same Loop I have on interest backwards?


This is what I have... could you look it over and make a comment.

Code: Select all

$loan = round($loan);
        if ((!is_numeric($loan)) || ($loan < 1)) { message_die(GENERAL_MESSAGE, 'Invalid Loan Amount!'); }
        if ($loan > 500) (message_die(GENERAL_MESSAGE, 'The maximum takeout loan is $500 '.$bankinfo[7].' at any one time.'));
        $loancharge = round($loan / 100 * $bankinfo[11]);
        if ($loan > $row[holding]) { message_die(GENERAL_MESSAGE, 'You don\'t have enough '.$bankinfo[7].' in the bank to cover your loan request!'); }
        if ($urow[user_points] >= 1000) (message_die(GENERAL_MESSAGE, 'Your loan for '.$bankinfo[7].' is denied.  You already have enough '.$bankinfo[7].' in hand.'));
        if ($row[holding]>= 1000) (message_die(GENERAL_MESSAGE, 'Your loan for '.$bankinfo[7].' is denied.  You already have enough '.$bankinfo[7].' in your account.'));
        $newbalance = $row[holding] + $loan - $loancharge;
        $newpoints = $urow[user_points];
zarath wrote: Also, a field to display how much you've loaned out would be nice.

It's coming along nicely though :P


Zarath... thanks for your inputs! I'm actually having fun with this while learning.

User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post by LaZeR » Thu Jan 02, 2003 5:48 pm

Great idea pollix, I'm glad to see somebody taking this mod even further. This type of feature (loans) that you are working on will take it to greatness. Psst: Transactions records would top it off!

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Fri Jan 03, 2003 12:51 am

Hmm, I'm not sure where you have that code, it has to be in the loop at the top of the bank code. So it charges interest on loans everytime it charges normal interest on accounts.

It should probably look something like this:

find

Code: Select all

if ($restockntime - $bankinfo[8] > $bankinfo[2])
{
	$sql = "update " . CONFIG_TABLE . " set config_value='$restockntime' where config_name='banklastrestocked'";
	if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Updating Bank Time!'); }
	$sql = "select * from phpbb_bank";
	if ( !($uiresult = $db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Error Getting Bank Users!'); }
	for ($x = 0; $x < mysql_num_rows($uiresult); $x++)
	{
		$holding = "";
		$holdingplus = "";
		$uirow = mysql_fetch_array($uiresult);
		$holdingplus = $uirow['holding'] / 100 * $bankinfo[0];
		$holding = $uirow['holding'] + $holdingplus;
		$holding = round($holding);
		$usql = "update phpbb_bank set holding='$holding' where name='$uirow[name]'";
		if ( !($db->sql_query($usql)) ) { message_die(GENERAL_MESSAGE, 'Error Giving Interest Out!'); }
	}
}
replace that with

Code: Select all

if ($restockntime - $bankinfo[8] > $bankinfo[2])
{
	$sql = "update " . CONFIG_TABLE . " set config_value='$restockntime' where config_name='banklastrestocked'";
	if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Updating Bank Time!'); }
	$sql = "select * from phpbb_bank";
	if ( !($uiresult = $db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Error Getting Bank Users!'); }
	for ($x = 0; $x < mysql_num_rows($uiresult); $x++)
	{
		$holding = "";
		$holdingplus = "";
		$uirow = mysql_fetch_array($uiresult);
		$holdingplus = $uirow['holding'] / 100 * $bankinfo[0];
		$holding = $uirow['holding'] + $holdingplus;
		$holding = round($holding);
		if ($uirow['loan'] > 0) {
			$interest = $uirow['loan'] / 100 * $bankinfo[x];
			$newloanedamount = $uirow['loan'] + $interest;
		}
		else { $newloanedamount = $uirow['loan']; }
		$usql = "update phpbb_bank set holding='$holding', loan='$newloanedamount' where name='$uirow[name]'";
		if ( !($db->sql_query($usql)) ) { message_die(GENERAL_MESSAGE, 'Error Giving Interest Out!'); }
	}
}
Hope this helps.

narulure
Registered User
Posts: 33
Joined: Fri Dec 06, 2002 3:28 am
Contact:

Post by narulure » Fri Jan 03, 2003 2:06 am

8) so...let me get this straight. For every post 'you post'. you get one Doller?...or whatever?

For some reason im not getting any $$ points when I post?..ermm, umm
here is a address ---> HERE, Mabey someone can hep me solve this ;)

User avatar
RMS
Registered User
Posts: 517
Joined: Sun Apr 21, 2002 1:53 am
Location: I'm not sure

Post by RMS » Fri Jan 03, 2003 2:44 am

I assume you're talking about the points strictly here, and not the bank. You need to change it in the ACP. You decide how many points someone receives per post or thread start. They should be awarded automatically after each one is made.
Then for the bank, with your total, you can open an account and deposit and withdrawl.
This is my signature.

narulure
Registered User
Posts: 33
Joined: Fri Dec 06, 2002 3:28 am
Contact:

Post by narulure » Fri Jan 03, 2003 2:46 am

8O I need the points mod......for the bank?

User avatar
RMS
Registered User
Posts: 517
Joined: Sun Apr 21, 2002 1:53 am
Location: I'm not sure

Post by RMS » Fri Jan 03, 2003 3:00 am

...what else would you put into the bank? Even if you wanted to name your points "apple seeds" to stick into your bank (called "Apple Orchard") you need the apple seeds. Not even Johnny Appleseed could've grow apple trees with dust and mosquitos. :P
This is my signature.

User avatar
thewizard
Registered User
Posts: 356
Joined: Sun Sep 29, 2002 7:46 am

Post by thewizard » Fri Jan 03, 2003 3:58 am

RMS wrote: ...what else would you put into the bank? Even if you wanted to name your points "apple seeds" to stick into your bank (called "Apple Orchard") you need the apple seeds. Not even Johnny Appleseed could've grow apple trees with dust and mosquitos. :P


lol leave it to RMS to leave a comment like that

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Fri Jan 03, 2003 6:33 am

Lmao, nice analogy there RMS

Locked

Return to “[2.0.x] MODs in Development”