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!


Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default Calculator script.

    This script was purely made out of boredom, but it was made by Independent of Habboxforum,
    I hope this script comes useful in some way.

    Newbies guide to installation..
    You can just extract the files and it will work straight away.

    http://www.calonuk.net/SCRIPTS/calculator.zip - Download it.
    http://www.calonuk.net/calculator/ - Sort of demoish.

    I know it's badly coded, but I was bored and I think someone could make good use of it.

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

    Latest Awards:

    Default

    Why have you used several files for a simple task?

  3. #3
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    Why have you used several files for a simple task?
    Because it's craply coded.

  4. #4
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    PHP Code:
    <?php
    $number1 
    $_POST["number1"];
    $number2 $_POST["number2"];
    $type $_POST["type"];
    if ( 
    $type == "+" ) {
        echo 
    $number1 $number2;
    }
    else {
        if ( 
    $type == "-" ) {
            echo 
    $number1 $number2;
        }
        else {
            if ( 
    $type == "*" ) {
                echo 
    $number1 $number2;
            }
            else {
                if ( 
    $type == "/" ) {
                    echo 
    $number1 $number2;
                }
                else {
                    exit( 
    "idiot" );
                }
            }
        }
    }
    ?>
    could do it with a lot less coding though.

  5. #5
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Dentafrice View Post
    PHP Code:
    <?php
    $number1 
    $_POST["number1"];
    $number2 $_POST["number2"];
    $type $_POST["type"];
    if ( 
    $type == "+" ) {
        echo 
    $number1 $number2;
    }
    else {
        if ( 
    $type == "-" ) {
            echo 
    $number1 $number2;
        }
        else {
            if ( 
    $type == "*" ) {
                echo 
    $number1 $number2;
            }
            else {
                if ( 
    $type == "/" ) {
                    echo 
    $number1 $number2;
                }
                else {
                    exit( 
    "idiot" );
                }
            }
        }
    }
    ?>
    could do it with a lot less coding though.
    Lmao, everyone corrects my code.
    Thanks though, I may learn something from that code ^_^

  6. #6
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    You could do it with a switch and case also, as well as many other ways, I'm half buggered at the moment anyway, 36 hours with no sleep, and enough caffeine in me to last years.

  7. #7
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Dentafrice View Post
    You could do it with a switch and case also, as well as many other ways, I'm half buggered at the moment anyway, 36 hours with no sleep, and enough caffeine in me to last years.
    Ouch.

  8. #8
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Yeah, had a couple of friends over, beat GTA IV again. Swam a little in my pool, my eyes are about as big as golf balls.

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

    Latest Awards:

    Default

    PHP Code:
    <?php

    $number1 
    $_POST["number1"];
    $number2 $_POST["number2"];
    $type $_POST["type"];

    switch( 
    $type )
    {
        
        case 
    "+":
        
            echo ( 
    $number1 $number2 );
        
        break;    
        
        case 
    "-":
        
            echo ( 
    $number1 $number2 );
        
        break;
        
        case 
    "*":
        
            echo ( 
    $number1 $number2 );
        
        break;
        
        case 
    "/":
        
            echo ( 
    $number1 $number2 );
        
        break;
        
        default:
        
            echo 
    'Please go back and choose a valid option from the drop-down menu';
        
        break;
        
    }

    ?>
    Switches ftw (I just read that Caleb suggested using them, I find them much easier to use for a script like this).
    Last edited by Invent; 09-07-2008 at 09:05 PM.

  10. #10
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    PHP Code:
    <?php

    $number1 
    $_POST["number1"];
    $number2 $_POST["number2"];
    $type $_POST["type"];

    switch( 
    $type )
    {
        
        case 
    "+":
        
            echo ( 
    $number1 $number2 );
        
        break;    
        
        case 
    "-":
        
            echo ( 
    $number1 $number2 );
        
        break;
        
        case 
    "*":
        
            echo ( 
    $number1 $number2 );
        
        break;
        
        case 
    "/":
        
            echo ( 
    $number1 $number2 );
        
        break;
        
        default:
        
            echo 
    'Please go back and choose a valid option from the drop-down menu';
        
        break;
        
    }

    ?>
    Switches ftw.
    Thanks again!

    I'm off to bed now, thanks for your code corrections Caleb/Simon.

Page 1 of 2 12 LastLast

Posting Permissions

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