Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default [PHP/MySQL] Timestamps

    How would you go about creating a VIP system. For example a member has 50 credits and Blue VIP costs 50 credits they click "Buy This" and they get vip for 30 days.

    How would you do that last bit where it inserts ? into the database and counts down the days left until renewal.
    And when it ends the Username markup goes back to normal.

    +rep
    Ash


  2. #2
    Join Date
    Jan 2007
    Posts
    7,652
    Tokens
    0

    Latest Awards:

    Default

    Sorry i don't have a clue what you are going on about

    Edited by Bomb-Head (Forum Moderator): Please don't post pointlessly, thanks
    Last edited by Bomb-Head; 13-05-2007 at 06:56 PM.

  3. #3
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    Please only post if you know what your on about.
    I want to know how would i go about making a VIP system


  4. #4
    Join Date
    Mar 2007
    Posts
    41
    Tokens
    0

    Default

    Hi there,

    Your best bet is to have the database know when the user signed up for VIP - that way, you could then setup a cron job to run nightly and remove the VIP when 30 days are over.

    Alternatively, and probably the least resource-hungry method would be to check this value upon login. That makes it easier to show the user a message alerting them that their membership is no more.

  5. #5
    Join Date
    Dec 2006
    Posts
    577
    Tokens
    0

    Default

    You need to no mysql and php advanced

  6. #6
    Join Date
    Jun 2005
    Posts
    2,688
    Tokens
    0

    Latest Awards:

    Default

    To work out the 30 days just do something like: -

    PHP Code:
    <?
    $expire 
    time()+2592000;
    ?>
    Then to work out if it has expired or not: -

    PHP Code:
    <?

    $sql 
    "select * from tablename where user_id = '"$user ."' limit 1";
    $query mysql_query($sql); if(!$query) { die(mysql_error()); }
    $vip mysql_fetch_array($query);

    if(
    $vip['expire']<time()) {

    echo 
    "VIP Expired";

    }else{

    echo 
    "VIP Inuse!";

    }

    ?>
    The code above doesn't exactly use much system resource so it can be checked on each page click so no cron jobs are required.

  7. #7
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    Thanks, +rep to alan and datfmoo


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •