Ir para conteúdo
Fórum Script Brasil

Tenko

Membros
  • Total de itens

    638
  • Registro em

  • Última visita

Posts postados por Tenko

  1. Olha eu de novo, esqueci de calcular a idade. rsrsrs

    <?php

    $sDate_inicio = "09/04/1980";

    $sDate_final = "09/04/2006";

    diferencaDias($sDate_inicio, $sDate_final);

    function diferencaDias( $sDate_inicio, $sDate_final)

    {

    if (strcmp(substr($sDate_inicio, 2, 1 ), "/") == 0) {

    $sDate_inicio = substr($sDate_inicio, 6, 4).substr($sDate_inicio, 2, 4).substr($sDate_inicio, 0, 2);

    $sDate_final = substr($sDate_final, 6, 4).substr($sDate_final, 2, 4).substr($sDate_final, 0, 2);

    }

    $sInicio_data = getdate(strtotime($sDate_inicio));

    $sFinal_data = getdate(strtotime($sDate_final));

    $sDif = ($sFinal_data[0] - $sInicio_data[0]) / 86400;

    // pega o Resultado da diferença dos dias e transforma na idade da pessoa

    $Idade = ceil( $sDif / 365 );

    }

    ?>

  2. Opa!!! Correção

    <?php

    $sDate_inicio = "22/10/2003";

    $sDate_final = "22/11/2004";

    diferencaDias($sDate_inicio, $sDate_final);

    function diferencaDias( $sDate_inicio, $sDate_final)

    {

    if (strcmp(substr($sDate_inicio, 2, 1 ), "/") == 0) {

    $sDate_inicio = substr($sDate_inicio, 6, 4).substr($sDate_inicio, 2, 4).substr($sDate_inicio, 0, 2);

    $sDate_final = substr($sDate_final, 6, 4).substr($sDate_final, 2, 4).substr($sDate_final, 0, 2);

    }

    $sInicio_data = getdate(strtotime($sDate_inicio));

    $sFinal_data = getdate(strtotime($sDate_final));

    echo $sDif = ($sFinal_data[0] - $sInicio_data[0]) / 86400;

    }

    ?>

  3. <?php

    $sDate_inicio = "22/10/2003";

    $sDate_final = "22/11/2004";

    date_dif($sDate_inicio, $sDate_final);

    function diferencaDias( $sDate_inicio, $sDate_final)

    {

    if (strcmp(substr($sDate_inicio, 2, 1 ), "/") == 0) {

    $sDate_inicio = substr($sDate_inicio, 6, 4).substr($sDate_inicio, 2, 4).substr($sDate_inicio, 0, 2);

    $sDate_final = substr($sDate_final, 6, 4).substr($sDate_final, 2, 4).substr($sDate_final, 0, 2);

    }

    $sInicio_data = getdate(strtotime($sDate_inicio));

    $sFinal_data = getdate(strtotime($sDate_final));

    echo $sDif = ($sFinal_data[0] - $sInicio_data[0]) / 86400;

    }

    ?>

  4. 1- Conexão com o banco de dados

    <?

    $sConexao = mysql_connect( "Host","usuario","senha" ) or die( "Erro ao conectar" );

    $sBase = mysql_select_db( "nome da base" , $sConexao ) or die( "Erro ao conectar com a base" );

    $sSql = "Select * from nome da tabela";

    $sResult = mysql_query( $sSql );

    while( $sLinhas = mysql_fetch_array( $sResult ))

    {

    echo $sLinhas[ "Nome_do_campo_da_tabela" ];

    }

    ?>

    2- Não, você instala o php e mysql somente no servido da empresa.

  5. Salve este arquivo Como : formpedido.php

    <?php

    // Pega o Valor que vem da imagem

    $iCod = $_GET[ "cod" ];

    $iCod = 2;

    ?>

    <html>

    <head>

    <title>Envia por email</title>

    </head>

    <body>

    <form method="POST" action="enviapedido.php">

    <table border="1" cellpadding="0" cellspacing="0" width="70%">

    <tr>

    <td>

    Nome

    <td>

    <td>

    <input type="text" name="txtNome">

    <input type="hidden" name="txtCodigoLogo" value="<?echo $iCod;?>">

    <td>

    </tr>

    <tr>

    <td>

    E-mail

    <td>

    <td>

    <input type="text" name="txtEmail">

    <td>

    </tr>

    <tr>

    <td colspan="3" align="center">

    <input type="submit" value=" Enviar Pedido " />

    </td>

    </tr>

    </table>

    </form>

    </body>

    </html>

    E Salve este arquivo como : enviapedido.php

    <?php

    $sCod = $_POST[ "txtCodigoLogo" ];

    $sNome = $_POST[ "txtNome" ];

    $sEmail = $_POST[ "txtEmail" ];

    // Destinatário do Email

    $sMeuMail = "seu email";

    $sDtAtual = date('d/m/Y');

    $sAssunto = "Compra de logotipo";

    $sMensagem = "O Cliente : <font color='red'><b>" . $sNome . " </b></font> <br> ";

    $sMensagem .= " ficou interessado no meu logotipo de código : <font color='red'><b>" .$sCod ;

    $sMensagem .= " </b></font> <br>Entrar em contato no Email : <font color='red'><b>".$sEmail."</b></font>";

    $sCabecalhos = "MIME-Version: 1.0" . "\r\n";

    $sCabecalhos .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

    $sCabecalhos .= "From: ".$sEmail . "\r\n";

    $sCabecalhos .= "To: <" . $sMeuMail . ">" . "\r\n";

    enviaEmail( $sEMail, $sAssunto, $sMensagem, $sCabecalhos );

    ?>

    <?php

    function enviaEmail( $sEMail, $sAssunto, $sMensagem, $sCabecalhos )

    {

    $bEnviouEmail = mail( $sEMail, $sAssunto, $sMensagem, $sCabecalhos );

    }

    ?>

  6. Salve este arquivo Como : formpedido.php

    <?php

    // Pega o Valor que vem da imagem

    $iCod = $_GET[ "cod" ];

    $iCod = 2;

    ?>

    <html>

    <head>

    <title>Envia por email</title>

    </head>

    <body>

    <form method="POST" action="enviapedido.php">

    <table border="1" cellpadding="0" cellspacing="0" width="70%">

    <tr>

    <td>

    Nome

    <td>

    <td>

    <input type="text" name="txtNome">

    <input type="hidden" name="txtCodigoLogo" value="<?echo $iCod;?>">

    <td>

    </tr>

    <tr>

    <td>

    E-mail

    <td>

    <td>

    <input type="text" name="txtEmail">

    <td>

    </tr>

    <tr>

    <td colspan="3" align="center">

    <input type="submit" value=" Enviar Pedido " />

    </td>

    </tr>

    </table>

    </form>

    </body>

    </html>

    E Salve este arquivo como : enviapedido.php

    <?php

    $sCod = $_POST[ "txtCodigoLogo" ];

    $sNome = $_POST[ "txtNome" ];

    $sEmail = $_POST[ "txtEmail" ];

    // Destinatário do Email

    $sMeuMail = "seu email";

    $sDtAtual = date('d/m/Y');

    $sAssunto = "Compra de logotipo";

    $sMensagem = "O Cliente : <font color='red'><b>" . $sNome . " </b></font> <br> ";

    $sMensagem .= " ficou interessado no meu logotipo de código : <font color='red'><b>" .$sCod ;

    $sMensagem .= " </b></font> <br>Entrar em contato no Email : <font color='red'><b>".$sEmail."</b></font>";

    $sCabecalhos = "MIME-Version: 1.0" . "\r\n";

    $sCabecalhos .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

    $sCabecalhos .= "From: ".$sEmail . "\r\n";

    $sCabecalhos .= "To: <" . $sMeuMail . ">" . "\r\n";

    enviaEmail( $sEMail, $sAssunto, $sMensagem, $sCabecalhos );

    ?>

    <?php

    function enviaEmail( $sEMail, $sAssunto, $sMensagem, $sCabecalhos )

    {

    $bEnviouEmail = mail( $sEMail, $sAssunto, $sMensagem, $sCabecalhos );

    }

    ?>

  7. <html>

    <head>

    <title>Muda Campo com Enter</title>

    <style type="text/css">

    BODY {

    scrollbar-arrow-color:000000;

    scrollbar-track-color:f2f2f2;

    scrollbar-shadow-color:cccccc;

    scrollbar-face-color:ffffff;

    scrollbar-highlight-color:ffffff;

    scrollbar-darkshadow-color:000000;

    scrollbar-3dlight-color:e2e2e2;

    }

    .titulo {font-family :verdana; font-size:14; color:white}

    .texto {font-family :verdana; font-size:12; color:darkblue}

    .alert {font-family :arial; font-size:16; color:green}

    .codigo {font-family :verdana; font-size:11; color:#000000}

    .h, A.h:link, A.h:visited, A.h:hover {font-family :verdana; font-size:11; color:#000000}

    A.h:hover {color: red}

    .h1, A.h1:link, A.h1:visited, A.h1:hover {font-family :verdana; font-size:11; color:#ffffff}

    A.h1:hover {color: skyblue}

    .box {

    border-top:1px solid #000000;

    border-bottom:1px solid #000000;

    border-left:1px solid #000000;

    border-right:1px solid #000000;

    font-family:arial;

    font-size:12px;

    color: 000000;

    background-color:#ffffff;

    }

    </style>

    <script LANGUAGE="JavaScript">

    <!-- Begin

    nextfield = "campo1"; // nome do primeiro campo do site

    netscape = "";

    ver = navigator.appVersion; len = ver.length;

    for(iln = 0; iln < len; iln++) if (ver.charAt(iln) == "(") break;

    netscape = (ver.charAt(iln+1).toUpperCase() != "C");

    function keyDown(DnEvents) {

    // ve quando e o netscape ou IE

    k = (netscape) ? DnEvents.which : window.event.keyCode;

    if (k == 13) { // preciona tecla enter

    if (nextfield == 'done') {

    alert("Os campos estão em branco !");

    return false;

    //return true; // envia quando termina os campos

    } else {

    // se existem mais campos vai para o proximo

    eval('document.form1.' + nextfield + '.focus()');

    return false;

    }

    }

    }

    document.onkeydown = keyDown; // work together to analyze keystrokes

    if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP);

    // End -->

    </script>

    </head>

    <body>

    <form action="" method="post" name="form1" onSubmit="return checa(this);">

    <center>

    <table border="0" cellspacing="0" cellpadding="0" width="50%">

    <tr>

    <td class="texto">&nbsp; <b>Nome</b></td>

    <td class="texto">&nbsp; <input type="text" name="campo1" size="45" onFocus="nextfield ='campo2';" class="box"></td>

    </tr>

    <tr>

    <td class="texto">&nbsp; <b>Endereço</b></td>

    <td class="texto">&nbsp; <input type="text" name="campo2" size="45" onFocus="nextfield ='campo3';" class="box"></td>

    </tr>

    <tr>

    <td class="texto">&nbsp; <b>E-Mail</b></td>

    <td class="texto">&nbsp; <input type="text" name="campo3" size="45" onFocus="nextfield ='campo4';" class="box"></td>

    </tr>

    <tr>

    <td class="texto">&nbsp; <b>Comentários</b></td>

    <td class="texto">&nbsp; <input type="text" name="campo4" size="45" onFocus="nextfield ='done';" class="box"></td>

    </tr>

    <tr>

    <td class="texto">&nbsp;</td>

    <td class="texto" align="center"><input type="submit" name="envia" value="Enviar" class="box"> &nbsp; <input type="reset" name="envia" value="Apagar" class="box"></td>

    </tr>

    </table>

    </center>

    </form>

    </body>

    </html>

  8. Você pode colocar um link para alguma página php.

    Tipo <a href="comprado.php?cod=12">imagem</a>

    No PHP você lê esse cod e guarda em algum campo hidden de seu formulário, assim você sabe que logo o seu cliente escolheu

  9. Ai amigo, obrigado pela ajuda, mas foi assim que fiz no começo.

    Assim não da certo, o php entende vazio como 0.

    Mas obrigado assim mesmo, já consegui resolver isso usando um esquema meio doido:

    $sZero = 0;

    if( $iPrioridade > $sZero )

    {

    $iPrioridade;

    }

    else

    {

    $iPrioridade = strcmp( $iPrioridade , $sZero );

    }

    if( $iPrioridade == -1 )

    {

    $iPrioridade = 999;

    }

    if( $iPrioridade == 0 )

    {

    $iPrioridade = 0;

    }

    Obrigado pessoal

  10. Boa tarde pessoal, beleza?

    Estou com um problema meio bobo, mas ainda não consegui resolver, alguém sabe como resolver isso?

    Tenho um formulário onde o campo Prioridade pode ser preenchido com valores de 0 a 10, até ai beleza.

    Só que tem um porém, quando esse campo não é preenchido tenho que acrescente esse valor 999, mas o php esta interpretando Vazio e 0 como a mesma coisa.

    Eu quero que seja feito assim :

    - Quando for 0, fica 0.

    - Quando for vazio fica 999.

    Beleza???

  11. Código acima????

    Só tem uma linha. rsrssr

    Vou te falar o que o código, essa linha esta fazendo:

    <?php

    if($Admin != "" && $_SESSION['logged'] == "")

    {

    Simbolos

    != = é <> ou diferente

    “” = vazio

    && = E

    == = igual

    Se( $Admin for diferente de vazio E $_SESSION['logged'] for igual a vazio )

    {

    Isso, no mínimo da erro de acesso...rsrsrs

    }

×
×
  • Criar Novo...