Banking System for Activity Points

  • Hello everyone, im currently working on a Banking System for the Activity Points system. I have the event listener and the actual form already.


    The only problem im having trouble with is that whenever I try to submit the form, no points are put into the field "banked" in the wcf1_user table.
    Anyone have any idea on how I can make a working event listener and submission for such a script.


    Im thinking something like this:


    This is from an old script I had, how can I convert this into the new coding that WBB3 uses?


    PHP
    1. $db_connect->query("UPDATE db_users SET usermoney='$newmoney' WHERE userid = '$user_id'");
    2. $db_connect->query("UPDATE db_users SET userbankmoney='$newbank' WHERE userid = '$user_id'");
    3. $db_connect->query("UPDATE db_users SET bankinserttime='$time' WHERE userid = '$user_id'");


    Thank you for your time!

  • I think it is unlikely someone can help you unless you provide more detailed information (e.g. the code).

    FSK 12 - Der Gute kriegt das Mädchen
    FSK 16 - Der Böse kriegt das Mädchen
    FSK 18 - Alle kriegen das Mädchen

  • Thats the whole problem, I don't know where to start with the coding part of it. I just drew up a few ideas as you can see in the first post.
    Anyone know a code I can use to save a form with a substraction and addition factor in there?


    Something like:


    PHP
    1. $bankedpoints = $activityPoints-$query;
    2. $withdrawedpoints = $activityPoints+$query;


    thank you!

  • You should have a look at the file wcf/lib/form/AbstracForm.class.php. This class provides a default implementation for the Form interface.
    You can define your own form (you should also take a look at some of our (less complex) forms like EmailChangeForm for example.



    You can increment/decrement values in your database like this:

    SQL
    1. UPDATE table SET field = field + 35;
    2. UPDATE table SET field = field - 20;

    FSK 12 - Der Gute kriegt das Mädchen
    FSK 16 - Der Böse kriegt das Mädchen
    FSK 18 - Alle kriegen das Mädchen