Visualizzazione dei risultati da 1 a 4 su 4

Discussione: autenticazione

  1. #1

    autenticazione

    salve,
    ho inserito questo script php per creare una autenticazione per una pagina web:

    <?php
    if(!isset($PHP_AUTH_USER))
    {
    Header("WWW-Authenticate: Basic realm=\"Xavier Protection\"");
    Header("HTTP/1.0 401 Unauthorized");
    echo "Text to send if user hits Cancel button\n";
    exit;
    }
    else
    {
    $user_passwords = array (
    "user1" => "password1",
    "user2" => "password2",
    "user3" => "password3",
    "user4" => "password4"
    );
    if (($PHP_AUTH_USER == "") || ($PHP_AUTH_PW == ""))
    {
    Header("HTTP/1.0 401 Unauthorized");
    echo "Sorry, could find your password!";
    exit;
    }
    else if (strcmp($user_passwords[$PHP_AUTH_USER],$PHP_AUTH_PW) == 0)
    {
    echo "This is the password protected page.";
    exit;
    }
    else
    {
    Header("HTTP/1.0 401 Unauthorized");
    echo "Sorry, could find your password!";
    exit;
    }
    }
    ?>

    ma mi da questo errore:

    Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\studenti.php:30) in C:\Program Files\Apache Group\Apache2\htdocs\studenti.php on line 33

    Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\studenti.php:30) in C:\Program Files\Apache Group\Apache2\htdocs\studenti.php on line 34
    Text to send if user hits Cancel button

    ho smanettato per un pò ma non sono riuscito a trovare una soluzione...sapreste aiutarmi?

  2. #2

  3. #3
    praticamente cosa dovrei fare?
    inserire il codice presente nel primo link?e se si dove?
    il bello è che prima funzionava...all'improvviso non ha più funzionato...

  4. #4
    risolto....grazie davvero!!!!

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