Quote Originariamente inviata da bstefano79 Visualizza il messaggio
prova a postare un po' di codice
consiglio anche di leggere questo http://www.html.it/pag/16431/lautenticazione/

Ecco il codice, è sicuramente diverso da quello dell'esempio:

codice:
<?php     
    // Define your username and password 
    $username = "xxx"; 
    $password = "xxx"; 
    
    if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) { 
        
    ?> 
    
    <h1>Login</h1> 
    
    <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 
        <p><label for="txtUsername">Username:</label> 
        <br /><input type="text" title="Enter your Username" name="txtUsername" /></p> 
        
        <p><label for="txtpassword">Password:</label> 
        <br /><input type="password" title="Enter your password" name="txtPassword" /></p> 
        
        <p><input type="submit" name="Submit" value="Login" /></p>
        
    </form> 
    
    <?php 
        
    } 
    else { 
        
    ?> 
    
    <html>
        <head>
            <meta name="viewport" content="width=device-width" />
            <title>LED Control</title>
        </head>
        <body>
            LED Control:
            <form method="post" action="index.php">
                <input type="button" value="ON" name="on" id="acceso" onclick="a">
                <input type="button" value="OFF" name="off" id="spento" onclick="b">
            </form>
            <?php
                $setmode2 = shell_exec("/usr/local/bin/gpio -g mode 2 out");
                if(isset($_POST['on'])){
                    $gpio_on = shell_exec("/usr/local/bin/gpio -g write 2 1");
                    echo "LED is on<br>";
                }
                else if(isset($_POST['off'])){
                    $gpio_off = shell_exec("/usr/local/bin/gpio -g write 2 0");
                    echo "LED is off<br>";
                }
            ?>
    </body>
    </html>
    
    <?php 
        
    } 
    
?>