Visualizzazione dei risultati da 1 a 7 su 7

Discussione: da asp a php

  1. #1

    da asp a php

    ciao a tutti, devo tradurre un file asp in php in quanto il sito poggia su server unix.
    Allora io ho questo codice asp:

    <%
    option explicit
    %>

    <%
    dim a1
    a1 = request.querystring("a1")

    if(a1 = "login")then
    dim username, password
    username = trim(request.form("username"))
    password = trim(request.form("password"))

    dim urlRedir
    urlRedir = "ftp://" & username & ":" & password & "@ftp.xxx.xx"

    ' response.write(urlRedir)
    response.redirect(urlRedir)
    end if
    %>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title></title>
    </head>

    <body>

    <form method="post" action="default.asp?a1=login">
    <table>
    <tr>
    <td>Nome utente:</td>
    <td><input type="text" name="username" /></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td><input type="password" name="password" /></td>
    </tr>
    <tr>
    <td colspan="2" style="text-align: center;"><button type="submit" />Login &raquo;</button></td>
    </tr>
    </table>
    </form>

    </body>
    </html>



    Usando il programmino asp2php mi è venuto fuori questo:


    <?
    // Option $explicit;
    ?>

    <?
    $a1=$_GET["a1"];

    if (($a1=="login"))
    {

    $username=trim($_POST["username"]);
    $password=trim($_POST["password"]);

    $urlRedir="ftp://".$username.":".$password."@ftp.xxx.xx";

    // response.write(urlRedir)

    header("Location: ".$urlRedir);
    }

    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title></title>
    </head>

    <body>

    <form method="post" action="default.php?a1=login">
    <table>
    <tr>
    <td>Nome utente:</td>
    <td><input type="text" name="username" /></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td><input type="password" name="password" /></td>
    </tr>
    <tr>
    <td colspan="2" style="text-align: center;"><button type="submit" />Login &raquo;</button></td>
    </tr>
    </table>
    </form>

    </body>
    </html>


    ma non va, inserisco i dati ma mi rimanda alla pagina di login :-( :-(
    Per caso qualcuno sa dove possa trovarsi l'errore?
    Grazie mille :-)

  2. #2
    action="default.asp?a1=login"

    devi mettere il nome del file .php

    ...::: DESIDERARE E' UMANO :::...
    ...::: POSSEDERE E' DIVINO :::...
    ...::: HAVE A NICE DAY :::...
    (¯`·.¸¸.->ĐĮ ĦΞŁŁ<-.¸¸.·`¯)
    http://www.djhellclub.com

  3. #3

  4. #4
    Originariamente inviato da djhell
    action="default.asp?a1=login"

    devi mettere il nome del file .php

    uhm...il testo php è quello in rosso, e lì c'è :-)

  5. #5
    Originariamente inviato da filippo.toso
    Inserisci exit(); dopo l'header location.
    Grazie, ho fatto come mi hai detto, sempre comunque dentro l'if giusto?
    Stesso problema.... :-(
    ho provato anche a metterlo dopo l'if...quindi in questo due modi:

    if (($a1=="login"))
    {

    $username=trim($_POST["username"]);
    $password=trim($_POST["password"]);

    $urlRedir="ftp://".$username.":".$password."@ftp.xxxx.xx";

    // response.write(urlRedir)

    header("Location: ".$urlRedir);
    exit();
    }

    e


    if (($a1=="login"))
    {

    $username=trim($_POST["username"]);
    $password=trim($_POST["password"]);

    $urlRedir="ftp://".$username.":".$password."@ftp.xxxx.xx";

    // response.write(urlRedir)

    header("Location: ".$urlRedir);

    }
    exit();
    niente da fare purtroppo :-(

  6. #6
    A me funziona, lo stesso identico codice che hai messo tu... con 2 sole modifiche

    <?
    $a1=$_GET["a1"];

    if (($a1=="login"))
    {

    $username=trim($_POST["username"]);
    $password=trim($_POST["password"]);

    $urlRedir="ftp://".$username.":".$password."@ftp.xxx.xx";

    // response.write(urlRedir)

    header("Location: ".$urlRedir);
    exit();
    }

    ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title></title>
    </head>

    <body>

    <form method="post" action="?a1=login">
    <table>
    <tr>
    <td>Nome utente:</td>
    <td><input type="text" name="username" /></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td><input type="password" name="password" /></td>
    </tr>
    <tr>
    <td colspan="2" style="text-align: center;"><button type="submit" />Login »</button></td>
    </tr>
    </table>
    </form>

    </body>
    </html>
    ...::: DESIDERARE E' UMANO :::...
    ...::: POSSEDERE E' DIVINO :::...
    ...::: HAVE A NICE DAY :::...
    (¯`·.¸¸.->ĐĮ ĦΞŁŁ<-.¸¸.·`¯)
    http://www.djhellclub.com

  7. #7

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.