How do I make a cash/point, system on my website?

Discussion in 'Code Snippets and Tutorials' started by LukasTheCheater, Nov 5, 2009.

  1. LukasTheCheater

    LukasTheCheater Level II

    Joined:
    Sep 29, 2009
    Messages:
    272
    Likes Received:
    1
    I have a freewebs, and was wondering how to create a cash/point system for it? Does anybody know?
     
  2. Zer0

    Zer0 Level IV

    Joined:
    Mar 2, 2008
    Messages:
    3,037
    Likes Received:
    180
    Location:
    Home sweet home
    Well. If you're running a forum you'll have to find a cash/point mod for it. Otherwise you can implement one using PHP along with a SQL database.

    So essentially you'll have to either use a pre-made system or learn how to use PHP/SQL.
     
  3. LukasTheCheater

    LukasTheCheater Level II

    Joined:
    Sep 29, 2009
    Messages:
    272
    Likes Received:
    1
    OK, So anyone have a premade one? It would also be very helpful if someone wanted to mentor me. for neofriend cash or what ever.
     
  4. Zer0

    Zer0 Level IV

    Joined:
    Mar 2, 2008
    Messages:
    3,037
    Likes Received:
    180
    Location:
    Home sweet home
    Well, it depends on whether you're running a forum or not. If you are, then there will probably one premade for you. Just search in the forum software's mod database.

    Otherwise, you're out of luck. You'll have to program it yourself which will require you to learn at the very least some minimal PHP and SQL. Google up some tutorials, there are plenty of them out there.
     
  5. LukasTheCheater

    LukasTheCheater Level II

    Joined:
    Sep 29, 2009
    Messages:
    272
    Likes Received:
    1
    Ok, I guess its gonna be complicated, I kinda figured out how, I'm trying to make a game/point system.
     
  6. HeartLess

    HeartLess Newbie

    Joined:
    Aug 31, 2010
    Messages:
    13
    Likes Received:
    0
    Its really not that complicated... Do you have access to the sql stuff for your website?

    in your table for users, add a column labeled "money"

    ALTER TABLE users
    ADD money INT(11) NULL DEFAULT '0'

    then, in your php files, you can basically go like this...

    $query = "SELECT * FROM ".$prefix."users WHERE username = '".$loggedinname."'";
    $result = mysql_query($query);
    $num = mysql_numrows($result);
    $i=0;
    while ($i < 1) {
    $money=@mysql_result($result,$i,"money");
    $i++;
    }

    and get your money variable... after that, you can add money, subtract money, do whatever you want with the variable and save it to variable $newmoney

    then...

    $query = "UPDATE ".$prefix."users SET money='".$newmoney."' WHERE username = '"(name of user)"'";
    mysql_query($query);

    not too bad... just adding a couple simple lines of code...