Jump to content
Fórum Script Brasil
  • 0

Asp para Php


khabulkhan

Question

Estou tentando fazer uma conversão ASP para PHP, gostaria de ajuda, pois sou iniciante e gostaria de saber quais são os controles equivalentes. Estou usando dreamweaver. Obrigado.

linha 39: $Mailer.$AddRecipient "Suporte" , "suporte@site.com.br";

linha 52: response.redirect "../index.htm";

linha 68: $rs.$open $mysql , , , , $adCmdText;

linha 70: if (NOT $rs.$EOF) {

<?php

?>
<?@ $Language=$VBScript?>

<!--#Include virtual="/ADOVBS.INC"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<?

function Cripto (){

$Id = session("info_chave");
for ($j=1; $j<=8; $j++) {
    if (Not ($j == 1 || $j == 3)) {
        $n[0] = $n[0].mid($Id, $j, 1);
    }
}
$Id = $n[0];
$n[0] = Cint(left($Id, 1)) + Cint(mid($Id, 2, 1));
$n[1] = Abs(Cint(mid($Id, 3, 1)) - Cint(mid($Id, 4, 1)));
$n[2] = CInt(mid($Id, 5, 1)) * CInt(mid($Id, 6, 1));
$Id = CLng($n[0].$n[1].$n[2]) * 76543;
$Id = left($Id, 1).mid($Id, 3, strlen($Id) - 2);
$n[0] = CInt(left($Id, 1)) + CInt(mid($Id, 2, 1));
$n[1] = Abs(CInt(mid($Id, 3, 1)) - CInt(mid($Id, 4, 1)));
$n[2] = CInt(mid($Id, 5, 1)) * CInt(mid($Id, 6, 1));
$Id = mid(CLng($n[0].$n[1].$n[2]) * 76543, 1, 8);
session("info_rg") = $id;
}

//=======================================================================================================
function enviaremail () {
$Mailer = Server.CreateObject("SMTxxx.Mailer");
$Mailer.$CustomCharSet = "ISO-8859-1";
$Mailer.$RemoteHost = "xxx";
$Mailer.$FromName = "Site *****";
$Mailer.$FromAddress = "suporte@site.com.br";
$Mailer.$AddRecipient "Suporte" , "suporte@site.com.br";
$Mailer.$Subject = "teste convertendo asp para php";
$Mailer.$BodyText = session("info_email")."\n"."\n".session("info_saida");
$Mailer.$SendMail;
$Mailer = nothing;
}

//========================================================================================================

function ProcessaPagina (){

session("info_trava") = @$_GET["trava"];
if (session("info_trava") != "ua") { 
    response.redirect "../index.htm";
    break;    
}

if (session("info_comer") == 0) {
    $mysql = "SELECT * FROM tblRegistros WHERE email = '".@$_GET["em"]."' and Clng(DataNascimento) = ".request.queryString("dt").";";
} else {
    $mysql = "SELECT * FROM tblRegistros WHERE chavecom = ".Clng(@$_GET["chavecom"]).";";
}


$abre_conexao_rw;
$rs = CreateObject("ADODB.Recordset");
$rs.$activeconnection = $conexaorw;
$rs.$CursorType = $adOpenDynamic;
$rs.$LockType = $adLockOptimistic;
$rs.$open $mysql , , , , $adCmdText;

if (NOT $rs.$EOF) {
    if (session("info_comer") == 0) {
        if ($rs.$fields["bloqueado"]==-1) {
            $valor_registro= 2; //BLOQUEADO
            session("info_saida")="Usuário bloqueado.";
            $rs.close;
            $rs = nothing;
        } else {
            if (Clng(date)- $rs.$fields["dataAno"] >= 365) {
                $rs.$fields["dataAno"]= Clng(date);
                $rs.$fields["totalAno"]=1;
                $rs.$Update;    
            } else {
                if ($rs.$fields["totalAno"] >= (8 * $rs.$fields["nLicenca"])) {
                    $rs.close;
                    $rs = nothing;
                     $fecha_conexao_rw;
                    $valor_registro= 3; //MAIS DE 8 REGISTRO EM MENOS DE 1 ANO
                    session("info_email")= @$_GET["em"];
                    session("info_saida")="Mais de 8 registros em menos de um 1 ano.";
                    enviaremail;
                    session.$abandon;
                    break;        
                }
            }
            $valor_tempo = Clng(date)- $rs.$fields["dataquinzena"];
            if (Clng(date)- $rs.$fields["dataquinzena"] > 14) {
                $rs.$fields["dataquinzena"]= Clng(date);
                $rs.$fields["totalquinzena"]= 1;
                //rs.fields("totalquinzena")= rs.fields("totalquinzena") + 1
                $rs.$Update;
                $rs.close;
                $rs = nothing;
                cripto;
                $valor_registro = session("info_rg");
                session("info_saida")= session("info_rg");
            } else {
                if ($rs.$fields["totalquinzena"] >= (2 * $rs.$fields["nLicenca"])) {
                    $valor_registro= 4; //MAIS DE 2 REGISTROS EM MENOS DE 15 DIAS
                    session("info_saida")="Mais de 2 registro em menos de 15 dias.";
                } else {
                    $rs.$fields["totalquinzena"]= $rs.$fields["totalquinzena"] + 1;
                    $rs.$fields["totalano"]= $rs.$fields["totalano"] + 1;
                    $rs.$Update;
                    session("info_chave")= @$_GET["chave"];
                    cripto;
                    $valor_registro = session("info_rg");
                    session("info_saida")= session("info_rg");
                }
                $rs.close;
                $rs = nothing;
            }
        }
    } else { //se for comercial
        if ($rs.$fields["bloqueado"]==-1) {
            $valor_registro= 2; //BLOQUEADO
            session("info_saida")="Usuário bloqueado.";
            $rs.close;
            $rs = nothing;
        } else {
            cripto;
            $valor_registro = session("info_rg");
            session("info_saida")= session("info_rg");
        }
    }
} else {
    $rs.close;
    $rs = nothing;
    $valor_registro= 1; //USUARIO INVÁLIDO
    session("info_saida")="Login Inválido.";
}
if (session("info_comer") == 0) {
    session("info_email")= @$_GET["em"];
} else {
    session("info_email")= @$_GET["chavecom"];
}
enviaremail;
$fecha_conexao_rw;
session.$abandon;
}

//------------------------------------------------------------------------------------------------------

session("info_comer") = @$_GET["com"];
session("info_chave") = @$_GET["chave"];
$ProcessaPagina;
?>

<html>

<head>
    <title>Registro online</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Language" content="pt-br">
</head>

<body>
<form method="get" name="frmRegistro">
    <p><input type="text" id="rg" name="registro" value="<?=$valor_registro?>"></p>
    <p><input type="text" id="rg1" name="registro2" value="<?=@$_GET["em"]?>"></p>
    <p><input type="text" id="rg2" name="registro3" value="<?=@$_GET["dt"]?>"></p>
    <p><input type="text" id="rg3" name="registro4" value="<?=$valor_tempo?>"></p>
    <p><input type="text" id="rg3" name="registro4" value="<?=@$_GET["chave"]?>"></p>
    <p><input type="text" id="rg3" name="registro4" value="<?=@$_GET["chavecom"]?>"></p>
</form>
</body>
</html>

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...