Unconfigured Ad Widget

Collapse

Anúncio

Collapse
No announcement yet.

Simple calculator v1.5

Collapse
X
 
  • Filter
  • Tempo
  • Show
Clear All
new posts

  • Font Size
    #1

    Dica Simple calculator v1.5

    Fazendo umas graças no PHP, atualizei uma Apenas usuários registrados e ativados podem ver os links., Clique aqui para se cadastrar... antiga.
    Agora com melhores operações.

    Windows Style (;


    Código PHP:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Simple calculator by ar3ax - V.1.5</title>
    <!--
    |*****************************************************|
    |*****************************************************|
    |*****************************************************|
    |******|   0000    0000  00000  0000  00   00  |******|
    |******|  00  00  00  00 00    00  00  00 00   |******|
    |******|  000000  00000  0000  000000   000    |******|
    |******|  00  00  00 00  00    00  00  00 00   |******|
    |******|  00  00  00  00 00000 00  00 00   00  |******|
    |******|                                       |******|
    |******|        www.guiadohacker.com.br        |******|
    |******|       www.forum-invaders.com.br       |******|
    |******|           areax@hotmail.com           |******|
    |*****************************************************|
    |*****************************************************|
    |*****************************************************|
    -->
    <style type = "text/css">
    <!--
    .display{
        text-align:right;
        font-size:20px;
        padding:5px;
        padding-top:10px;
        padding-bottom:10px;
        border:1px solid #818C9B;
        background: rgb(217,234,244); 
        background: -moz-linear-gradient(top, rgba(217,234,244,1) 0%, rgba(242,246,248,1) 100%);
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(217,234,244,1)), color-stop(100%,rgba(242,246,248,1))); 
        background: -webkit-linear-gradient(top, rgba(217,234,244,1) 0%,rgba(242,246,248,1) 100%);
        background: -o-linear-gradient(top, rgba(217,234,244,1) 0%,rgba(242,246,248,1) 100%);
        background: -ms-linear-gradient(top, rgba(217,234,244,1) 0%,rgba(242,246,248,1) 100%);
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d9eaf4', endColorstr='#f2f6f8',GradientType=0 ); /* IE6-9 */
        background: linear-gradient(top, rgba(217,234,244,1) 0%,rgba(242,246,248,1) 100%);
    }
    .botoes{
        padding:10px;
        font-size:15px;
        border:1px solid #818C9B;
        background: rgb(242,246,248); 
        background: -moz-linear-gradient(top, rgba(242,246,248,1) 0%, rgba(216,225,231,1) 42%, rgba(181,198,208,1) 44%, rgba(224,239,249,1) 100%); 
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(242,246,248,1)), color-stop(42%,rgba(216,225,231,1)), color-stop(44%,rgba(181,198,208,1)), color-stop(100%,rgba(224,239,249,1)));
        background: -webkit-linear-gradient(top, rgba(242,246,248,1) 0%,rgba(216,225,231,1) 42%,rgba(181,198,208,1) 44%,rgba(224,239,249,1) 100%);
        background: -o-linear-gradient(top, rgba(242,246,248,1) 0%,rgba(216,225,231,1) 42%,rgba(181,198,208,1) 44%,rgba(224,239,249,1) 100%);
        background: -ms-linear-gradient(top, rgba(242,246,248,1) 0%,rgba(216,225,231,1) 42%,rgba(181,198,208,1) 44%,rgba(224,239,249,1) 100%);
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f2f6f8', endColorstr='#e0eff9',GradientType=0 ); 
        background: linear-gradient(top, rgba(242,246,248,1) 0%,rgba(216,225,231,1) 42%,rgba(181,198,208,1) 44%,rgba(224,239,249,1) 100%); 
        }
    .botoes:hover{
        padding:10px;
        font-size:15px;
        cursor:pointer;
        border:1px solid #41506d;
        background: rgb(242,245,247);
        background: -moz-linear-gradient(top, rgba(242,245,247,1) 0%, rgba(224,227,229,1) 47%, rgba(194,202,206,1) 48%, rgba(237,243,247,1) 100%); 
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(242,245,247,1)), color-stop(47%,rgba(224,227,229,1)), color-stop(48%,rgba(194,202,206,1)), color-stop(100%,rgba(237,243,247,1)));
        background: -webkit-linear-gradient(top, rgba(242,245,247,1) 0%,rgba(224,227,229,1) 47%,rgba(194,202,206,1) 48%,rgba(237,243,247,1) 100%);
        background: -o-linear-gradient(top, rgba(242,245,247,1) 0%,rgba(224,227,229,1) 47%,rgba(194,202,206,1) 48%,rgba(237,243,247,1) 100%);
        background: -ms-linear-gradient(top, rgba(242,245,247,1) 0%,rgba(224,227,229,1) 47%,rgba(194,202,206,1) 48%,rgba(237,243,247,1) 100%);
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f2f5f7', endColorstr='#edf3f7',GradientType=0 );
        background: linear-gradient(top, rgba(242,245,247,1) 0%,rgba(224,227,229,1) 47%,rgba(194,202,206,1) 48%,rgba(237,243,247,1) 100%); 
    }
    .tabela{
        background:#cfe1f3;
        padding:6px;
        border:1px #41506d solid;
    }
    .tabela td{
        padding:0px;
    }
    .tabela2{
        padding:6px;
        border:1px #41506d solid;
        background: rgb(176,196,236);
        background: -moz-linear-gradient(top, rgba(176,196,236,1) 0%, rgba(239,242,247,1) 41%, rgba(146,172,223,1) 42%, rgba(116,149,216,1) 100%);
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(176,196,236,1)), color-stop(41%,rgba(239,242,247,1)), color-stop(42%,rgba(146,172,223,1)), color-stop(100%,rgba(116,149,216,1)));
        background: -webkit-linear-gradient(top, rgba(176,196,236,1) 0%,rgba(239,242,247,1) 41%,rgba(146,172,223,1) 42%,rgba(116,149,216,1) 100%)
        background: -o-linear-gradient(top, rgba(176,196,236,1) 0%,rgba(239,242,247,1) 41%,rgba(146,172,223,1) 42%,rgba(116,149,216,1) 100%);
        background: -ms-linear-gradient(top, rgba(176,196,236,1) 0%,rgba(239,242,247,1) 41%,rgba(146,172,223,1) 42%,rgba(116,149,216,1) 100%)
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b0c4ec', endColorstr='#7495d8',GradientType=0 );
        background: linear-gradient(top, rgba(176,196,236,1) 0%,rgba(239,242,247,1) 41%,rgba(146,172,223,1) 42%,rgba(116,149,216,1) 100%);
        -webkit-border-radius: 8px;
        -moz-border-radius: 8px;
        border-radius: 8px;
    }
    -->
    </style>

    </head>
    <body>

    <?php

    $num 
    =& $_GET['num'];
    $act =& $_GET['act'];
    $display =& $_GET['display'];
    $limpar =& $_GET['limpar'];

    if(
    $num == "x^y")
    {
    $num "^";
    }
        function 
    mostrar()
        {    global 
    $num,$display,$limpar,$result,$act;
        
            if(
    $num == "C" or $display == "^")
            {
            
    false;
            }
            elseif(
    $num == "log" and !empty($display))
            {
                if(
    is_numeric($display))
                {
                print 
    log10($display);
                }
                else
                {
                print 
    "Erro de Operação";
                }
            }
            elseif(
    $num == "x^2")
            {
            print 
    pow($display2);
            }
            elseif(
    $num == "x^3")
            {
            print 
    pow($display3);
            }
            elseif(
    $act == "=")
            {
            print 
    $result;
            }
            elseif(
    $num == "v" and !empty($display))
            {
                if(
    is_numeric($display))
                {
                print 
    sqrt($display);
                }
                else
                {
                print 
    "Erro de Operação";
                }        
            }
            elseif(
    $num == "1/x")
            {
            print 
    str_replace("x",""$num)."$display";
            }
            elseif(
    $num == "pi")
            {
            print 
    pi();
            }
            elseif(
    $num == "cos" and !empty($display))
            {
                if(
    is_numeric($display))
                {
                print 
    cos(deg2rad($display));
                }
                else
                {
                print 
    "Erro de Operação";
                }    
            }
            elseif(
    $num == "sin" and !empty($display))
            {
                if(
    is_numeric($display))
                {
                print 
    sin(deg2rad($display));
                }
                else
                {
                print 
    "Erro de Operação";
                }
            }
            elseif(
    $num == "tan" and !empty($display))
            {
                if(
    is_numeric($display))
                {
                print 
    tan(deg2rad($display));
                }
                else
                {
                print 
    "Erro de Operação";
                }            
            }
            elseif(
    $num == "%" and !empty($display))
            {
            print 
    $display/100;
            }
            else
            {
            print 
    $display.$num;
            }
        }
    if(
    $act == "=")
    {
        if(empty(
    $display))
        {
        
    $result "Comece por aqui";
        }
        if(
    strstr($display,"+"))
        {
        
    $calculo explode("+"$display);
        
    $result $calculo[0] + $calculo[1];
        }
        if(
    strstr($display,"-"))
        {
        
    $calculo explode("-"$display);
        
    $result $calculo[0] - $calculo[1];
        }
        if(
    strstr($display,"*"))
        {
        
    $calculo explode("*"$display);
        
    $result $calculo[0] * $calculo[1];
        }
        if(
    strstr($display,"/"))
        {
        
    $calculo explode("/"$display);
            if(
    $calculo[0] == 0)
            {
            
    $result "0";
            }
            else
            {
            
    $result $calculo[0] / $calculo[1];
            }
        }
        if(
    strstr($display,"%"))
        {
        
    $calculo explode("%"$display);
        
    $result $calculo[0]/100;
        }
        if(
    strstr($display,"^"))
        {
        
    $calculo explode("^"$display);
        
    $result pow($calculo[0], $calculo[1]);
        }
        if(
    strstr($display,"cos"))
        {
        
    $calculo explode("cos"$display);
            if(
    is_numeric($calculo[1]))
            {
            
    $result cos(deg2rad($calculo[1]));
            }
            else
            {
            
    $result "Erro de operação";
            }
        }
        if(
    strstr($display,"tan"))
        {
        
    $calculo explode("tan"$display);
            if(
    is_numeric($calculo[1]))
            {
            
    $result tan(deg2rad($calculo[1]));
            }
            else
            {
            
    $result "Erro de operação";
            }
        
    $result tan(deg2rad($calculo[1]));
        }
        if(
    strstr($display,"sin"))
        {
        
    $calculo explode("sin"$display);
        
                if(
    is_numeric($calculo[1]))
                {
                
    $result sin(deg2rad($calculo[1]));
                }
                else
                {
                print 
    "Erro de Operação";
                }    
        }
        if(
    strstr($display,"v"))
        {
        
    $calculo explode("v"$display);
            if(
    is_numeric($calculo[1]))
            {
            
    $result sqrt($calculo[1]);
            }
            else
            {
            
    $result "Erro de operação";
            }
        }
        if(
    strstr($display,"log"))
        {
        
    $calculo explode("log"$display);
            if(
    is_numeric($calculo[1]))
            {
            
    $result log10($calculo[1]);
            }
            else
            {
            
    $result "Erro de operação";
            }
        }
    }
    ?>
    <center>
    <table class = "tabela2">
    <tr>
    <td>
    <table class = "tabela">
    <form method = "GET">
    <tr><td colspan = "6">
    <input class = "display" onkeyup="javascript:this.value=this.value.replace(/[^0-9,.+,--,/,*,^,%]/g, '');"  size = "22" type = "text" name = "display" value = "<?=mostrar()?>">
    </td></tr>
    <tr>
    <td><input class = "botoes" type = "submit" title = "Sete" name = "num" value = "7"></td>
    <td><input class = "botoes" type = "submit" title = "Oito" name = "num" value = "8"></td>
    <td><input class = "botoes" type = "submit" title = "Nove" name = "num" value = "9"></td>
    <td><input class = "botoes" type = "submit" name = "num" value = "+" title = "Soma"></td>
    <td><input style = "padding-right:7px;padding-left:6px;" class = "botoes" type = "submit" name = "num" value = "log" title = "Logaritmo"></td>
    <td><input class = "botoes" style = "padding-right:2px;" type = "submit" name = "num" value = "x^2" title = "Potência Quadrada"></td>
    </tr>
    <tr>
    <td><input class = "botoes" type = "submit" title = "Quatro" name = "num" value = "4"></td>
    <td><input class = "botoes" type = "submit" title = "Cinco" name = "num" value = "5"></td>
    <td><input class = "botoes" type = "submit" title = "Seis" name = "num" value = "6"></td>
    <td><input style = "padding-right:14px;" class = "botoes" type = "submit" name = "num" value = "-" title = "Subtração"></td>
    <td><input style = "padding-right:11px;" class = "botoes" type = "submit" name = "num" value = "%" title = "Percentagem"></td>
    <td><input class = "botoes" style = "padding-right:2px;" type = "submit" name = "num" value = "x^3" title = "POtência Cúbica"></td>
    </tr>
    <td><input class = "botoes" type = "submit" title = "Um" name = "num" value = "1"></td>
    <td><input class = "botoes" type = "submit" title = "Dois" name = "num" value = "2"></td>
    <td><input class = "botoes" type = "submit" title = "Três" name = "num" value = "3"></td>
    <td><input style = "padding-right:13px;" class = "botoes" type = "submit" name = "num" value = "*" title = "Multiplicação"></td>
    <td><input style = "padding-right:16px;" class = "botoes" type = "submit" name = "num" value = "v" title = "Raiz Quadrada"></td>
    <td><input class = "botoes" style = "padding-right:2px;" type = "submit" name = "num" value = "x^y" title = "Potência"></td>
    <tr>
    <td><input class = "botoes" type = "submit" name = "num" title = "Zero" value = "0"></td>
    <td><input style = "padding-right:14px;" class = "botoes" type = "submit" name = "num" title = "Ponto" value = "."></td>
    <td><input style = "padding-right:9px;padding-left:9px;" class = "botoes" type = "submit" title = "Limpar" name = "num" value = "C"></td>
    <td><input style = "padding-right:14px;" class = "botoes" type = "submit" name = "num" value = "/" title = "Divisão"></td>
    <td><input style = "padding-right:5px;" class = "botoes" type = "submit" name = "num" value = "1/x" title = "1/x"></td>
    <td><input style = "padding-right:10px;padding-left:11px;" class = "botoes" type = "submit" name = "num" value = "pi" title = "&pi;"></td>
    </tr>
    <tr><td colspan = "3"><input style = "padding-right:49px;padding-left:49px;" class = "botoes"  type = "submit" name = "act" title = "Resultado" value = "="></td> 
    <td><input style = "padding-right:4px;padding-left:1px;" class = "botoes" type = "submit" name = "num" value = "cos" title = "Coseno"></td>
    <td><input style = "padding-right:7px;padding-left:7px;" class = "botoes" type = "submit" name = "num" value = "tan" title = "Tangente"></td>
    <td><input style = "padding-right:7px;padding-left:7px;" class = "botoes" type = "submit" name = "num" value = "sin" title = "Seno"></td>
    </tr>
    </form>
    </table>
    </td>
    </tr>
    </table>
    </center>
    </html>
    att, ar3ax.



    areax@hotmail.com



X
Working...
X