|
#1
|
||||
|
||||
(1.3.4) Banks
After over an hour of work and smashing the keyboard wondering why the forms weren't working correctly, I present to you:
banks! -Step 0- Go to phpMyAdmin, adopts_users, and create a new column with this info: Code:
Name: bank Type: int Length/Values: 11 Default: As defined 0 check the null box Create a new page for your bank from scratch. If you don't know how to make pages from scratch go here. Do not create a new page from the admincp. Create a file named bank.php in your root folder and add the following contents: PHP Code:
PHP Code:
Now go to class_member.php and add this with the other public items: PHP Code:
PHP Code:
Next, go to class_user.php and add this with the other public things: PHP Code:
PHP Code:
That should be it. Now users are able to add and withdraw from a bank account that holds their currency. As of right now, the user's money doesn't appear to go down until they go to another page and the balance doesn't appear to go up until they leave the page and come back. If anyone knows how to make it update right then and there, let me know! Be sure to let your users know that if they refresh the bank page after depositing money then it will deposit the same amount again. The same goes for withdrawing money. A "confirm resubmission" popup appears on some browsers though (including chrome), which should help avoid accidents.
__________________
Last edited by Dinocanid; 12-07-2016 at 02:02 PM. |
#2
|
||||
|
||||
Thank you for sharing! I tried it and it works perfectly.
|
#3
|
||||
|
||||
Ooh, this is interesting! Technically couldn't you make it so that after the withdraw or deposit it forwards you automatically to abother page that says a message? (Such as "Thank you for your deposit, we'll take good care of your *currency*!" Maybe a different page for withdrawing.) Then you'd see the currency update and also avoid refreshes. You could also include a "Return to bank" option so people can still do things in it. The button would just link you to the bank again instead of back a page. Just my thoughts ^_^ This would mean extra pages. .. but to avoid users potentially complaining I'd put up with that XD
|
#4
|
||||
|
||||
That does sound like it would cause less problems in the long run xD
It wouldn't take me very long to add either since I have much of the base done. I'll probably work on it tonight.
__________________
|
#5
|
||||
|
||||
Ok! ^_^ I have to say the bank will be such a great feature T-T Thanks XD So helpful to have XD
|
#6
|
||||
|
||||
You've actually set it up perfectly to add a little back button that will bring you back to the bank without refreshing. Just add this under comments for withdrawing and depositing:
PHP Code:
__________________
My Mods Site (1.3.4, 2020 Mods) |
#7
|
||||
|
||||
Looks nice, congratulations. You may want to make this into a Mod/Plugin, if you can.
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#8
|
||||
|
||||
@HOF: Would I just post the updated version in the mods section? I'm not entirely sure how plugins work but I see a spot for it in the adminCP. Is it related to that?
@Abrosynth: It works perfectly, thanks! I'll add it in.
__________________
|
#9
|
||||
|
||||
Yeah it will be good this way. If possible, upload modified files as attachment in your thread so users with fresh installation of Mysidia can just download/upload easily.
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#10
|
||||
|
||||
EDIT: NVM I was a ***** and forgot the table step...its been a long day
So I followed the instructions- but when I go to deposit money I get this error.. Fatal error: Uncaught exception 'Exception' with message 'Database error 1054 - Unknown column 'bank' in 'field list'' in /home/atrocity/public_html/classes/class_database.php:213 Stack trace: #0 /home/atrocity/public_html/classes/class_database.php(142): Database->_query('users', Array, 'select', NULL) #1 /home/atrocity/public_html/view/bankview.php(19): Database->select('users', Array) #2 /home/atrocity/public_html/classes/class_frontcontroller.php(100): BankView->index() #3 /home/atrocity/public_html/index.php(78): FrontController->render() #4 /home/atrocity/public_html/index.php(82): IndexController::main() #5 {main} thrown in /home/atrocity/public_html/classes/class_database.php on line 213 Last edited by Ittermat; 12-09-2016 at 09:20 PM. |
Thread Tools | |
Display Modes | |
|
|
What's New? |
What's Hot? |
What's Popular? |