Honesty Rocks! truth rules.

Credit System - Transfer Credits Between Members?

HOME      >>       Programming

lysvir

Ok, so I currently got a website were the users are allowed to view each others profiles (Feelays system).But im making a new feature where the members gets credits for various things they do.But I want to make a script that the members can use to transfer credits between each others.Only problem is, I have no clue how to do it?Could be something like this:Welcome -USERNAME-.Transfer credits to [------] /form box/[send] /button/


Mordent

You forgot one important thing in that little list: the number of credits you want to transfer. Unless of course you plan on sending them one at a time, or something, but anyway...

 

I roughly know Feelay's tutorial on profiles, although I lack the effort to go and have a look. From what I remember, though, he's done a tutorial on sending private messages (PMs / mail) to other users? If so, the idea of sending credits is far more simple. Basically all you're doing (ignoring the part where people receive credits, which would work in whatever way you see fit) you just need to do the following (in steps, not code, because I'm lazy and it gets you thinking rather than copying/pasting):

present the form

once user has clicked "send" check the input fields (i.e. sanitise and validate any that need doing, so no sending of negative credits, all the inputs completed etc.)

access the database

make sure the user has enough credits to send

make sure the receiving user exists

deduct that many credits from the user, add them to the credits of the receiver

display a message so the user knows

There are a lot more substeps of course, but it should get you thinking.