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 5 of 5
  1. #1
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default Whats wrong with my script!

    Ive made a function to unban an acount from my usersystem automaticly, when they login on a banned account this function executes (ive removed the getting the unban time from the database from the top and replaced it with $date so its eaysier to understand)
    PHP Code:
    $date "21/08/2007 14:38";

    $datetime explode(" "$date);
    $timeexplode explode(":"$datetime['1']);

    $dateexplode explode("/"$datetime['0']);

    $dateday date("d");
    $datemonth date("m");
    $dateyear date("Y");

    $timehour date("G");
    $timemin date("i");

    function 
    unban()
    {
        
    //unban function
            
    echo "unbanned";
    }

    if (
    $dateyear >= $dateexplode['2']) {
            if (
    $datemonth >= $dateexplode['1']) {
                    if (
    $dateday >= $dateexplode['0']) {
                            if (
    $timehour >= $timeexplode['0']) {
                                    if (
    $timemin >= $timeexplode['1']) {
                                            
    unban();
                                    }
                            }
                    }
            }
    }
    ?> 
    Ive been looking for an error for about 20 minutes but I can't find one +rep if someone can help me

    Moved by Invent (Forum Moderator) from Designing & Development: Please post in the correct forum next time, thanks .
    Last edited by Invent; 24-08-2008 at 01:25 AM.
    Lets set the stage on fire, and hollywood will be jealous.

  2. #2
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    The issue is with lines like this:
    PHP Code:
                    if ($dateday >= $dateexplode['0']) { 
    Your checking if today (the 20th) is more than the day you've preset (if you get me lol) which in this circumstance it isn't...

    So you're checking if the 20th is more than the 21st, lol.
    Last edited by Invent; 20-08-2008 at 01:16 PM.

  3. #3
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    But wouldn't that be right then, $date is the unban date so if the 20th isnt more than the 21st it does nothing, but if it is it checks the time. I have allso tried putting the date as the 20th with the unban time before the time now, but it wouldn't work.

    Sorry if what i said was confusing, im not very good at explaining it
    Lets set the stage on fire, and hollywood will be jealous.

  4. #4
    Join Date
    Aug 2008
    Location
    Australia!
    Posts
    33
    Tokens
    0

    Default

    Use the PHP time() function.
    This gets the amount of seconds from 1 January 1970 or something.
    Then simply, add the amount of seconds, for example, 2 hours; 7200 seconds (60 x 60 x 2).
    Then, you set this into a database; time() + 7200.
    Then, if(time() >= databasetime){
    unban;
    }

    Hope this helps...

  5. #5
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    Thanks Ryzie Thats a lot eaysier than all those ifs
    Lets set the stage on fire, and hollywood will be jealous.

Posting Permissions

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