Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    area riservata modificare echo...

    Ciao ragazzi, nei file di download ho trovato uno script che mi serviva è sensazionale.

    form
    config
    area protetta


    ora...ho visto che nell'area protetta c'è il messaggio che esce se l'utente sbaglia idati:

    <?
    }
    else {
    echo "
    [b]Accesso negato, effettua in modo corretto il <a href=\"home.html\">login</a>[b]";
    }
    ?>


    è possibile fare in modo che invece di uscire una pagina bianca con la scritta esca il mio layout con sempre la dicitura accesso fallito...?

    cosa dovrei modificare?


    posto i tre codici..
    un abbraccio
    e grazie milleeee








    Form:

    <html>
    <head>
    <title>Protezione pagina</title>
    </head>
    <body>


    Protezione pagina "pag_protetta"</p>
    <form method="post" action="pag_protetta.php">


    Username: <input type="text" name="username" size="20"></p>


    Password: <input type="password" name="password" size="20"></p>


    <input type="submit" value="Login">
    <input type="reset" value="Annulla">
    </form>
    </body>
    </html>





    Config:

    <?
    $usern='demo'; # valore username
    $passd='demolo'; # valore password
    ?>



    AreaProtetta:
    <?
    include 'config.php';
    $username=$_POST['username'];
    $password=$_POST['password'];

    if ($username==$usern && $password==$passd) {
    ?>

    <!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>
    <body>
    <div id="main">

    </div>
    </body>
    </html>

    <?
    }
    else {
    echo "
    [b]Accesso negato, effettua in modo corretto il <a href=\"home.html\">login</a>[b]";
    }
    ?>

  2. #2
    Utente di HTML.it L'avatar di echoweb
    Registrato dal
    Sep 2008
    Messaggi
    419
    Ciao,
    prova a cambiare il file form in questo modo....

    Codice PHP:
    <?php

    include 'config.php';

    if(isset(
    $_POST[btn_login]))
    {
        
    $username=$_POST['username'];
        
    $password=$_POST['password'];

        if (
    $username==$usern && $password==$passd)
        {
            break();
        } 
        else
        {
            echo
    "ACCESSO FALLITO";
        }


    }

    ?>

    <html>
    <head>
    <title>Protezione pagina</title>
    </head>
    <body>


    Protezione pagina "pag_protetta"</p>

    <form method="post" action="form.php">



    Username: <input type="text" name="username" size="20"></p>


    Password: <input type="password" name="password" size="20"></p>


    <input type="submit" name="btn_login" value="Login">
    <input type="reset" value="Annulla">
    </form>
    </body>
    </html>


    "Non soffocare la tua ispirazione e la tua immaginazione,
    non diventare lo schiavo del tuo modello"

    Vincent van Gogh

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 © 2024 vBulletin Solutions, Inc. All rights reserved.