Gossamer Forum
Home : Products : DBMan : Customization :

A type of "check book"

Quote Reply
A type of "check book"
Okay, here's the basic scoop:
I'm not sure if anyone here has heard of horse "SIM games" but they are online games where people create virtual horses and stables, and train and show them, etc. Sounds corny, but actually, it is pretty awesome because it got me into programming and I have learned so much trying to make these websites and databases and now I'm a database administration major in college.
Unfortunately, I'm still in intro classes Angelic This is where I need some help.

My newest project for my game is to create a member database/bank system. Everyone has virtual money and virtual checks are exchanged. Right now we are using a PHP database created by someone else to keep track of the money (seen at: http://www.hermesmarketing.com/chessie/bank/ ) but we would like to create a new database that can track money, like that database does, and can also track what virtual stable members keep their horses at, how many more virtual horses they can create, and what virtual tack they own. I am sure that DBman can do this, so I was wondering if anyone can help? Obviously the basic member database is very simple, but my problem comes when I try to think of a way to create "checks" that if a member submits a check, it automatically deducts money from their account and adds it to the recipient. So just to sum it up, the database should be able to:

  • Store member name, email, creation credits, member points, stable, inventory, and bank balance.
  • Only allow admins to add new members and directly edit records, BUT
  • Regular members can submit a separate form to either take away creation credits, add member points, change their stable, update their inventory, or send a check
  • All of these should be separate links and separate forms
  • They have to be approved by an admin before added
It sounds majorly complicated now that I wrote it out, but the only part I really don't know how to do is the check thing. Does that make sense?
I'm sorry if this seems silly, but actually this is a great learning experience for me, so any help would be SO appreciated Laugh
Quote Reply
Re: [Reyhan] A type of "check book" In reply to
Okay, so after playing around a bit I have gotten everything I need EXCEPT the "checks"
I looked at a checkbook register mod that was posted on the forum, but I'm not sure it will work for what I need.

Here is the basics:
http://www.hermesmarketing.com/cgi/mdb/db.cgi?db=bank

I just am not sure how to keep a running total for each user. I've looked into the arithmetic functions of perl, which are basically the same as C++ which is what I am currently most proficient in, so I understand the concept of something like, $rec{'Balance'} -= $rec{'Amount'} or something. But the problem is that each additional record is supposed to be a check, so every time I add a check to the database that is

From: Reyhan
To: George
Amount: $200
Memo: Happy Birthday

If I started out with $1000 then my balance should be permanently stored as $800 until the next time I submit a check for $500 and then my balance is only $300. And if George started out with $1000 then after both checks, his balance should be $1700.

I am currently using the relational database "mod" to bring all the afore mentioned fields into one database without having to edit each thing every time. Will I have to make the bank database a relation one too? Where the one is the User and the Balance, and the many is the checks?

Quote Reply
Re: [Reyhan] A type of "check book" In reply to
That's what I would do... (the relational thing). The hardest part will be updating the "balance". Currently I use a text file (like the db.count file or w/e it's called) to keep
a running total (in the check book register thingy). You'd probably need a text file for _each user_ that gets updated with a balance each time.

What I did in the checkbook was something like:

"Joe User" logs in..
read text file and get balance field (joe_user.txt)
Joe User writes a check (javascript deducts check amount from balance, or adds deposit as case may be and set new value of balance field)
Joe User clicks submit
add_success or modify_success opens text file and writes new balance


hmmm... you might be able to use the balance field as part of dbman (in the Joe User record) instead of a separate text file?

Anyway.. sounds like you are headed in the right direction.. happy hacking and do post what the results are!

.
Quote Reply
Re: [Watts] A type of "check book" In reply to
Uhhh... hehehe... any chance you might be able to help me out a little on this? I understand the concept of what you're saying, but my experience in configuring dbman on my own, and programming any type of javascript is VERY limited Frown

Also, this is a little unlrelated, but is there a way to automatically add a default record to a database each time you create a new user? i.e. In my relational database, I have a separate User, Inventory, and Bank databases that are all connected into one. This way someone can update their inventory without accidentally changing something in their user status, or some other weird scenario. Anyhow, the goal is to be able to add a new member to the User database and that automatically creates a new record in the Inventory and Bank databases with a corresponding username so that it can be called into the master database. But I'm not sure how to create a record in the other two databases automatically when one is created in the User database. Any thoughts?
Quote Reply
Re: [Reyhan] A type of "check book" In reply to
If all 3 databases will have the same permissions (users can: view, add, delete, modify) then you can have them all "share" the same password file

Modify this line in each of the config files to point to the same file:

# Full path and file name of the password file.
$auth_pw_file = $db_script_path . "/default.pass";

If files are in separate directories (players/banks/inventory for example) you may have to "back up" a directory and then switch the one that is the main file (say players for example)

$auth_pw_file = $db_script_path . "/default.pass"; (in players config file the line would look like this)

$auth_pw_file = $db_script_path . "../players/default.pass"; (in subdirectory "banks" config file the line would look like this)

$auth_pw_file = $db_script_path . "../players/default.pass"; (in subdirectory "inventory" config file the line would look like this)